identity -> position

This commit is contained in:
camthesaxman 2018-01-16 14:01:31 -06:00
parent 11cb3275cc
commit 157b88b6db
35 changed files with 895 additions and 881 deletions

View File

@ -5,8 +5,8 @@
.text .text
thumb_func_start GetBankPosition thumb_func_start GetBankCoord
GetBankPosition: @ 80A5C6C GetBankCoord: @ 80A5C6C
push {r4,r5,lr} push {r4,r5,lr}
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
@ -40,7 +40,7 @@ _080A5C9C:
_080A5CB0: _080A5CB0:
ldr r4, =gUnknown_08525F58 ldr r4, =gUnknown_08525F58
adds r0, r5, 0 adds r0, r5, 0
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 22 lsrs r0, 22
ldr r1, =gBattleTypeFlags ldr r1, =gBattleTypeFlags
@ -56,7 +56,7 @@ _080A5CB0:
_080A5CD8: _080A5CD8:
ldr r4, =gUnknown_08525F58 ldr r4, =gUnknown_08525F58
adds r0, r5, 0 adds r0, r5, 0
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 22 lsrs r0, 22
ldr r1, =gBattleTypeFlags ldr r1, =gBattleTypeFlags
@ -154,7 +154,7 @@ _080A5DB0:
pop {r4,r5} pop {r4,r5}
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end GetBankPosition thumb_func_end GetBankCoord
thumb_func_start sub_80A5DB8 thumb_func_start sub_80A5DB8
sub_80A5DB8: @ 80A5DB8 sub_80A5DB8: @ 80A5DB8
@ -476,7 +476,7 @@ _080A603E:
lsrs r4, r0, 16 lsrs r4, r0, 16
_080A605C: _080A605C:
adds r0, r6, 0 adds r0, r6, 0
bl GetBankIdentity bl GetBankPosition
ldr r3, =gUnknown_08525F58 ldr r3, =gUnknown_08525F58
lsls r0, 24 lsls r0, 24
lsrs r0, 22 lsrs r0, 22
@ -577,7 +577,7 @@ _080A611C:
_080A6126: _080A6126:
adds r0, r4, 0 adds r0, r4, 0
adds r1, r5, 0 adds r1, r5, 0
bl GetBankPosition bl GetBankCoord
_080A612E: _080A612E:
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
@ -592,7 +592,7 @@ GetBankSpriteDefault_Y: @ 80A6138
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0x4 movs r1, 0x4
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
pop {r1} pop {r1}
@ -611,7 +611,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C
beq _080A6170 beq _080A6170
adds r0, r4, 0 adds r0, r4, 0
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 8 lsrs r0, 8
movs r1, 0x80 movs r1, 0x80
@ -620,7 +620,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C
_080A6170: _080A6170:
adds r0, r4, 0 adds r0, r4, 0
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 8 lsrs r0, 8
movs r1, 0x88 movs r1, 0x88
@ -642,7 +642,7 @@ sub_80A6190: @ 80A6190
lsrs r5, r0, 24 lsrs r5, r0, 24
adds r0, r5, 0 adds r0, r5, 0
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r6, r0, 24 lsrs r6, r0, 24
bl IsContest bl IsContest
@ -1245,13 +1245,13 @@ sub_80A65EC: @ 80A65EC
ldr r5, =gAnimBankTarget ldr r5, =gAnimBankTarget
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x32] strh r0, [r4, 0x32]
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x36] strh r0, [r4, 0x36]
@ -1442,13 +1442,13 @@ sub_80A6760: @ 80A6760
ldr r5, =gAnimBankAttacker ldr r5, =gAnimBankAttacker
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x32] strh r0, [r4, 0x32]
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x36] strh r0, [r4, 0x36]
@ -1550,13 +1550,13 @@ sub_80A6838: @ 80A6838
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]
@ -1578,13 +1578,13 @@ sub_80A6864: @ 80A6864
ldr r7, =gAnimBankAttacker ldr r7, =gAnimBankAttacker
ldrb r0, [r7] ldrb r0, [r7]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r6, r0, 24 lsrs r6, r0, 24
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r6, r0 cmp r6, r0
@ -1810,7 +1810,7 @@ _080A6A04:
GetBankSide: @ 80A6A30 GetBankSide: @ 80A6A30
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldr r1, =gBanksByIdentity ldr r1, =gBankPositions
adds r0, r1 adds r0, r1
ldrb r1, [r0] ldrb r1, [r0]
movs r0, 0x1 movs r0, 0x1
@ -1819,16 +1819,16 @@ GetBankSide: @ 80A6A30
.pool .pool
thumb_func_end GetBankSide thumb_func_end GetBankSide
thumb_func_start GetBankIdentity thumb_func_start GetBankPosition
GetBankIdentity: @ 80A6A44 GetBankPosition: @ 80A6A44
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldr r1, =gBanksByIdentity ldr r1, =gBankPositions
adds r0, r1 adds r0, r1
ldrb r0, [r0] ldrb r0, [r0]
bx lr bx lr
.pool .pool
thumb_func_end GetBankIdentity thumb_func_end GetBankPosition
thumb_func_start GetBankByIdentity thumb_func_start GetBankByIdentity
GetBankByIdentity: @ 80A6A54 GetBankByIdentity: @ 80A6A54
@ -1840,7 +1840,7 @@ GetBankByIdentity: @ 80A6A54
ldrb r2, [r0] ldrb r2, [r0]
cmp r1, r2 cmp r1, r2
bcs _080A6A7E bcs _080A6A7E
ldr r4, =gBanksByIdentity ldr r4, =gBankPositions
ldrb r0, [r4] ldrb r0, [r4]
cmp r0, r3 cmp r0, r3
beq _080A6A7E beq _080A6A7E
@ -1883,7 +1883,7 @@ IsBankSpritePresent: @ 80A6A90
b _080A6B18 b _080A6B18
.pool .pool
_080A6ABC: _080A6ABC:
ldr r0, =gBanksByIdentity ldr r0, =gBankPositions
adds r0, r4, r0 adds r0, r4, r0
ldrb r0, [r0] ldrb r0, [r0]
cmp r0, 0xFF cmp r0, 0xFF
@ -3685,7 +3685,7 @@ _080A785C:
ldr r4, =gAnimBankTarget ldr r4, =gAnimBankTarget
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r1, [r6, 0x4] ldrh r1, [r6, 0x4]
@ -3693,7 +3693,7 @@ _080A785C:
strh r0, [r5, 0x32] strh r0, [r5, 0x32]
ldrb r0, [r4] ldrb r0, [r4]
adds r1, r7, 0 adds r1, r7, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r6, [r6, 0x6] ldrh r6, [r6, 0x6]
@ -3733,7 +3733,7 @@ _080A78CC:
ldr r5, =gAnimBankTarget ldr r5, =gAnimBankTarget
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r1, [r4, 0x4] ldrh r1, [r4, 0x4]
@ -3741,7 +3741,7 @@ _080A78CC:
strh r0, [r6, 0x32] strh r0, [r6, 0x32]
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r1, [r4, 0x6] ldrh r1, [r4, 0x6]
@ -3828,7 +3828,7 @@ _080A798E:
strh r0, [r5, 0x2E] strh r0, [r5, 0x2E]
adds r0, r6, 0 adds r0, r6, 0
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r2, [r4, 0x4] ldrh r2, [r4, 0x4]
@ -3836,7 +3836,7 @@ _080A798E:
strh r0, [r5, 0x32] strh r0, [r5, 0x32]
adds r0, r6, 0 adds r0, r6, 0
adds r1, r7, 0 adds r1, r7, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r4, [r4, 0x6] ldrh r4, [r4, 0x6]
@ -5027,7 +5027,7 @@ _080A82FC:
b _080A8320 b _080A8320
_080A8300: _080A8300:
adds r0, r4, 0 adds r0, r4, 0
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0x1E movs r1, 0x1E
@ -5053,7 +5053,7 @@ sub_80A8328: @ 80A8328
push {r4,lr} push {r4,lr}
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl IsContest bl IsContest
@ -5093,7 +5093,7 @@ sub_80A8364: @ 80A8364
cmp r0, 0 cmp r0, 0
bne _080A838A bne _080A838A
adds r0, r4, 0 adds r0, r4, 0
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0 cmp r0, 0
@ -5713,7 +5713,7 @@ _080A88A6:
_080A88AE: _080A88AE:
mov r0, r8 mov r0, r8
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrb r1, [r4] ldrb r1, [r4]
@ -5722,7 +5722,7 @@ _080A88AE:
_080A88C0: _080A88C0:
mov r0, r8 mov r0, r8
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrb r1, [r4] ldrb r1, [r4]
@ -5731,7 +5731,7 @@ _080A88C0:
_080A88D2: _080A88D2:
mov r0, r8 mov r0, r8
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrb r2, [r4] ldrb r2, [r4]
@ -5744,7 +5744,7 @@ _080A88E4:
_080A88EA: _080A88EA:
mov r0, r8 mov r0, r8
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrb r2, [r4] ldrb r2, [r4]
@ -5757,7 +5757,7 @@ _080A88FC:
_080A8902: _080A8902:
mov r0, r8 mov r0, r8
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r0, 0x1F adds r0, 0x1F
@ -5798,13 +5798,13 @@ _080A8942:
_080A8946: _080A8946:
adds r0, r4, 0 adds r0, r4, 0
adds r1, r5, 0 adds r1, r5, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
mov r8, r0 mov r8, r0
adds r0, r4, 0 adds r0, r4, 0
adds r1, r6, 0 adds r1, r6, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r7, r0, 24 lsrs r7, r0, 24
bl IsDoubleBattle bl IsDoubleBattle
@ -5819,12 +5819,12 @@ _080A8946:
eors r4, r0 eors r4, r0
adds r0, r4, 0 adds r0, r4, 0
adds r1, r5, 0 adds r1, r5, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
adds r0, r4, 0 adds r0, r4, 0
adds r1, r6, 0 adds r1, r6, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r3, r0, 24 lsrs r3, r0, 24
mov r0, r8 mov r0, r8
@ -6392,13 +6392,13 @@ sub_80A8E30: @ 80A8E30
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]

View File

@ -334,7 +334,7 @@ sub_80A9EF4: @ 80A9EF4
ldr r4, =gAnimBankTarget ldr r4, =gAnimBankTarget
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 8 lsrs r0, 8
ldr r1, =0xffe00000 ldr r1, =0xffe00000
@ -342,7 +342,7 @@ sub_80A9EF4: @ 80A9EF4
lsrs r5, r0, 16 lsrs r5, r0, 16
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 8 lsrs r0, 8
ldr r1, =0xffdc0000 ldr r1, =0xffdc0000

File diff suppressed because it is too large Load Diff

View File

@ -90,7 +90,7 @@ sub_815A160: @ 815A160
ldr r6, =gAnimBankTarget ldr r6, =gAnimBankTarget
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 24 lsls r4, 24
lsrs r4, 8 lsrs r4, 8
@ -100,7 +100,7 @@ sub_815A160: @ 815A160
asrs r4, 16 asrs r4, 16
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
adds r1, r0, 0 adds r1, r0, 0
lsls r1, 24 lsls r1, 24
lsrs r1, 8 lsrs r1, 8
@ -210,13 +210,13 @@ sub_815A254: @ 815A254
ldr r4, =gAnimBankTarget ldr r4, =gAnimBankTarget
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r7, r0, 0 adds r7, r0, 0
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r6, r0, 0 adds r6, r0, 0
@ -1254,13 +1254,13 @@ sub_815AAA4: @ 815AAA4
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]
@ -1510,7 +1510,7 @@ _0815ACEC:
_0815ACEE: _0815ACEE:
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r6, [r6, 0x2] ldrh r6, [r6, 0x2]
@ -1518,7 +1518,7 @@ _0815ACEE:
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]
@ -1906,13 +1906,13 @@ sub_815AFF0: @ 815AFF0
ldr r6, =gAnimBankAttacker ldr r6, =gAnimBankAttacker
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0xC] strh r0, [r4, 0xC]
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0xE] strh r0, [r4, 0xE]
@ -2281,13 +2281,13 @@ _0815B2D8:
ldr r4, =gAnimBankTarget ldr r4, =gAnimBankTarget
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x32] strh r0, [r5, 0x32]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x36] strh r0, [r5, 0x36]
@ -2373,13 +2373,13 @@ _0815B3BE:
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]
@ -2817,7 +2817,7 @@ _0815B71E:
ldr r0, =gAnimBankAttacker ldr r0, =gAnimBankAttacker
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x32] strh r0, [r4, 0x32]
@ -3020,7 +3020,7 @@ _0815B8A8:
.pool .pool
_0815B8E0: _0815B8E0:
ldrb r0, [r5] ldrb r0, [r5]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r1, r0, 24 lsrs r1, r0, 24
_0815B8EA: _0815B8EA:
@ -3624,14 +3624,14 @@ _0815BE2E:
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r0, r5 adds r0, r5
strh r0, [r7, 0x20] strh r0, [r7, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r0, 0x20 adds r0, 0x20
@ -3998,7 +3998,7 @@ _0815C124:
_0815C15C: _0815C15C:
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r4, r0, 24 lsrs r4, r0, 24
bl IsDoubleBattle bl IsDoubleBattle
@ -4994,13 +4994,13 @@ sub_815C95C: @ 815C95C
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]
@ -5531,13 +5531,13 @@ sub_815CDB4: @ 815CDB4
ldr r5, =gAnimBankAttacker ldr r5, =gAnimBankAttacker
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x20] strh r0, [r4, 0x20]
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x22] strh r0, [r4, 0x22]
@ -5842,13 +5842,13 @@ _0815D05A:
ldr r5, =gAnimBankAttacker ldr r5, =gAnimBankAttacker
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 24 lsls r4, 24
lsrs r4, 24 lsrs r4, 24
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
mov r2, r10 mov r2, r10
lsls r1, r2, 16 lsls r1, r2, 16
@ -6840,7 +6840,7 @@ _0815D896:
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r1, [r6, 0x2] ldrh r1, [r6, 0x2]
@ -6848,7 +6848,7 @@ _0815D896:
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r6, [r6, 0x4] ldrh r6, [r6, 0x4]
@ -7382,13 +7382,13 @@ _0815DCEA:
ldrb r4, [r0] ldrb r4, [r0]
adds r0, r4, 0 adds r0, r4, 0
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x10] strh r0, [r5, 0x10]
adds r0, r4, 0 adds r0, r4, 0
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x12] strh r0, [r5, 0x12]
@ -7789,7 +7789,7 @@ sub_815E01C: @ 815E01C
_0815E038: _0815E038:
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
ldr r4, =gBattleAnimArgs ldr r4, =gBattleAnimArgs
lsrs r0, 24 lsrs r0, 24
@ -7798,7 +7798,7 @@ _0815E038:
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
ldrb r0, [r6] ldrb r0, [r6]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r1, [r4, 0x2] ldrh r1, [r4, 0x2]
@ -7931,7 +7931,7 @@ _0815E14E:
bne _0815E188 bne _0815E188
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0 movs r1, 0
@ -7951,7 +7951,7 @@ _0815E17C:
_0815E188: _0815E188:
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0 movs r1, 0
@ -7971,7 +7971,7 @@ _0815E1AC:
ldr r5, =gAnimBankAttacker ldr r5, =gAnimBankAttacker
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0 movs r1, 0
@ -7990,13 +7990,13 @@ _0815E1D0:
ldr r4, =gAnimBankTarget ldr r4, =gAnimBankTarget
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r6, 0x22] strh r0, [r6, 0x22]
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r6, 0x24] strh r0, [r6, 0x24]
@ -8349,14 +8349,14 @@ sub_815E47C: @ 815E47C
mov r10, r0 mov r10, r0
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r7, 0x1E] strh r0, [r7, 0x1E]
mov r1, r10 mov r1, r10
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r7, 0x20] strh r0, [r7, 0x20]
@ -8364,14 +8364,14 @@ sub_815E47C: @ 815E47C
mov r8, r0 mov r8, r0
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r7, 0x22] strh r0, [r7, 0x22]
mov r1, r8 mov r1, r8
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
mov r1, r8 mov r1, r8
ldrb r0, [r1] ldrb r0, [r1]
@ -8659,7 +8659,7 @@ _0815E724:
strh r1, [r4, 0x3C] strh r1, [r4, 0x3C]
adds r0, r5, 0 adds r0, r5, 0
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x22] strh r0, [r4, 0x22]
@ -8950,7 +8950,7 @@ _0815E970:
_0815E972: _0815E972:
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]
@ -9342,7 +9342,7 @@ sub_815EC48: @ 815EC48
ldr r5, =gAnimBankAttacker ldr r5, =gAnimBankAttacker
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 24 lsls r4, 24
lsrs r4, 24 lsrs r4, 24
@ -9350,7 +9350,7 @@ sub_815EC48: @ 815EC48
movs r0, 0x2 movs r0, 0x2
eors r0, r1 eors r0, r1
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r4, r0 cmp r4, r0
@ -9771,14 +9771,14 @@ _0815EFEC:
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
ldrh r0, [r4, 0x3C] ldrh r0, [r4, 0x3C]
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r1, r0, 24 lsrs r1, r0, 24
_0815F00C: _0815F00C:
@ -9994,10 +9994,10 @@ sub_815F18C: @ 815F18C
ldr r4, =gAnimBankTarget ldr r4, =gAnimBankTarget
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
ldrb r0, [r4] ldrb r0, [r4]
bl GetBankSide bl GetBankSide
lsls r0, 24 lsls r0, 24
@ -10387,7 +10387,7 @@ _0815F4C8:
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x3 movs r1, 0x3
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x22] strh r0, [r5, 0x22]
@ -11180,7 +11180,7 @@ _0815FB50:
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
lsls r3, r5, 16 lsls r3, r5, 16
@ -11318,7 +11318,7 @@ _0815FC56:
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r4, r0 cmp r4, r0
@ -11331,7 +11331,7 @@ _0815FCB4:
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r4, r0 cmp r4, r0
@ -11469,7 +11469,7 @@ _0815FD8C:
mov r1, r10 mov r1, r10
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r3, r5, 0 adds r3, r5, 0
@ -11499,7 +11499,7 @@ _0815FE0C:
mov r2, r10 mov r2, r10
ldrb r0, [r2] ldrb r0, [r2]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r3, r5, 0 adds r3, r5, 0
@ -11566,7 +11566,7 @@ _0815FE92:
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r0, 0x10 adds r0, 0x10
@ -11724,14 +11724,14 @@ _08160008:
ldr r0, =gAnimBankAttacker ldr r0, =gAnimBankAttacker
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r5, r0, 0 adds r5, r0, 0
ldr r0, =gAnimBankTarget ldr r0, =gAnimBankTarget
ldrb r0, [r0] ldrb r0, [r0]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
adds r2, r0, 0 adds r2, r0, 0
@ -12169,7 +12169,7 @@ sub_81603A8: @ 81603A8
ldr r4, =gAnimBankAttacker ldr r4, =gAnimBankAttacker
ldrb r0, [r4] ldrb r0, [r4]
movs r1, 0x2 movs r1, 0x2
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r5, 0x20] strh r0, [r5, 0x20]

View File

@ -907,13 +907,13 @@ _08170C44:
ldr r5, =gAnimBankAttacker ldr r5, =gAnimBankAttacker
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 24 lsls r4, 24
lsrs r4, 24 lsrs r4, 24
ldrb r0, [r5] ldrb r0, [r5]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
adds r1, r0, 0 adds r1, r0, 0
lsls r1, 24 lsls r1, 24
ldr r2, =gSprites ldr r2, =gSprites
@ -1166,14 +1166,14 @@ sub_8170E04: @ 8170E04
mov r8, r2 mov r8, r2
ldrb r0, [r2] ldrb r0, [r2]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r6, 0x30] strh r0, [r6, 0x30]
mov r1, r8 mov r1, r8
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
subs r0, 0x10 subs r0, 0x10
@ -1317,14 +1317,14 @@ _08170F54:
mov r8, r1 mov r8, r1
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r6, 0x30] strh r0, [r6, 0x30]
mov r1, r8 mov r1, r8
ldrb r0, [r1] ldrb r0, [r1]
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
subs r0, 0x10 subs r0, 0x10
@ -5234,12 +5234,12 @@ _0817303A:
ldrb r0, [r4, 0x8] ldrb r0, [r4, 0x8]
mov r8, r0 mov r8, r0
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 24 lsrs r5, r0, 24
mov r0, r8 mov r0, r8
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r2, r0, 24 lsrs r2, r0, 24
movs r1, 0x1E movs r1, 0x1E
@ -5579,7 +5579,7 @@ sub_817330C: @ 817330C
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
ldr r5, =gBattleAnimArgs ldr r5, =gBattleAnimArgs
lsrs r0, 24 lsrs r0, 24
@ -5591,7 +5591,7 @@ sub_817330C: @ 817330C
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
ldrh r5, [r5, 0x6] ldrh r5, [r5, 0x6]

View File

@ -136,18 +136,18 @@ _0817CA4C:
_0817CA9C: _0817CA9C:
ldr r0, =gBankAttacker ldr r0, =gBankAttacker
ldrb r0, [r0] ldrb r0, [r0]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 25 lsrs r0, 25
mov r8, r0 mov r8, r0
ldr r0, =gBankTarget ldr r0, =gBankTarget
ldrb r0, [r0] ldrb r0, [r0]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r5, r0, 25 lsrs r5, r0, 25
ldr r0, =gEffectBank ldr r0, =gEffectBank
ldrb r0, [r0] ldrb r0, [r0]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r3, r0, 25 lsrs r3, r0, 25
ldr r1, [sp] ldr r1, [sp]
@ -2593,7 +2593,7 @@ _0817E122:
_0817E184: _0817E184:
mov r2, r10 mov r2, r10
ldrb r0, [r2] ldrb r0, [r2]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 25 lsrs r0, 25
lsls r0, 3 lsls r0, 3
@ -2617,7 +2617,7 @@ _0817E184:
strb r1, [r0] strb r1, [r0]
mov r1, r10 mov r1, r10
ldrb r0, [r1] ldrb r0, [r1]
bl GetBankIdentity bl GetBankPosition
lsls r0, 24 lsls r0, 24
lsrs r0, 25 lsrs r0, 25
lsls r0, 3 lsls r0, 3
@ -4414,7 +4414,7 @@ _0817EFC2:
ldr r4, =gSideAffecting ldr r4, =gSideAffecting
mov r1, r9 mov r1, r9
ldrb r0, [r1] ldrb r0, [r1]
bl GetBankIdentity bl GetBankPosition
movs r1, 0x1 movs r1, 0x1
ands r1, r0 ands r1, r0
lsls r1, 1 lsls r1, 1

View File

@ -1048,7 +1048,7 @@ _080D8004:
bl sub_80DC594 bl sub_80DC594
bl sub_80DC5E8 bl sub_80DC5E8
bl sub_80DC7EC bl sub_80DC7EC
ldr r1, =gBanksByIdentity ldr r1, =gBankPositions
strb r4, [r1] strb r4, [r1]
movs r0, 0x1 movs r0, 0x1
strb r0, [r1, 0x1] strb r0, [r1, 0x1]
@ -13829,13 +13829,13 @@ sub_80DEA5C: @ 80DEA5C
strh r0, [r4, 0x26] strh r0, [r4, 0x26]
movs r0, 0x3 movs r0, 0x3
movs r1, 0 movs r1, 0
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x20] strh r0, [r4, 0x20]
movs r0, 0x3 movs r0, 0x3
movs r1, 0x1 movs r1, 0x1
bl GetBankPosition bl GetBankCoord
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
strh r0, [r4, 0x22] strh r0, [r4, 0x22]

View File

@ -45,10 +45,10 @@
.set OPPONENT_TELEPORTED, 0xA .set OPPONENT_TELEPORTED, 0xA
@ identities @ identities
.set IDENTITY_PLAYER_MON1, 0 .set B_POSITION_PLAYER_LEFT, 0
.set IDENTITY_OPPONENT_MON1, 1 .set B_POSITION_OPPONENT_LEFT, 1
.set IDENTITY_PLAYER_MON2, 2 .set B_POSITION_PLAYER_RIGHT, 2
.set IDENTITY_OPPONENT_MON2, 3 .set B_POSITION_OPPONENT_RIGHT, 3
@ status 1 @ status 1
.set STATUS_SLEEP, 0x7 .set STATUS_SLEEP, 0x7

View File

@ -2950,7 +2950,7 @@ BattleScript_LocalBattleWonLoseTexts::
waitstate waitstate
printstring STRINGID_TRAINER1LOSETEXT printstring STRINGID_TRAINER1LOSETEXT
jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleWonReward jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleWonReward
trainerslideout IDENTITY_OPPONENT_MON1 trainerslideout B_POSITION_OPPONENT_LEFT
waitstate waitstate
trainerslidein GBANK_1 trainerslidein GBANK_1
waitstate waitstate
@ -2991,7 +2991,7 @@ BattleScript_LocalBattleLostPrintTrainersWinText::
jumpifbattletype BATTLE_TYPE_x800000, BattleScript_LocalBattleLostDoTrainer2WinText jumpifbattletype BATTLE_TYPE_x800000, BattleScript_LocalBattleLostDoTrainer2WinText
jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleLostEnd_ jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleLostEnd_
BattleScript_LocalBattleLostDoTrainer2WinText:: BattleScript_LocalBattleLostDoTrainer2WinText::
trainerslideout IDENTITY_OPPONENT_MON1 trainerslideout B_POSITION_OPPONENT_LEFT
waitstate waitstate
trainerslidein GBANK_1 trainerslidein GBANK_1
waitstate waitstate
@ -3007,7 +3007,7 @@ BattleScript_82DAA0B::
trainerslidein ATTACKER trainerslidein ATTACKER
waitstate waitstate
printstring STRINGID_TRAINER1WINTEXT printstring STRINGID_TRAINER1WINTEXT
trainerslideout IDENTITY_OPPONENT_MON1 trainerslideout B_POSITION_OPPONENT_LEFT
waitstate waitstate
trainerslidein GBANK_1 trainerslidein GBANK_1
waitstate waitstate
@ -3035,7 +3035,7 @@ BattleScript_82DAA5C::
trainerslidein ATTACKER trainerslidein ATTACKER
waitstate waitstate
printstring STRINGID_TRAINER1LOSETEXT printstring STRINGID_TRAINER1LOSETEXT
trainerslideout IDENTITY_OPPONENT_MON1 trainerslideout B_POSITION_OPPONENT_LEFT
waitstate waitstate
trainerslidein GBANK_1 trainerslidein GBANK_1
waitstate waitstate
@ -3058,7 +3058,7 @@ BattleScript_82DAAAE::
waitstate waitstate
printstring STRINGID_TRAINER1LOSETEXT printstring STRINGID_TRAINER1LOSETEXT
jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAACB jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAACB
trainerslideout IDENTITY_OPPONENT_MON1 trainerslideout B_POSITION_OPPONENT_LEFT
waitstate waitstate
trainerslidein GBANK_1 trainerslidein GBANK_1
waitstate waitstate

View File

@ -11,18 +11,33 @@
#include "battle_bg.h" #include "battle_bg.h"
/* /*
Banks are a name given to what could be called a 'battlerId' or 'monControllerId'. * Banks are a name given to what could be called a 'battlerId' or 'monControllerId'.
Each bank has a value consisting of two bits. * A battler may be in one of four positions on the field. The first bit determines
0x1 bit is responsible for the side, 0 = player's side, 1 = opponent's side. * what side the battler is on, either the player's side or the opponent's side.
0x2 bit is responsible for the id of sent out pokemon. 0 means it's the first sent out pokemon, 1 it's the second one. (Triple battle didn't exist at the time yet.) * The second bit determines whether the pokemon is on the left or right of the
*/ * given side. Note that the opponent's mons are drawn opposite because the position
* numbers correspond to their perspective. The bank number is usually the same
* as the position, except in the case of link battles.
*
* +---------------------- +
* | Opponent's side:|
* | 3 1 |
* | |
* | |
* |Player's side: |
* | 0 2 |
* ------------------------+
* | |
* | |
* +-----------------------+
*/
#define BATTLE_BANKS_COUNT 4 #define BATTLE_BANKS_COUNT 4
#define IDENTITY_PLAYER_MON1 0 #define B_POSITION_PLAYER_LEFT 0
#define IDENTITY_OPPONENT_MON1 1 #define B_POSITION_OPPONENT_LEFT 1
#define IDENTITY_PLAYER_MON2 2 #define B_POSITION_PLAYER_RIGHT 2
#define IDENTITY_OPPONENT_MON2 3 #define B_POSITION_OPPONENT_RIGHT 3
#define SIDE_PLAYER 0x0 #define SIDE_PLAYER 0x0
#define SIDE_OPPONENT 0x1 #define SIDE_OPPONENT 0x1
@ -30,9 +45,9 @@
#define BIT_SIDE 0x1 #define BIT_SIDE 0x1
#define BIT_MON 0x2 #define BIT_MON 0x2
#define GET_BANK_IDENTITY(bank)((gBanksByIdentity[bank])) #define GET_BANK_POSITION(bank)((gBankPositions[bank]))
#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & BIT_SIDE)) #define GET_BANK_SIDE(bank)((GetBankPosition(bank) & BIT_SIDE))
#define GET_BANK_SIDE2(bank)((GET_BANK_IDENTITY(bank) & BIT_SIDE)) #define GET_BANK_SIDE2(bank)((GET_BANK_POSITION(bank) & BIT_SIDE))
#define BATTLE_TYPE_DOUBLE 0x0001 #define BATTLE_TYPE_DOUBLE 0x0001
#define BATTLE_TYPE_LINK 0x0002 #define BATTLE_TYPE_LINK 0x0002
@ -66,6 +81,8 @@
#define BATTLE_TYPE_KYOGRE 0x20000000 #define BATTLE_TYPE_KYOGRE 0x20000000
#define BATTLE_TYPE_RAYQUAZA 0x40000000 #define BATTLE_TYPE_RAYQUAZA 0x40000000
#define BATTLE_TYPE_x80000000 0x80000000 #define BATTLE_TYPE_x80000000 0x80000000
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
#define TRAINER_OPPONENT_3FE 0x3FE #define TRAINER_OPPONENT_3FE 0x3FE
#define TRAINER_OPPONENT_C00 0xC00 #define TRAINER_OPPONENT_C00 0xC00
@ -73,9 +90,6 @@
#define STEVEN_PARTNER_ID 0xC03 #define STEVEN_PARTNER_ID 0xC03
#define SECRET_BASE_OPPONENT 0x400 #define SECRET_BASE_OPPONENT 0x400
#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
#define BATTLE_WON 0x1 #define BATTLE_WON 0x1
#define BATTLE_LOST 0x2 #define BATTLE_LOST 0x2
#define BATTLE_DREW 0x3 #define BATTLE_DREW 0x3
@ -832,7 +846,7 @@ enum
// rom_80A5C6C // rom_80A5C6C
u8 GetBankSide(u8 bank); u8 GetBankSide(u8 bank);
u8 GetBankIdentity(u8 bank); u8 GetBankPosition(u8 bank);
u8 GetBankByIdentity(u8 bank); u8 GetBankByIdentity(u8 bank);
struct BattleSpriteInfo struct BattleSpriteInfo

View File

@ -85,7 +85,7 @@ enum
BANK_Y_POS, BANK_Y_POS,
}; };
u8 GetBankPosition(u8 bank, u8 attributeId); u8 GetBankCoord(u8 bank, u8 attributeId);
bool8 IsBankSpritePresent(u8 bank); bool8 IsBankSpritePresent(u8 bank);
void sub_80A6C68(u8 arg0); void sub_80A6C68(u8 arg0);

View File

@ -2517,7 +2517,7 @@ static void sub_8039A48(struct Sprite *sprite)
} }
else else
{ {
u8 *dst = (u8 *)gMonSpritesGfxPtr->sprites[GetBankIdentity(sprite->tBank)] + (gBattleMonForms[sprite->tBank] << 11) + (sprite->data[3] << 8); u8 *dst = (u8 *)gMonSpritesGfxPtr->sprites[GetBankPosition(sprite->tBank)] + (gBattleMonForms[sprite->tBank] << 11) + (sprite->data[3] << 8);
for (i = 0; i < 0x100; i++) for (i = 0; i < 0x100; i++)
*(dst++) = 0; *(dst++) = 0;
@ -3116,7 +3116,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
gBattleMons[gActiveBank].status2 = 0; gBattleMons[gActiveBank].status2 = 0;
} }
if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_PLAYER_LEFT)
{ {
EmitDrawTrainerPic(0); EmitDrawTrainerPic(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3124,7 +3124,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
{ {
if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_LEFT)
{ {
EmitDrawTrainerPic(0); EmitDrawTrainerPic(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3159,15 +3159,15 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON2 if (GetBankPosition(gActiveBank) == B_POSITION_PLAYER_RIGHT
|| GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) || GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_RIGHT)
{ {
EmitDrawTrainerPic(0); EmitDrawTrainerPic(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
} }
} }
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_RIGHT)
{ {
EmitDrawTrainerPic(0); EmitDrawTrainerPic(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3203,7 +3203,7 @@ static void BattleIntroDrawPartySummaryScreens(void)
hpStatus[i].status = GetMonData(&gEnemyParty[i], MON_DATA_STATUS); hpStatus[i].status = GetMonData(&gEnemyParty[i], MON_DATA_STATUS);
} }
} }
gActiveBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gActiveBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
EmitDrawPartyStatusSummary(0, hpStatus, 0x80); EmitDrawPartyStatusSummary(0, hpStatus, 0x80);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3221,7 +3221,7 @@ static void BattleIntroDrawPartySummaryScreens(void)
hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS); hpStatus[i].status = GetMonData(&gPlayerParty[i], MON_DATA_STATUS);
} }
} }
gActiveBank = GetBankByIdentity(IDENTITY_PLAYER_MON1); gActiveBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
EmitDrawPartyStatusSummary(0, hpStatus, 0x80); EmitDrawPartyStatusSummary(0, hpStatus, 0x80);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3257,7 +3257,7 @@ static void BattleIntroPrintTrainerWantsToBattle(void)
{ {
if (gBattleExecBuffer == 0) if (gBattleExecBuffer == 0)
{ {
gActiveBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gActiveBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
PrepareStringBattle(STRINGID_INTROMSG, gActiveBank); PrepareStringBattle(STRINGID_INTROMSG, gActiveBank);
gBattleMainFunc = BattleIntroPrintOpponentSendsOut; gBattleMainFunc = BattleIntroPrintOpponentSendsOut;
} }
@ -3280,16 +3280,16 @@ static void BattleIntroPrintOpponentSendsOut(void)
return; return;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) else if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_x80000000) if (gBattleTypeFlags & BATTLE_TYPE_x80000000)
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
else else
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
} }
else else
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByIdentity(identity)); PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByIdentity(identity));
gBattleMainFunc = BattleIntroOpponent1SendsOutMonAnimation; gBattleMainFunc = BattleIntroOpponent1SendsOutMonAnimation;
@ -3300,20 +3300,20 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void)
u32 identity; u32 identity;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
identity = IDENTITY_OPPONENT_MON2; identity = B_POSITION_OPPONENT_RIGHT;
else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) else if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_x80000000) if (gBattleTypeFlags & BATTLE_TYPE_x80000000)
identity = IDENTITY_OPPONENT_MON2; identity = B_POSITION_OPPONENT_RIGHT;
else else
identity = IDENTITY_PLAYER_MON2; identity = B_POSITION_PLAYER_RIGHT;
} }
else else
identity = IDENTITY_OPPONENT_MON2; identity = B_POSITION_OPPONENT_RIGHT;
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++) for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
{ {
if (GetBankIdentity(gActiveBank) == identity) if (GetBankPosition(gActiveBank) == identity)
{ {
EmitIntroTrainerBallThrow(0); EmitIntroTrainerBallThrow(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3329,23 +3329,23 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
u32 identity; u32 identity;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) else if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_x80000000) if (gBattleTypeFlags & BATTLE_TYPE_x80000000)
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
else else
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
} }
else else
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
if (gBattleExecBuffer) if (gBattleExecBuffer)
return; return;
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++) for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
{ {
if (GetBankIdentity(gActiveBank) == identity) if (GetBankPosition(gActiveBank) == identity)
{ {
EmitIntroTrainerBallThrow(0); EmitIntroTrainerBallThrow(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3408,7 +3408,7 @@ _0803B29A:\n\
adds r6, r4, 0\n\ adds r6, r4, 0\n\
_0803B2B2:\n\ _0803B2B2:\n\
ldrb r0, [r4]\n\ ldrb r0, [r4]\n\
bl GetBankIdentity\n\ bl GetBankPosition\n\
lsls r0, 24\n\ lsls r0, 24\n\
lsrs r0, 24\n\ lsrs r0, 24\n\
cmp r0, r5\n\ cmp r0, r5\n\
@ -3482,16 +3482,16 @@ static void BattleIntroPrintPlayerSendsOut(void)
u8 identity; u8 identity;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) else if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_x80000000) if (gBattleTypeFlags & BATTLE_TYPE_x80000000)
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
else else
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
} }
else else
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI)) if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByIdentity(identity)); PrepareStringBattle(STRINGID_INTROSENDOUT, GetBankByIdentity(identity));
@ -3505,20 +3505,20 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void)
u32 identity; u32 identity;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
identity = IDENTITY_PLAYER_MON2; identity = B_POSITION_PLAYER_RIGHT;
else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) else if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_x80000000) if (gBattleTypeFlags & BATTLE_TYPE_x80000000)
identity = IDENTITY_PLAYER_MON2; identity = B_POSITION_PLAYER_RIGHT;
else else
identity = IDENTITY_OPPONENT_MON2; identity = B_POSITION_OPPONENT_RIGHT;
} }
else else
identity = IDENTITY_PLAYER_MON2; identity = B_POSITION_PLAYER_RIGHT;
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++) for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
{ {
if (GetBankIdentity(gActiveBank) == identity) if (GetBankPosition(gActiveBank) == identity)
{ {
EmitIntroTrainerBallThrow(0); EmitIntroTrainerBallThrow(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3537,23 +3537,23 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void)
u32 identity; u32 identity;
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED)) if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
else if (gBattleTypeFlags & BATTLE_TYPE_x2000000) else if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_x80000000) if (gBattleTypeFlags & BATTLE_TYPE_x80000000)
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
else else
identity = IDENTITY_OPPONENT_MON1; identity = B_POSITION_OPPONENT_LEFT;
} }
else else
identity = IDENTITY_PLAYER_MON1; identity = B_POSITION_PLAYER_LEFT;
if (gBattleExecBuffer) if (gBattleExecBuffer)
return; return;
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++) for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
{ {
if (GetBankIdentity(gActiveBank) == identity) if (GetBankPosition(gActiveBank) == identity)
{ {
EmitIntroTrainerBallThrow(0); EmitIntroTrainerBallThrow(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -3891,7 +3891,7 @@ static void HandleTurnActionSelectionState(void)
gBattleCommunication[ACTIONS_CONFIRMED_COUNT] = 0; gBattleCommunication[ACTIONS_CONFIRMED_COUNT] = 0;
for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++) for (gActiveBank = 0; gActiveBank < gNoOfAllBanks; gActiveBank++)
{ {
u8 identity = GetBankIdentity(gActiveBank); u8 identity = GetBankPosition(gActiveBank);
switch (gBattleCommunication[gActiveBank]) switch (gBattleCommunication[gActiveBank])
{ {
case STATE_TURN_START_RECORD: // recorded battle related on start of every turn case STATE_TURN_START_RECORD: // recorded battle related on start of every turn
@ -4041,38 +4041,38 @@ static void HandleTurnActionSelectionState(void)
break; break;
case ACTION_CANCEL_PARTNER: case ACTION_CANCEL_PARTNER:
gBattleCommunication[gActiveBank] = 7; gBattleCommunication[gActiveBank] = 7;
gBattleCommunication[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)] = 1; gBattleCommunication[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] = 1;
RecordedBattle_ClearBankAction(gActiveBank, 1); RecordedBattle_ClearBankAction(gActiveBank, 1);
if (gBattleMons[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].status2 & STATUS2_MULTIPLETURNS if (gBattleMons[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].status2 & STATUS2_MULTIPLETURNS
|| gBattleMons[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].status2 & STATUS2_RECHARGE) || gBattleMons[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].status2 & STATUS2_RECHARGE)
{ {
EmitCmd50(0); EmitCmd50(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
return; return;
} }
else if (gActionForBanks[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)] == ACTION_SWITCH) else if (gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_SWITCH)
{ {
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 2); RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 2);
} }
else if (gActionForBanks[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)] == ACTION_RUN) else if (gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_RUN)
{ {
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 1); RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
} }
else if (gActionForBanks[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE else if (gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE
&& (gProtectStructs[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].onlyStruggle && (gProtectStructs[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].onlyStruggle
|| gDisableStructs[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)].encoredMove)) || gDisableStructs[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)].encoredMove))
{ {
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 1); RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
} }
else if (gBattleTypeFlags & BATTLE_TYPE_PALACE else if (gBattleTypeFlags & BATTLE_TYPE_PALACE
&& gActionForBanks[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE) && gActionForBanks[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)] == ACTION_USE_MOVE)
{ {
gRngValue = gBattlePalaceMoveSelectionRngValue; gRngValue = gBattlePalaceMoveSelectionRngValue;
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 1); RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 1);
} }
else else
{ {
RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON), 3); RecordedBattle_ClearBankAction(GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON), 3);
} }
EmitCmd50(0); EmitCmd50(0);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -4727,7 +4727,7 @@ static void HandleEndTurn_BattleWon(void)
{ {
gSpecialVar_Result = gBattleOutcome; gSpecialVar_Result = gBattleOutcome;
gBattleTextBuff1[0] = gBattleOutcome; gBattleTextBuff1[0] = gBattleOutcome;
gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankAttacker = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost;
gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN); gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
} }
@ -4800,7 +4800,7 @@ static void HandleEndTurn_BattleLost(void)
else else
{ {
gBattleTextBuff1[0] = gBattleOutcome; gBattleTextBuff1[0] = gBattleOutcome;
gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankAttacker = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost;
gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN); gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
} }
@ -5127,16 +5127,16 @@ static void HandleAction_UseMove(void)
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{ {
if (Random() & 1) if (Random() & 1)
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
else else
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON2); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
} }
else else
{ {
if (Random() & 1) if (Random() & 1)
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
else else
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
} }
} }
else else
@ -5148,13 +5148,13 @@ static void HandleAction_UseMove(void)
{ {
if (GetBankSide(gBankAttacker) != GetBankSide(gBankTarget)) if (GetBankSide(gBankAttacker) != GetBankSide(gBankTarget))
{ {
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankTarget) ^ BIT_MON); gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
} }
else else
{ {
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_SIDE); gBankTarget = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_SIDE);
if (gAbsentBankFlags & gBitTable[gBankTarget]) if (gAbsentBankFlags & gBitTable[gBankTarget])
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankTarget) ^ BIT_MON); gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
} }
} }
} }
@ -5172,22 +5172,22 @@ static void HandleAction_UseMove(void)
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{ {
if (Random() & 1) if (Random() & 1)
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
else else
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON2); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
} }
else else
{ {
if (Random() & 1) if (Random() & 1)
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
else else
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
} }
if (gAbsentBankFlags & gBitTable[gBankTarget] if (gAbsentBankFlags & gBitTable[gBankTarget]
&& GetBankSide(gBankAttacker) != GetBankSide(gBankTarget)) && GetBankSide(gBankAttacker) != GetBankSide(gBankTarget))
{ {
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankTarget) ^ BIT_MON); gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
} }
} }
else else
@ -5197,13 +5197,13 @@ static void HandleAction_UseMove(void)
{ {
if (GetBankSide(gBankAttacker) != GetBankSide(gBankTarget)) if (GetBankSide(gBankAttacker) != GetBankSide(gBankTarget))
{ {
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankTarget) ^ BIT_MON); gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
} }
else else
{ {
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_SIDE); gBankTarget = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_SIDE);
if (gAbsentBankFlags & gBitTable[gBankTarget]) if (gAbsentBankFlags & gBitTable[gBankTarget])
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankTarget) ^ BIT_MON); gBankTarget = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
} }
} }
} }

View File

@ -1316,7 +1316,7 @@ static void BattleAICmd_count_usable_party_mons(void)
{ {
u32 identity; u32 identity;
bankOnField1 = gBattlePartyID[bank]; bankOnField1 = gBattlePartyID[bank];
identity = GetBankIdentity(bank) ^ BIT_MON; identity = GetBankPosition(bank) ^ BIT_MON;
bankOnField2 = gBattlePartyID[GetBankByIdentity(identity)]; bankOnField2 = gBattlePartyID[GetBankByIdentity(identity)];
} }
else // in singles there's only one bank by side else // in singles there's only one bank by side

View File

@ -60,7 +60,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
return FALSE; return FALSE;
opposingIdentity = GetBankIdentity(gActiveBank) ^ BIT_SIDE; opposingIdentity = GetBankPosition(gActiveBank) ^ BIT_SIDE;
if (gBattleMons[GetBankByIdentity(opposingIdentity)].ability != ABILITY_WONDER_GUARD) if (gBattleMons[GetBankByIdentity(opposingIdentity)].ability != ABILITY_WONDER_GUARD)
return FALSE; return FALSE;
@ -151,10 +151,10 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
bankIn1 = gActiveBank; bankIn1 = gActiveBank;
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)]) if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)])
bankIn2 = gActiveBank; bankIn2 = gActiveBank;
else else
bankIn2 = GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON); bankIn2 = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON);
} }
else else
{ {
@ -273,7 +273,7 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
u8 moveFlags; u8 moveFlags;
u16 move; u16 move;
opposingIdentity = GetBankIdentity(gActiveBank) ^ BIT_SIDE; opposingIdentity = GetBankPosition(gActiveBank) ^ BIT_SIDE;
opposingBank = GetBankByIdentity(opposingIdentity); opposingBank = GetBankByIdentity(opposingIdentity);
if (!(gAbsentBankFlags & gBitTable[opposingBank])) if (!(gAbsentBankFlags & gBitTable[opposingBank]))
@ -357,10 +357,10 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
bankIn1 = gActiveBank; bankIn1 = gActiveBank;
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)]) if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)])
bankIn2 = gActiveBank; bankIn2 = gActiveBank;
else else
bankIn2 = GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON); bankIn2 = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON);
} }
else else
{ {
@ -468,10 +468,10 @@ static bool8 ShouldSwitch(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
bankIn1 = *activeBankPtr; bankIn1 = *activeBankPtr;
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankIdentity(*activeBankPtr) ^ BIT_MON)]) if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(*activeBankPtr) ^ BIT_MON)])
bankIn2 = *activeBankPtr; bankIn2 = *activeBankPtr;
else else
bankIn2 = GetBankByIdentity(GetBankIdentity(*activeBankPtr) ^ BIT_MON); bankIn2 = GetBankByIdentity(GetBankPosition(*activeBankPtr) ^ BIT_MON);
} }
else else
{ {
@ -543,7 +543,7 @@ void AI_TrySwitchOrUseItem(void)
u8 bankIn1, bankIn2; u8 bankIn1, bankIn2;
s32 firstId; s32 firstId;
s32 lastId; // + 1 s32 lastId; // + 1
u8 bankIdentity = GetBankIdentity(gActiveBank); u8 bankIdentity = GetBankPosition(gActiveBank);
if (GetBankSide(gActiveBank) == SIDE_PLAYER) if (GetBankSide(gActiveBank) == SIDE_PLAYER)
party = gPlayerParty; party = gPlayerParty;
@ -659,10 +659,10 @@ u8 GetMostSuitableMonToSwitchInto(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
bankIn1 = gActiveBank; bankIn1 = gActiveBank;
if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON)]) if (gAbsentBankFlags & gBitTable[GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON)])
bankIn2 = gActiveBank; bankIn2 = gActiveBank;
else else
bankIn2 = GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_MON); bankIn2 = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_MON);
// UB: It considers the opponent only player's side even though it can battle alongside player; // UB: It considers the opponent only player's side even though it can battle alongside player;
opposingBank = Random() & BIT_MON; opposingBank = Random() & BIT_MON;
@ -671,7 +671,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
} }
else else
{ {
opposingBank = GetBankByIdentity(GetBankIdentity(gActiveBank) ^ BIT_SIDE); opposingBank = GetBankByIdentity(GetBankPosition(gActiveBank) ^ BIT_SIDE);
bankIn1 = gActiveBank; bankIn1 = gActiveBank;
bankIn2 = gActiveBank; bankIn2 = gActiveBank;
} }
@ -817,7 +817,7 @@ static bool8 ShouldUseItem(void)
u8 validMons = 0; u8 validMons = 0;
bool8 shouldUse = FALSE; bool8 shouldUse = FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON2) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBankPosition(gActiveBank) == B_POSITION_PLAYER_RIGHT)
return FALSE; return FALSE;
if (GetBankSide(gActiveBank) == SIDE_PLAYER) if (GetBankSide(gActiveBank) == SIDE_PLAYER)

View File

@ -424,7 +424,7 @@ static void ScriptCmd_createsprite(void)
if (subpriority < 3) if (subpriority < 3)
subpriority = 3; subpriority = 3;
CreateSpriteAndAnimate(template, GetBankPosition(gAnimBankTarget, 2), GetBankPosition(gAnimBankTarget, 3), subpriority); CreateSpriteAndAnimate(template, GetBankCoord(gAnimBankTarget, 2), GetBankCoord(gAnimBankTarget, 3), subpriority);
gAnimVisualTaskCount++; gAnimVisualTaskCount++;
} }
@ -613,8 +613,8 @@ static void ScriptCmd_monbg(void)
if (IsAnimBankSpriteVisible(bank)) if (IsAnimBankSpriteVisible(bank))
{ {
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
if (identity == IDENTITY_OPPONENT_MON1 || identity == IDENTITY_PLAYER_MON2 || IsContest()) if (identity == B_POSITION_OPPONENT_LEFT || identity == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE; toBG_2 = FALSE;
else else
toBG_2 = TRUE; toBG_2 = TRUE;
@ -632,8 +632,8 @@ static void ScriptCmd_monbg(void)
bank ^= BIT_MON; bank ^= BIT_MON;
if (IsAnimBankSpriteVisible(bank)) if (IsAnimBankSpriteVisible(bank))
{ {
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
if (identity == IDENTITY_OPPONENT_MON1 || identity == IDENTITY_PLAYER_MON2 || IsContest()) if (identity == B_POSITION_OPPONENT_LEFT || identity == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE; toBG_2 = FALSE;
else else
toBG_2 = TRUE; toBG_2 = TRUE;
@ -718,7 +718,7 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
if (IsContest()) if (IsContest())
bankIdentity = 0; bankIdentity = 0;
else else
bankIdentity = GetBankIdentity(bank); bankIdentity = GetBankPosition(bank);
sub_8118FBC(1, 0, 0, bankIdentity, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA); sub_8118FBC(1, 0, 0, bankIdentity, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA);
@ -750,7 +750,7 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
LoadPalette(&gPlttBufferUnfaded[0x100 + bank * 16], 0x90, 0x20); LoadPalette(&gPlttBufferUnfaded[0x100 + bank * 16], 0x90, 0x20);
CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + 0x120), 0x20); CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + 0x120), 0x20);
sub_8118FBC(2, 0, 0, GetBankIdentity(bank), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA); sub_8118FBC(2, 0, 0, GetBankPosition(bank), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
} }
} }
@ -893,8 +893,8 @@ static void sub_80A4980(u8 taskId)
if (gTasks[taskId].data[1] != 1) if (gTasks[taskId].data[1] != 1)
{ {
u8 to_BG2; u8 to_BG2;
u8 identity = GetBankIdentity(gTasks[taskId].data[2]); u8 identity = GetBankPosition(gTasks[taskId].data[2]);
if (identity == IDENTITY_OPPONENT_MON1 || identity == IDENTITY_PLAYER_MON2 || IsContest()) if (identity == B_POSITION_OPPONENT_LEFT || identity == B_POSITION_PLAYER_RIGHT || IsContest())
to_BG2 = FALSE; to_BG2 = FALSE;
else else
to_BG2 = TRUE; to_BG2 = TRUE;
@ -937,8 +937,8 @@ static void ScriptCmd_monbg_22(void)
if (IsAnimBankSpriteVisible(bank)) if (IsAnimBankSpriteVisible(bank))
{ {
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
if (identity == IDENTITY_OPPONENT_MON1 || identity == IDENTITY_PLAYER_MON2 || IsContest()) if (identity == B_POSITION_OPPONENT_LEFT || identity == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE; toBG_2 = FALSE;
else else
toBG_2 = TRUE; toBG_2 = TRUE;
@ -949,8 +949,8 @@ static void ScriptCmd_monbg_22(void)
bank ^= BIT_MON; bank ^= BIT_MON;
if (animBankId > 1 && IsAnimBankSpriteVisible(bank)) if (animBankId > 1 && IsAnimBankSpriteVisible(bank))
{ {
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
if (identity == IDENTITY_OPPONENT_MON1 || identity == IDENTITY_PLAYER_MON2 || IsContest()) if (identity == B_POSITION_OPPONENT_LEFT || identity == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE; toBG_2 = FALSE;
else else
toBG_2 = TRUE; toBG_2 = TRUE;
@ -1001,8 +1001,8 @@ static void sub_80A4BB0(u8 taskId)
{ {
bool8 toBG_2; bool8 toBG_2;
u8 bank = gTasks[taskId].data[2]; u8 bank = gTasks[taskId].data[2];
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
if (identity == IDENTITY_OPPONENT_MON1 || identity == IDENTITY_PLAYER_MON2 || IsContest()) if (identity == B_POSITION_OPPONENT_LEFT || identity == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE; toBG_2 = FALSE;
else else
toBG_2 = TRUE; toBG_2 = TRUE;
@ -1705,8 +1705,8 @@ static void ScriptCmd_monbgprio_28(void)
else else
bank = gAnimBankAttacker; bank = gAnimBankAttacker;
bankIdentity = GetBankIdentity(bank); bankIdentity = GetBankPosition(bank);
if (!IsContest() && (bankIdentity == IDENTITY_PLAYER_MON1 || bankIdentity == IDENTITY_OPPONENT_MON2)) if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
{ {
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2); SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
@ -1738,8 +1738,8 @@ static void ScriptCmd_monbgprio_2A(void)
else else
bank = gAnimBankAttacker; bank = gAnimBankAttacker;
bankIdentity = GetBankIdentity(bank); bankIdentity = GetBankPosition(bank);
if (!IsContest() && (bankIdentity == IDENTITY_PLAYER_MON1 || bankIdentity == IDENTITY_OPPONENT_MON2)) if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
{ {
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2); SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);

View File

@ -295,7 +295,7 @@ static void sub_8064520(void)
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0;
if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) if (GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_RIGHT)
{ {
FreeSpriteTilesByTag(0x27F9); FreeSpriteTilesByTag(0x27F9);
FreeSpritePaletteByTag(0x27F9); FreeSpritePaletteByTag(0x27F9);
@ -352,7 +352,7 @@ static void sub_8064734(void)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
{ {
if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_LEFT)
m4aMPlayContinue(&gMPlayInfo_BGM); m4aMPlayContinue(&gMPlayInfo_BGM);
} }
else else
@ -370,7 +370,7 @@ static void sub_8064734(void)
if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy if (gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy) && gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON2) if (gBattleTypeFlags & BATTLE_TYPE_MULTI && GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_RIGHT)
{ {
if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 1) if (++gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_9 == 1)
return; return;
@ -1161,10 +1161,10 @@ static void LinkOpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank);
sub_806A068(species, GetBankIdentity(gActiveBank)); sub_806A068(species, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(gActiveBank, 2), GetBankCoord(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank), GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank)); sub_80A82E4(gActiveBank));
@ -1194,11 +1194,11 @@ static void sub_8066494(u8 bank, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite( gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C, &gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -1262,7 +1262,7 @@ static void LinkOpponentHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon if ((GetBankPosition(gActiveBank) & BIT_MON) != 0) // second mon
xPos = 152; xPos = 152;
else // first mon else // first mon
xPos = 200; xPos = 200;
@ -1328,7 +1328,7 @@ static void LinkOpponentHandleDrawTrainerPic(void)
} }
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
xPos, xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
@ -1353,7 +1353,7 @@ static void LinkOpponentHandleTrainerSlide(void)
trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B); trainerPicId = GetFrontierTrainerFrontSpriteId(gTrainerBattleOpponent_B);
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96; gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96;

View File

@ -1047,10 +1047,10 @@ static void LinkPartnerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
sub_806A068(species, GetBankIdentity(gActiveBank)); sub_806A068(species, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(gActiveBank, 2), GetBankCoord(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank), GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank)); sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1077,11 +1077,11 @@ static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
gBattlePartyID[bank] = gBattleBufferA[bank][1]; gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite( gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C, &gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -1144,7 +1144,7 @@ static void LinkPartnerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon if ((GetBankPosition(gActiveBank) & BIT_MON) != 0) // second mon
xPos = 90; xPos = 90;
else // first mon else // first mon
xPos = 32; xPos = 32;
@ -1170,7 +1170,7 @@ static void LinkPartnerHandleDrawTrainerPic(void)
} }
DecompressTrainerBackPic(trainerPicId, gActiveBank); DecompressTrainerBackPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;

View File

@ -293,7 +293,7 @@ static void sub_805F2F0(void)
} }
else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) else if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1)
{ {
if (GetBankIdentity(gActiveBank) == 3) if (GetBankPosition(gActiveBank) == 3)
{ {
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 == 0 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 == 0) if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 == 0 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 == 0)
{ {
@ -349,7 +349,7 @@ static void sub_805F560(void)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
{ {
if (GetBankIdentity(gActiveBank) == 1) if (GetBankPosition(gActiveBank) == 1)
m4aMPlayContinue(&gMPlayInfo_BGM); m4aMPlayContinue(&gMPlayInfo_BGM);
} }
else else
@ -1149,10 +1149,10 @@ static void OpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank);
sub_806A068(species, GetBankIdentity(gActiveBank)); sub_806A068(species, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(gActiveBank, 2), GetBankCoord(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank), GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank)); sub_80A82E4(gActiveBank));
@ -1184,10 +1184,10 @@ static void sub_80613DC(u8 bank, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -1304,7 +1304,7 @@ static void OpponentHandleDrawTrainerPic(void)
if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS)) if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS))
{ {
if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon if ((GetBankPosition(gActiveBank) & BIT_MON) != 0) // second mon
xPos = 152; xPos = 152;
else // first mon else // first mon
xPos = 200; xPos = 200;
@ -1315,7 +1315,7 @@ static void OpponentHandleDrawTrainerPic(void)
} }
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
xPos, xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
@ -1387,7 +1387,7 @@ static void OpponentHandleTrainerSlide(void)
} }
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96; gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 96;
@ -1588,9 +1588,9 @@ static void OpponentHandleChooseMove(void)
gBankTarget = gActiveBank; gBankTarget = gActiveBank;
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
{ {
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
if (gAbsentBankFlags & gBitTable[gBankTarget]) if (gAbsentBankFlags & gBitTable[gBankTarget])
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
} }
EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBankTarget << 8)); EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBankTarget << 8));
break; break;
@ -1611,7 +1611,7 @@ static void OpponentHandleChooseMove(void)
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(Random() & 2) << 8)); EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(Random() & 2) << 8));
else else
EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(IDENTITY_PLAYER_MON1) << 8)); EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBankByIdentity(B_POSITION_PLAYER_LEFT) << 8));
OpponentBufferExecCompleted(); OpponentBufferExecCompleted();
} }
@ -1638,12 +1638,12 @@ static void OpponentHandleChoosePokemon(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{ {
bank2 = bank1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); bank2 = bank1 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
} }
else else
{ {
bank1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); bank1 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
bank2 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); bank2 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
} }
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000)) if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))

View File

@ -232,7 +232,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
nullsub_22 nullsub_22
}; };
static const u8 sTargetIdentities[] = {IDENTITY_PLAYER_MON1, IDENTITY_PLAYER_MON2, IDENTITY_OPPONENT_MON2, IDENTITY_OPPONENT_MON1}; static const u8 sTargetIdentities[] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT, B_POSITION_OPPONENT_RIGHT, B_POSITION_OPPONENT_LEFT};
// unknown unused data // unknown unused data
static const u8 sUnknown_0831C5FC[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58}; static const u8 sUnknown_0831C5FC[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58};
@ -357,8 +357,8 @@ static void HandleInputChooseAction(void)
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59) else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
{ {
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON2 && GetBankPosition(gActiveBank) == B_POSITION_PLAYER_RIGHT
&& !(gAbsentBankFlags & gBitTable[GetBankByIdentity(IDENTITY_PLAYER_MON1)]) && !(gAbsentBankFlags & gBitTable[GetBankByIdentity(B_POSITION_PLAYER_LEFT)])
&& !(gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{ {
if (gBattleBufferA[gActiveBank][1] == ACTION_USE_ITEM) if (gBattleBufferA[gActiveBank][1] == ACTION_USE_ITEM)
@ -436,7 +436,7 @@ static void HandleInputChooseTarget(void)
do do
{ {
u8 currSelIdentity = GetBankIdentity(gMultiUsePlayerCursor); u8 currSelIdentity = GetBankPosition(gMultiUsePlayerCursor);
for (i = 0; i < BATTLE_BANKS_COUNT; i++) for (i = 0; i < BATTLE_BANKS_COUNT; i++)
{ {
@ -451,17 +451,17 @@ static void HandleInputChooseTarget(void)
} while (gMultiUsePlayerCursor == gNoOfAllBanks); } while (gMultiUsePlayerCursor == gNoOfAllBanks);
i = 0; i = 0;
switch (GetBankIdentity(gMultiUsePlayerCursor)) switch (GetBankPosition(gMultiUsePlayerCursor))
{ {
case IDENTITY_PLAYER_MON1: case B_POSITION_PLAYER_LEFT:
case IDENTITY_PLAYER_MON2: case B_POSITION_PLAYER_RIGHT:
if (gActiveBank != gMultiUsePlayerCursor) if (gActiveBank != gMultiUsePlayerCursor)
i++; i++;
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER) else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER)
i++; i++;
break; break;
case IDENTITY_OPPONENT_MON1: case B_POSITION_OPPONENT_LEFT:
case IDENTITY_OPPONENT_MON2: case B_POSITION_OPPONENT_RIGHT:
i++; i++;
break; break;
} }
@ -478,7 +478,7 @@ static void HandleInputChooseTarget(void)
do do
{ {
u8 currSelIdentity = GetBankIdentity(gMultiUsePlayerCursor); u8 currSelIdentity = GetBankPosition(gMultiUsePlayerCursor);
for (i = 0; i < BATTLE_BANKS_COUNT; i++) for (i = 0; i < BATTLE_BANKS_COUNT; i++)
{ {
@ -493,17 +493,17 @@ static void HandleInputChooseTarget(void)
} while (gMultiUsePlayerCursor == gNoOfAllBanks); } while (gMultiUsePlayerCursor == gNoOfAllBanks);
i = 0; i = 0;
switch (GetBankIdentity(gMultiUsePlayerCursor)) switch (GetBankPosition(gMultiUsePlayerCursor))
{ {
case IDENTITY_PLAYER_MON1: case B_POSITION_PLAYER_LEFT:
case IDENTITY_PLAYER_MON2: case B_POSITION_PLAYER_RIGHT:
if (gActiveBank != gMultiUsePlayerCursor) if (gActiveBank != gMultiUsePlayerCursor)
i++; i++;
else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER) else if (gBattleMoves[GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MOVE1 + gMoveSelectionCursor[gActiveBank])].target & MOVE_TARGET_USER)
i++; i++;
break; break;
case IDENTITY_OPPONENT_MON1: case B_POSITION_OPPONENT_LEFT:
case IDENTITY_OPPONENT_MON2: case B_POSITION_OPPONENT_RIGHT:
i++; i++;
break; break;
} }
@ -545,7 +545,7 @@ static void HandleInputChooseMove(void)
if (moveTarget & MOVE_TARGET_x10) if (moveTarget & MOVE_TARGET_x10)
gMultiUsePlayerCursor = gActiveBank; gMultiUsePlayerCursor = gActiveBank;
else else
gMultiUsePlayerCursor = GetBankByIdentity((GetBankIdentity(gActiveBank) & BIT_SIDE) ^ BIT_SIDE); gMultiUsePlayerCursor = GetBankByIdentity((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE);
if (!gBattleBufferA[gActiveBank][1]) // not a double battle if (!gBattleBufferA[gActiveBank][1]) // not a double battle
{ {
@ -579,10 +579,10 @@ static void HandleInputChooseMove(void)
if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER)) if (moveTarget & (MOVE_TARGET_x10 | MOVE_TARGET_USER))
gMultiUsePlayerCursor = gActiveBank; gMultiUsePlayerCursor = gActiveBank;
else if (gAbsentBankFlags & gBitTable[GetBankByIdentity(IDENTITY_OPPONENT_MON1)]) else if (gAbsentBankFlags & gBitTable[GetBankByIdentity(B_POSITION_OPPONENT_LEFT)])
gMultiUsePlayerCursor = GetBankByIdentity(IDENTITY_OPPONENT_MON2); gMultiUsePlayerCursor = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
else else
gMultiUsePlayerCursor = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gMultiUsePlayerCursor = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8; gSprites[gBankSpriteIds[gMultiUsePlayerCursor]].callback = sub_8039AD8;
} }
@ -2234,11 +2234,11 @@ static void sub_805B258(u8 bank, bool8 dontClearSubstituteBit)
gBattlePartyID[bank] = gBattleBufferA[bank][1]; gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite( gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C, &gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -2326,7 +2326,7 @@ static void PlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon if ((GetBankPosition(gActiveBank) & BIT_MON) != 0) // second mon
xPos = 90; xPos = 90;
else // first mon else // first mon
xPos = 32; xPos = 32;
@ -2353,7 +2353,7 @@ static void PlayerHandleDrawTrainerPic(void)
{ {
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A1C0(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
@ -2368,7 +2368,7 @@ static void PlayerHandleDrawTrainerPic(void)
else else
{ {
DecompressTrainerBackPic(trainerPicId, gActiveBank); DecompressTrainerBackPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
@ -2407,7 +2407,7 @@ static void PlayerHandleTrainerSlide(void)
} }
DecompressTrainerBackPic(trainerPicId, gActiveBank); DecompressTrainerBackPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
@ -2463,7 +2463,7 @@ static void PlayerHandleSuccessBallThrowAnim(void)
{ {
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE; gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
} }
@ -2473,7 +2473,7 @@ static void PlayerHandleBallThrowAnim(void)
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE; gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_BALL_THROW); InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
} }

View File

@ -1234,10 +1234,10 @@ static void PlayerPartnerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
sub_806A068(species, GetBankIdentity(gActiveBank)); sub_806A068(species, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(gActiveBank, 2), GetBankCoord(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank), GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank)); sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1264,11 +1264,11 @@ static void sub_81BD0E4(u8 bank, bool8 dontClearSubstituteBit)
gBattlePartyID[bank] = gBattleBufferA[bank][1]; gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite( gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C, &gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -1349,7 +1349,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
if (gPartnerTrainerId == STEVEN_PARTNER_ID) if (gPartnerTrainerId == STEVEN_PARTNER_ID)
{ {
DecompressTrainerBackPic(trainerPicId, gActiveBank); DecompressTrainerBackPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
@ -1360,7 +1360,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
else // otherwise use front sprite else // otherwise use front sprite
{ {
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A1C0(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
@ -1548,9 +1548,9 @@ static void PlayerPartnerHandleChooseMove(void)
gBankTarget = gActiveBank; gBankTarget = gActiveBank;
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH) if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
{ {
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
if (gAbsentBankFlags & gBitTable[gBankTarget]) if (gAbsentBankFlags & gBitTable[gBankTarget])
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON2); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
} }
EmitTwoReturnValues(1, 10, chosenMoveId | (gBankTarget << 8)); EmitTwoReturnValues(1, 10, chosenMoveId | (gBankTarget << 8));
@ -1568,8 +1568,8 @@ static void PlayerPartnerHandleChoosePokemon(void)
if (chosenMonId == 6) // just switch to the next mon if (chosenMonId == 6) // just switch to the next mon
{ {
u8 playerMonIdentity = GetBankByIdentity(IDENTITY_PLAYER_MON1); u8 playerMonIdentity = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
u8 selfIdentity = GetBankByIdentity(IDENTITY_PLAYER_MON2); u8 selfIdentity = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
for (chosenMonId = 3; chosenMonId < 6; chosenMonId++) for (chosenMonId = 3; chosenMonId < 6; chosenMonId++)
{ {

View File

@ -274,7 +274,7 @@ static void sub_8186678(void)
if (var) if (var)
{ {
if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_LEFT)
{ {
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1) if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1)
return; return;
@ -330,7 +330,7 @@ static void sub_818686C(void)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
{ {
if (GetBankIdentity(gActiveBank) == IDENTITY_OPPONENT_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_OPPONENT_LEFT)
m4aMPlayContinue(&gMPlayInfo_BGM); m4aMPlayContinue(&gMPlayInfo_BGM);
} }
else else
@ -1146,10 +1146,10 @@ static void RecordedOpponentHandleLoadMonSprite(void)
u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); u16 species = GetMonData(&gEnemyParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[gActiveBank]], gActiveBank);
sub_806A068(species, GetBankIdentity(gActiveBank)); sub_806A068(species, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(gActiveBank, 2), GetBankCoord(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank), GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank)); sub_80A82E4(gActiveBank));
@ -1181,10 +1181,10 @@ static void sub_81885D8(u8 bank, bool8 dontClearSubstituteBit)
species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank); BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -1248,7 +1248,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon if ((GetBankPosition(gActiveBank) & BIT_MON) != 0) // second mon
xPos = 152; xPos = 152;
else // first mon else // first mon
xPos = 200; xPos = 200;
@ -1279,7 +1279,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
} }
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
xPos, xPos,
(8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,

View File

@ -245,7 +245,7 @@ static void sub_8189AA0(void)
{ {
bool32 r6 = FALSE; bool32 r6 = FALSE;
if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_PLAYER_LEFT)
{ {
if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI))) if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI)))
{ {
@ -312,7 +312,7 @@ static void sub_8189D40(void)
{ {
bool32 r10 = FALSE; bool32 r10 = FALSE;
if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_PLAYER_LEFT)
{ {
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive) && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
@ -353,7 +353,7 @@ static void sub_8189D40(void)
{ {
if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI)) if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && (gBattleTypeFlags & BATTLE_TYPE_MULTI))
{ {
if (GetBankIdentity(gActiveBank) == IDENTITY_PLAYER_MON1) if (GetBankPosition(gActiveBank) == B_POSITION_PLAYER_LEFT)
m4aMPlayContinue(&gMPlayInfo_BGM); m4aMPlayContinue(&gMPlayInfo_BGM);
} }
else else
@ -1132,10 +1132,10 @@ static void RecordedPlayerHandleLoadMonSprite(void)
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank); BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
sub_806A068(species, GetBankIdentity(gActiveBank)); sub_806A068(species, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(gActiveBank, 2), GetBankCoord(gActiveBank, 2),
GetBankSpriteDefault_Y(gActiveBank), GetBankSpriteDefault_Y(gActiveBank),
sub_80A82E4(gActiveBank)); sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240; gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -240;
@ -1162,11 +1162,11 @@ static void sub_818BA6C(u8 bank, bool8 dontClearSubstituteBit)
gBattlePartyID[bank] = gBattleBufferA[bank][1]; gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite( gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C, &gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));
@ -1241,7 +1241,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{ {
if ((GetBankIdentity(gActiveBank) & BIT_MON) != 0) // second mon if ((GetBankPosition(gActiveBank) & BIT_MON) != 0) // second mon
xPos = 90; xPos = 90;
else // first mon else // first mon
xPos = 32; xPos = 32;
@ -1267,7 +1267,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
{ {
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender); trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
DecompressTrainerFrontPic(trainerPicId, gActiveBank); DecompressTrainerFrontPic(trainerPicId, gActiveBank);
sub_806A1C0(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A1C0(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
@ -1281,7 +1281,7 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
else else
{ {
DecompressTrainerBackPic(trainerPicId, gActiveBank); DecompressTrainerBackPic(trainerPicId, gActiveBank);
sub_806A12C(trainerPicId, GetBankIdentity(gActiveBank)); sub_806A12C(trainerPicId, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank)); gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, xPos, yPos, sub_80A82E4(gActiveBank));
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank; gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;

View File

@ -378,7 +378,7 @@ static void SafariHandleReturnMonToBall(void)
static void SafariHandleDrawTrainerPic(void) static void SafariHandleDrawTrainerPic(void)
{ {
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank); DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank);
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankIdentity(gActiveBank)); sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite( gBankSpriteIds[gActiveBank] = CreateSprite(
&gUnknown_0202499C, &gUnknown_0202499C,
80, 80,
@ -415,7 +415,7 @@ static void SafariHandleSuccessBallThrowAnim(void)
{ {
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE; gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
} }
@ -425,7 +425,7 @@ static void SafariHandleBallThrowAnim(void)
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE; gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone; gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
} }

View File

@ -1067,7 +1067,7 @@ static void WallyHandleReturnMonToBall(void)
static void WallyHandleDrawTrainerPic(void) static void WallyHandleDrawTrainerPic(void)
{ {
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank);
sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); sub_806A12C(BACK_PIC_WALLY, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
80, 80,
80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords),
@ -1082,7 +1082,7 @@ static void WallyHandleDrawTrainerPic(void)
static void WallyHandleTrainerSlide(void) static void WallyHandleTrainerSlide(void)
{ {
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank); DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank);
sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(gActiveBank)); sub_806A12C(BACK_PIC_WALLY, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
80, 80,
80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords), 80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords),
@ -1113,7 +1113,7 @@ static void WallyHandleSuccessBallThrowAnim(void)
{ {
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS; gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE; gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
} }
@ -1123,7 +1123,7 @@ static void WallyHandleBallThrowAnim(void)
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId; gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE; gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(IDENTITY_OPPONENT_MON1), B_ANIM_SAFARI_BALL_THROW); InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByIdentity(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation; gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
} }
@ -1494,9 +1494,9 @@ static void sub_816AA80(u8 bank)
gBattlePartyID[bank] = gBattleBufferA[bank][1]; gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES); species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714); gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankIdentity(bank)); sub_806A068(species, GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
GetBankPosition(bank, 2), GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank), GetBankSpriteDefault_Y(bank),
sub_80A82E4(bank)); sub_80A82E4(bank));

View File

@ -16,7 +16,7 @@ extern u32 gBattleTypeFlags;
extern u32 gBattleExecBuffer; extern u32 gBattleExecBuffer;
extern void (*gBattleMainFunc)(void); extern void (*gBattleMainFunc)(void);
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void); extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
extern u8 gBanksByIdentity[BATTLE_BANKS_COUNT]; extern u8 gBankPositions[BATTLE_BANKS_COUNT];
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT]; extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT]; extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gNoOfAllBanks; extern u8 gNoOfAllBanks;
@ -79,7 +79,7 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
for (i = 0; i < BATTLE_BANKS_COUNT; i++) for (i = 0; i < BATTLE_BANKS_COUNT; i++)
{ {
gBattleBankFunc[i] = nullsub_21; gBattleBankFunc[i] = nullsub_21;
gBanksByIdentity[i] = 0xFF; gBankPositions[i] = 0xFF;
gActionSelectionCursor[i] = 0; gActionSelectionCursor[i] = 0;
gMoveSelectionCursor[i] = 0; gMoveSelectionCursor[i] = 0;
} }
@ -146,30 +146,30 @@ static void SetControllersVariables(void)
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED) if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{ {
gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayerPartner; gBattleBankFunc[2] = SetControllerToPlayerPartner;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent; gBattleBankFunc[3] = SetControllerToOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
} }
else else
{ {
gBattleBankFunc[0] = SetControllerToPlayer; gBattleBankFunc[0] = SetControllerToPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayerPartner; gBattleBankFunc[2] = SetControllerToPlayerPartner;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent; gBattleBankFunc[3] = SetControllerToOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
} }
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
@ -195,10 +195,10 @@ static void SetControllersVariables(void)
else else
gBattleBankFunc[0] = SetControllerToPlayer; gBattleBankFunc[0] = SetControllerToPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gNoOfAllBanks = 2; gNoOfAllBanks = 2;
@ -211,20 +211,20 @@ static void SetControllersVariables(void)
gBattleMainFunc = BeginBattleIntro; gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToRecordedOpponent; gBattleBankFunc[1] = SetControllerToRecordedOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gNoOfAllBanks = 2; gNoOfAllBanks = 2;
} }
else // see how the banks are switched else // see how the banks are switched
{ {
gBattleBankFunc[1] = SetControllerToRecordedPlayer; gBattleBankFunc[1] = SetControllerToRecordedPlayer;
gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[0] = SetControllerToRecordedOpponent; gBattleBankFunc[0] = SetControllerToRecordedOpponent;
gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gNoOfAllBanks = 2; gNoOfAllBanks = 2;
} }
@ -232,10 +232,10 @@ static void SetControllersVariables(void)
else else
{ {
gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
} }
} }
} }
@ -244,16 +244,16 @@ static void SetControllersVariables(void)
gBattleMainFunc = BeginBattleIntro; gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer; gBattleBankFunc[0] = SetControllerToPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayer; gBattleBankFunc[2] = SetControllerToPlayer;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent; gBattleBankFunc[3] = SetControllerToOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
@ -264,16 +264,16 @@ static void SetControllersVariables(void)
gBattleMainFunc = BeginBattleIntro; gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBanksByIdentity[0] = 0; gBankPositions[0] = 0;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = 1; gBankPositions[1] = 1;
gBattleBankFunc[2] = SetControllerToRecordedPlayer; gBattleBankFunc[2] = SetControllerToRecordedPlayer;
gBanksByIdentity[2] = 2; gBankPositions[2] = 2;
gBattleBankFunc[3] = SetControllerToOpponent; gBattleBankFunc[3] = SetControllerToOpponent;
gBanksByIdentity[3] = 3; gBankPositions[3] = 3;
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
@ -312,12 +312,12 @@ static void SetControllersVariables(void)
{ {
case 0: case 0:
case 3: case 3:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = IDENTITY_PLAYER_MON1; gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = IDENTITY_PLAYER_MON2; gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break; break;
} }
@ -330,12 +330,12 @@ static void SetControllersVariables(void)
{ {
case 0: case 0:
case 3: case 3:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = IDENTITY_PLAYER_MON1; gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = IDENTITY_PLAYER_MON2; gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break; break;
} }
@ -347,12 +347,12 @@ static void SetControllersVariables(void)
{ {
case 0: case 0:
case 3: case 3:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = IDENTITY_OPPONENT_MON1; gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_LEFT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = IDENTITY_OPPONENT_MON2; gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_RIGHT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break; break;
} }
@ -362,51 +362,51 @@ static void SetControllersVariables(void)
else if (gBattleTypeFlags & BATTLE_TYPE_WILD) else if (gBattleTypeFlags & BATTLE_TYPE_WILD)
{ {
gBattleBankFunc[0] = SetControllerToRecordedPlayer; gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[2] = SetControllerToRecordedPlayer; gBattleBankFunc[2] = SetControllerToRecordedPlayer;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
if (gBattleTypeFlags & BATTLE_TYPE_x2000000) if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
gBattleBankFunc[1] = SetControllerToRecordedOpponent; gBattleBankFunc[1] = SetControllerToRecordedOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[3] = SetControllerToRecordedOpponent; gBattleBankFunc[3] = SetControllerToRecordedOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
} }
else else
{ {
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[3] = SetControllerToOpponent; gBattleBankFunc[3] = SetControllerToOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
} }
} }
else else
{ {
gBattleBankFunc[1] = SetControllerToRecordedPlayer; gBattleBankFunc[1] = SetControllerToRecordedPlayer;
gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[3] = SetControllerToRecordedPlayer; gBattleBankFunc[3] = SetControllerToRecordedPlayer;
gBanksByIdentity[3] = IDENTITY_PLAYER_MON2; gBankPositions[3] = B_POSITION_PLAYER_RIGHT;
if (gBattleTypeFlags & BATTLE_TYPE_x2000000) if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{ {
gBattleBankFunc[0] = SetControllerToRecordedOpponent; gBattleBankFunc[0] = SetControllerToRecordedOpponent;
gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToRecordedOpponent; gBattleBankFunc[2] = SetControllerToRecordedOpponent;
gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
} }
else else
{ {
gBattleBankFunc[0] = SetControllerToOpponent; gBattleBankFunc[0] = SetControllerToOpponent;
gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToOpponent; gBattleBankFunc[2] = SetControllerToOpponent;
gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
} }
} }
} }
@ -425,20 +425,20 @@ static void SetControllersVariablesInLinkBattle(void)
gBattleMainFunc = BeginBattleIntro; gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer; gBattleBankFunc[0] = SetControllerToPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToLinkOpponent; gBattleBankFunc[1] = SetControllerToLinkOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gNoOfAllBanks = 2; gNoOfAllBanks = 2;
} }
else else
{ {
gBattleBankFunc[1] = SetControllerToPlayer; gBattleBankFunc[1] = SetControllerToPlayer;
gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[0] = SetControllerToLinkOpponent; gBattleBankFunc[0] = SetControllerToLinkOpponent;
gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gNoOfAllBanks = 2; gNoOfAllBanks = 2;
} }
@ -450,32 +450,32 @@ static void SetControllersVariablesInLinkBattle(void)
gBattleMainFunc = BeginBattleIntro; gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer; gBattleBankFunc[0] = SetControllerToPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToLinkOpponent; gBattleBankFunc[1] = SetControllerToLinkOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayer; gBattleBankFunc[2] = SetControllerToPlayer;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToLinkOpponent; gBattleBankFunc[3] = SetControllerToLinkOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
} }
else else
{ {
gBattleBankFunc[1] = SetControllerToPlayer; gBattleBankFunc[1] = SetControllerToPlayer;
gBanksByIdentity[1] = IDENTITY_PLAYER_MON1; gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[0] = SetControllerToLinkOpponent; gBattleBankFunc[0] = SetControllerToLinkOpponent;
gBanksByIdentity[0] = IDENTITY_OPPONENT_MON1; gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[3] = SetControllerToPlayer; gBattleBankFunc[3] = SetControllerToPlayer;
gBanksByIdentity[3] = IDENTITY_PLAYER_MON2; gBankPositions[3] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[2] = SetControllerToLinkOpponent; gBattleBankFunc[2] = SetControllerToLinkOpponent;
gBanksByIdentity[2] = IDENTITY_OPPONENT_MON2; gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
} }
@ -487,32 +487,32 @@ static void SetControllersVariablesInLinkBattle(void)
gBattleMainFunc = BeginBattleIntro; gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer; gBattleBankFunc[0] = SetControllerToPlayer;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent; gBattleBankFunc[1] = SetControllerToOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToLinkPartner; gBattleBankFunc[2] = SetControllerToLinkPartner;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent; gBattleBankFunc[3] = SetControllerToOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
} }
else else
{ {
gBattleBankFunc[0] = SetControllerToLinkPartner; gBattleBankFunc[0] = SetControllerToLinkPartner;
gBanksByIdentity[0] = IDENTITY_PLAYER_MON1; gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToLinkOpponent; gBattleBankFunc[1] = SetControllerToLinkOpponent;
gBanksByIdentity[1] = IDENTITY_OPPONENT_MON1; gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayer; gBattleBankFunc[2] = SetControllerToPlayer;
gBanksByIdentity[2] = IDENTITY_PLAYER_MON2; gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToLinkOpponent; gBattleBankFunc[3] = SetControllerToLinkOpponent;
gBanksByIdentity[3] = IDENTITY_OPPONENT_MON2; gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gNoOfAllBanks = 4; gNoOfAllBanks = 4;
} }
@ -554,12 +554,12 @@ static void SetControllersVariablesInLinkBattle(void)
{ {
case 0: case 0:
case 3: case 3:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = 0; gBankPositions[gLinkPlayers[i].lp_field_18] = 0;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = 2; gBankPositions[gLinkPlayers[i].lp_field_18] = 2;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break; break;
} }
@ -574,12 +574,12 @@ static void SetControllersVariablesInLinkBattle(void)
{ {
case 0: case 0:
case 3: case 3:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = 0; gBankPositions[gLinkPlayers[i].lp_field_18] = 0;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = 2; gBankPositions[gLinkPlayers[i].lp_field_18] = 2;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break; break;
} }
@ -591,12 +591,12 @@ static void SetControllersVariablesInLinkBattle(void)
{ {
case 0: case 0:
case 3: case 3:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = 1; gBankPositions[gLinkPlayers[i].lp_field_18] = 1;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break; break;
case 1: case 1:
case 2: case 2:
gBanksByIdentity[gLinkPlayers[i].lp_field_18] = 3; gBankPositions[gLinkPlayers[i].lp_field_18] = 3;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3; gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break; break;
} }

View File

@ -29,7 +29,7 @@ extern u8 gNoOfAllBanks;
extern u16 gUnknown_020243FC; extern u16 gUnknown_020243FC;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u8 gBanksByIdentity[BATTLE_BANKS_COUNT]; extern u8 gBankPositions[BATTLE_BANKS_COUNT];
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT]; extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT]; extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
@ -262,7 +262,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
else if (var1 == MOVE_TARGET_SELECTED) else if (var1 == MOVE_TARGET_SELECTED)
chosenMoveId |= (BattlePalaceGetTargetRetValue()); chosenMoveId |= (BattlePalaceGetTargetRetValue());
else else
chosenMoveId |= (GetBankByIdentity((GetBankIdentity(gActiveBank) & BIT_SIDE) ^ BIT_SIDE) << 8); chosenMoveId |= (GetBankByIdentity((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE) << 8);
return chosenMoveId; return chosenMoveId;
} }
@ -299,13 +299,13 @@ static u16 BattlePalaceGetTargetRetValue(void)
if (GetBankSide(gActiveBank) == SIDE_PLAYER) if (GetBankSide(gActiveBank) == SIDE_PLAYER)
{ {
opposing1 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); opposing1 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
opposing2 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); opposing2 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
} }
else else
{ {
opposing1 = GetBankByIdentity(IDENTITY_PLAYER_MON1); opposing1 = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
opposing2 = GetBankByIdentity(IDENTITY_PLAYER_MON2); opposing2 = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
} }
if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp) if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp)
@ -561,7 +561,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank)
} }
otId = GetMonData(mon, MON_DATA_OT_ID); otId = GetMonData(mon, MON_DATA_OT_ID);
identity = GetBankIdentity(bank); identity = GetBankPosition(bank);
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species], HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
gMonSpritesGfxPtr->sprites[identity], gMonSpritesGfxPtr->sprites[identity],
species, currentPersonality); species, currentPersonality);
@ -614,7 +614,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank)
} }
otId = GetMonData(mon, MON_DATA_OT_ID); otId = GetMonData(mon, MON_DATA_OT_ID);
identity = GetBankIdentity(bank); identity = GetBankPosition(bank);
if (sub_80688F8(1, bank) == 1 || gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE) if (sub_80688F8(1, bank) == 1 || gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE)
{ {
@ -665,7 +665,7 @@ void nullsub_24(u16 species)
void DecompressTrainerFrontPic(u16 frontPicId, u8 bank) void DecompressTrainerFrontPic(u16 frontPicId, u8 bank)
{ {
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId], DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId],
gMonSpritesGfxPtr->sprites[identity], gMonSpritesGfxPtr->sprites[identity],
SPECIES_NONE); SPECIES_NONE);
@ -674,7 +674,7 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 bank)
void DecompressTrainerBackPic(u16 backPicId, u8 bank) void DecompressTrainerBackPic(u16 backPicId, u8 bank)
{ {
u8 identity = GetBankIdentity(bank); u8 identity = GetBankPosition(bank);
DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId], DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId],
gMonSpritesGfxPtr->sprites[identity], gMonSpritesGfxPtr->sprites[identity],
SPECIES_NONE); SPECIES_NONE);
@ -713,7 +713,7 @@ void sub_805DFFC(void)
numberOfBanks = 4; numberOfBanks = 4;
} }
for (i = 0; i < numberOfBanks; i++) for (i = 0; i < numberOfBanks; i++)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[i]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[i]]);
} }
bool8 BattleLoadAllHealthBoxesGfx(u8 state) bool8 BattleLoadAllHealthBoxesGfx(u8 state)
@ -739,9 +739,9 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else if (state == 3) else if (state == 3)
LoadCompressedObjectPic(&gUnknown_0832C0D8); LoadCompressedObjectPic(&gUnknown_0832C0D8);
else if (state == 4) else if (state == 4)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[0]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[0]]);
else if (state == 5) else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[1]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[1]]);
else else
retVal = TRUE; retVal = TRUE;
} }
@ -756,13 +756,13 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else if (state == 5) else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C0F0[1]); LoadCompressedObjectPic(&gUnknown_0832C0F0[1]);
else if (state == 6) else if (state == 6)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[0]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[0]]);
else if (state == 7) else if (state == 7)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[1]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[1]]);
else if (state == 8) else if (state == 8)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[2]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[2]]);
else if (state == 9) else if (state == 9)
LoadCompressedObjectPic(&gUnknown_0832C108[gBanksByIdentity[3]]); LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[3]]);
else else
retVal = TRUE; retVal = TRUE;
} }
@ -815,7 +815,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
break; break;
case 4: case 4:
SetBankHealthboxSpritePos(*bank); SetBankHealthboxSpritePos(*bank);
if (gBanksByIdentity[*bank] <= 1) if (gBankPositions[*bank] <= 1)
DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], FALSE); DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], FALSE);
else else
DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], TRUE); DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], TRUE);
@ -921,7 +921,7 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
} }
else else
{ {
identity = GetBankIdentity(bankAtk); identity = GetBankPosition(bankAtk);
if (GetBankSide(bankDef) == SIDE_OPPONENT) if (GetBankSide(bankDef) == SIDE_OPPONENT)
targetSpecies = GetMonData(&gEnemyParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES); targetSpecies = GetMonData(&gEnemyParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES);
@ -991,7 +991,7 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite)
if (IsContest()) if (IsContest())
identity = 0; identity = 0;
else else
identity = GetBankIdentity(bank); identity = GetBankPosition(bank);
if (IsContest()) if (IsContest())
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[identity]); LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[identity]);
@ -1080,7 +1080,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank)
void BattleStopLowHpSound(void) void BattleStopLowHpSound(void)
{ {
u8 playerBank = GetBankByIdentity(IDENTITY_PLAYER_MON1); u8 playerBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
gBattleSpritesDataPtr->bankData[playerBank].lowHpSong = 0; gBattleSpritesDataPtr->bankData[playerBank].lowHpSong = 0;
if (IsDoubleBattle()) if (IsDoubleBattle())
@ -1101,8 +1101,8 @@ void sub_805EAE8(void)
{ {
if (gMain.inBattle) if (gMain.inBattle)
{ {
u8 playerBank1 = GetBankByIdentity(IDENTITY_PLAYER_MON1); u8 playerBank1 = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
u8 playerBank2 = GetBankByIdentity(IDENTITY_PLAYER_MON2); u8 playerBank2 = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
u8 bank1PartyId = pokemon_order_func(gBattlePartyID[playerBank1]); u8 bank1PartyId = pokemon_order_func(gBattlePartyID[playerBank1]);
u8 bank2PartyId = pokemon_order_func(gBattlePartyID[playerBank2]); u8 bank2PartyId = pokemon_order_func(gBattlePartyID[playerBank2]);
@ -1143,14 +1143,14 @@ void LoadAndCreateEnemyShadowSprites(void)
LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow); LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow);
bank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); bank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankPosition(bank, 0), GetBankPosition(bank, 1) + 29, 0xC8); gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8);
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank; gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
if (IsDoubleBattle()) if (IsDoubleBattle())
{ {
bank = GetBankByIdentity(IDENTITY_OPPONENT_MON2); bank = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankPosition(bank, 0), GetBankPosition(bank, 1) + 29, 0xC8); gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8);
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank; gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
} }
} }

View File

@ -152,7 +152,7 @@ enum
HEALTHBOX_GFX_117, HEALTHBOX_GFX_117,
}; };
extern u8 gBanksByIdentity[BATTLE_BANKS_COUNT]; extern u8 gBankPositions[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gNoOfAllBanks; extern u8 gNoOfAllBanks;
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT]; extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
@ -933,8 +933,8 @@ u8 CreateBankHealthboxSprites(u8 bank)
{ {
if (GetBankSide(bank) == SIDE_PLAYER) if (GetBankSide(bank) == SIDE_PLAYER)
{ {
healthboxSpriteId_1 = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBankIdentity(bank) / 2], 240, 160, 1); healthboxSpriteId_1 = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBankIdentity(bank) / 2], 240, 160, 1); healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2; gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
@ -946,8 +946,8 @@ u8 CreateBankHealthboxSprites(u8 bank)
} }
else else
{ {
healthboxSpriteId_1 = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBankIdentity(bank) / 2], 240, 160, 1); healthboxSpriteId_1 = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBankIdentity(bank) / 2], 240, 160, 1); healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2; gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
@ -959,7 +959,7 @@ u8 CreateBankHealthboxSprites(u8 bank)
} }
} }
unkSpriteId = CreateSpriteAtEnd(&sUnknown_0832C1C0[gBanksByIdentity[bank]], 140, 60, 0); unkSpriteId = CreateSpriteAtEnd(&sUnknown_0832C1C0[gBankPositions[bank]], 140, 60, 0);
unkSpritePtr = &gSprites[unkSpriteId]; unkSpritePtr = &gSprites[unkSpriteId];
SetSubspriteTables(unkSpritePtr, &sUnknown_0832C28C[GetBankSide(bank)]); SetSubspriteTables(unkSpritePtr, &sUnknown_0832C28C[GetBankSide(bank)]);
unkSpritePtr->subspriteMode = 2; unkSpritePtr->subspriteMode = 2;
@ -1111,18 +1111,18 @@ void SetBankHealthboxSpritePos(u8 bank)
} }
else else
{ {
switch (GetBankIdentity(bank)) switch (GetBankPosition(bank))
{ {
case IDENTITY_PLAYER_MON1: case B_POSITION_PLAYER_LEFT:
x = 159, y = 76; x = 159, y = 76;
break; break;
case IDENTITY_PLAYER_MON2: case B_POSITION_PLAYER_RIGHT:
x = 171, y = 101; x = 171, y = 101;
break; break;
case IDENTITY_OPPONENT_MON1: case B_POSITION_OPPONENT_LEFT:
x = 44, y = 19; x = 44, y = 19;
break; break;
case IDENTITY_OPPONENT_MON2: case B_POSITION_OPPONENT_RIGHT:
x = 32, y = 44; x = 32, y = 44;
break; break;
} }
@ -1353,7 +1353,7 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon)
u8 i, var, nature, healthboxSpriteId_2; u8 i, var, nature, healthboxSpriteId_2;
memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4)); memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4));
barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBankIdentity(gSprites[healthboxSpriteId].data[6]) * 384)]; barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBankPosition(gSprites[healthboxSpriteId].data[6]) * 384)];
var = 5; var = 5;
nature = GetNature(mon); nature = GetNature(mon);
StringCopy(text + 6, gNatureNamePointers[nature]); StringCopy(text + 6, gNatureNamePointers[nature]);
@ -1485,7 +1485,7 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
u8 ballIconSpritesIds[6]; u8 ballIconSpritesIds[6];
u8 taskId; u8 taskId;
if (!arg2 || GetBankIdentity(bank) != IDENTITY_OPPONENT_MON2) if (!arg2 || GetBankPosition(bank) != B_POSITION_OPPONENT_RIGHT)
{ {
if (GetBankSide(bank) == SIDE_PLAYER) if (GetBankSide(bank) == SIDE_PLAYER)
{ {

View File

@ -1834,25 +1834,25 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = gStringVar3; toCpy = gStringVar3;
break; break;
case B_TXT_PLAYER_MON1_NAME: // first player poke name case B_TXT_PLAYER_MON1_NAME: // first player poke name
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(IDENTITY_PLAYER_MON1)]], GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(B_POSITION_PLAYER_LEFT)]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_OPPONENT_MON1_NAME: // first enemy poke name case B_TXT_OPPONENT_MON1_NAME: // first enemy poke name
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(IDENTITY_OPPONENT_MON1)]], GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(B_POSITION_OPPONENT_LEFT)]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_PLAYER_MON2_NAME: // second player poke name case B_TXT_PLAYER_MON2_NAME: // second player poke name
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(IDENTITY_PLAYER_MON2)]], GetMonData(&gPlayerParty[gBattlePartyID[GetBankByIdentity(B_POSITION_PLAYER_RIGHT)]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;
break; break;
case B_TXT_OPPONENT_MON2_NAME: // second enemy poke name case B_TXT_OPPONENT_MON2_NAME: // second enemy poke name
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(IDENTITY_OPPONENT_MON2)]], GetMonData(&gEnemyParty[gBattlePartyID[GetBankByIdentity(B_POSITION_OPPONENT_RIGHT)]],
MON_DATA_NICKNAME, text); MON_DATA_NICKNAME, text);
StringGetEnd10(text); StringGetEnd10(text);
toCpy = text; toCpy = text;

View File

@ -4661,7 +4661,7 @@ _0804BA58:\n\
ldr r6, =gActiveBank\n\ ldr r6, =gActiveBank\n\
ldrb r0, [r6]\n\ ldrb r0, [r6]\n\
str r3, [sp]\n\ str r3, [sp]\n\
bl GetBankIdentity\n\ bl GetBankPosition\n\
mov r1, r10\n\ mov r1, r10\n\
ands r1, r0\n\ ands r1, r0\n\
lsls r0, r1, 1\n\ lsls r0, r1, 1\n\
@ -5103,7 +5103,7 @@ static void atk49_moveend(void)
&& !gProtectStructs[gBankAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH && !gProtectStructs[gBankAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH
&& !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) && !(gHitMarker & HITMARKER_NO_ATTACKSTRING))
{ {
u8 bank = GetBankByIdentity(GetBankIdentity(gBankTarget) ^ BIT_MON); u8 bank = GetBankByIdentity(GetBankPosition(gBankTarget) ^ BIT_MON);
if (gBattleMons[bank].hp != 0) if (gBattleMons[bank].hp != 0)
{ {
gBankTarget = bank; gBankTarget = bank;
@ -5454,10 +5454,10 @@ static void atk4F_jumpifcantswitch(void)
{ {
if (GetBankSide(gActiveBank) == SIDE_OPPONENT) if (GetBankSide(gActiveBank) == SIDE_OPPONENT)
{ {
r7 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); r7 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
compareVar = GetBankByIdentity(IDENTITY_OPPONENT_MON2); compareVar = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
else else
compareVar = r7; compareVar = r7;
@ -5465,10 +5465,10 @@ static void atk4F_jumpifcantswitch(void)
} }
else else
{ {
r7 = GetBankByIdentity(IDENTITY_PLAYER_MON1); r7 = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
compareVar = GetBankByIdentity(IDENTITY_PLAYER_MON2); compareVar = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
else else
compareVar = r7; compareVar = r7;
@ -5763,7 +5763,7 @@ static void atk50_openpartyscreen(void)
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
if (GetBankIdentity(gActiveBank) == 0 && gBattleResults.playerSwitchesCounter < 0xFF) if (GetBankPosition(gActiveBank) == 0 && gBattleResults.playerSwitchesCounter < 0xFF)
gBattleResults.playerSwitchesCounter++; gBattleResults.playerSwitchesCounter++;
if (gBattleTypeFlags & BATTLE_TYPE_MULTI) if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
@ -5779,7 +5779,7 @@ static void atk50_openpartyscreen(void)
} }
else else
{ {
gActiveBank = GetBankByIdentity(GetBankIdentity(bank) ^ BIT_SIDE); gActiveBank = GetBankByIdentity(GetBankPosition(bank) ^ BIT_SIDE);
if (gAbsentBankFlags & gBitTable[gActiveBank]) if (gAbsentBankFlags & gBitTable[gActiveBank])
gActiveBank ^= BIT_MON; gActiveBank ^= BIT_MON;
@ -5976,7 +5976,7 @@ static void atk56_playfaintcry(void)
static void atk57(void) static void atk57(void)
{ {
gActiveBank = GetBankByIdentity(IDENTITY_PLAYER_MON1); gActiveBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
EmitCmd55(0, gBattleOutcome); EmitCmd55(0, gBattleOutcome);
MarkBufferBankForExecution(gActiveBank); MarkBufferBankForExecution(gActiveBank);
@ -6011,7 +6011,7 @@ static void atk59_handlelearnnewmove(void)
} }
else else
{ {
gActiveBank = GetBankByIdentity(IDENTITY_PLAYER_MON1); gActiveBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
if (gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId if (gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId
&& !(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED)) && !(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED))
@ -6020,7 +6020,7 @@ static void atk59_handlelearnnewmove(void)
} }
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{ {
gActiveBank = GetBankByIdentity(IDENTITY_PLAYER_MON2); gActiveBank = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
if (gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId if (gBattlePartyID[gActiveBank] == gBattleStruct->expGetterId
&& !(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED)) && !(gBattleMons[gActiveBank].status2 & STATUS2_TRANSFORMED))
{ {
@ -6851,7 +6851,7 @@ static void atk6D_resetsentmonsvalue(void)
static void atk6E_setatktoplayer0(void) static void atk6E_setatktoplayer0(void)
{ {
gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankAttacker = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@ -8309,7 +8309,7 @@ static void atk98_updatestatusicon(void)
} }
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{ {
gActiveBank = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_MON); gActiveBank = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_MON);
if (!(gAbsentBankFlags & gBitTable[gActiveBank])) if (!(gAbsentBankFlags & gBitTable[gActiveBank]))
{ {
EmitStatusIconUpdate(0, gBattleMons[gActiveBank].status1, gBattleMons[gActiveBank].status2); EmitStatusIconUpdate(0, gBattleMons[gActiveBank].status1, gBattleMons[gActiveBank].status2);
@ -8978,7 +8978,7 @@ static void atkAE_healpartystatus(void)
gBattleCommunication[MULTISTRING_CHOOSER] |= 1; gBattleCommunication[MULTISTRING_CHOOSER] |= 1;
} }
gActiveBank = gBattleScripting.bank = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_MON); gActiveBank = gBattleScripting.bank = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_MON);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBankFlags & gBitTable[gActiveBank])) && !(gAbsentBankFlags & gBitTable[gActiveBank]))
@ -9026,7 +9026,7 @@ static void atkAE_healpartystatus(void)
gBattleMons[gBankAttacker].status1 = 0; gBattleMons[gBankAttacker].status1 = 0;
gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE); gBattleMons[gBankAttacker].status2 &= ~(STATUS2_NIGHTMARE);
gActiveBank = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_MON); gActiveBank = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_MON);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBankFlags & gBitTable[gActiveBank])) && !(gAbsentBankFlags & gBitTable[gActiveBank]))
{ {
@ -9296,16 +9296,16 @@ static void atkBA_jumpifnopursuitswitchdmg(void)
if (gMultiHitCounter == 1) if (gMultiHitCounter == 1)
{ {
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
else else
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
} }
else else
{ {
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON2); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
else else
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); gBankTarget = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
} }
if (gActionForBanks[gBankTarget] == ACTION_USE_MOVE if (gActionForBanks[gBankTarget] == ACTION_USE_MOVE
@ -9875,7 +9875,7 @@ static void atkD0_settaunt(void)
static void atkD1_trysethelpinghand(void) static void atkD1_trysethelpinghand(void)
{ {
gBankTarget = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_MON); gBankTarget = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_MON);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBankFlags & gBitTable[gBankTarget]) && !(gAbsentBankFlags & gBitTable[gBankTarget])
@ -10544,7 +10544,7 @@ static void atkEB_settypetoterrain(void)
static void atkEC_pursuitrelated(void) static void atkEC_pursuitrelated(void)
{ {
gActiveBank = GetBankByIdentity(GetBankIdentity(gBankAttacker) ^ BIT_MON); gActiveBank = GetBankByIdentity(GetBankPosition(gBankAttacker) ^ BIT_MON);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE
&& !(gAbsentBankFlags & gBitTable[gActiveBank]) && !(gAbsentBankFlags & gBitTable[gActiveBank])

View File

@ -104,16 +104,16 @@ u8 GetBattleBank(u8 caseId)
case 8: case 8:
case 9: case 9:
case BS_GET_PLAYER1: case BS_GET_PLAYER1:
ret = GetBankByIdentity(IDENTITY_PLAYER_MON1); ret = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
break; break;
case BS_GET_OPPONENT1: case BS_GET_OPPONENT1:
ret = GetBankByIdentity(IDENTITY_OPPONENT_MON1); ret = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
break; break;
case BS_GET_PLAYER2: case BS_GET_PLAYER2:
ret = GetBankByIdentity(IDENTITY_PLAYER_MON2); ret = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
break; break;
case BS_GET_OPPONENT2: case BS_GET_OPPONENT2:
ret = GetBankByIdentity(IDENTITY_OPPONENT_MON2); ret = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
break; break;
} }
return ret; return ret;
@ -1667,14 +1667,14 @@ bool8 sub_80423F4(u8 bank, u8 r1, u8 r2)
{ {
if (GetBankSide(bank) == SIDE_OPPONENT) if (GetBankSide(bank) == SIDE_OPPONENT)
{ {
r7 = GetBankByIdentity(IDENTITY_OPPONENT_MON1); r7 = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
r6 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); r6 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
party = gEnemyParty; party = gEnemyParty;
} }
else else
{ {
r7 = GetBankByIdentity(IDENTITY_PLAYER_MON1); r7 = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
r6 = GetBankByIdentity(IDENTITY_PLAYER_MON2); r6 = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
party = gPlayerParty; party = gPlayerParty;
} }
if (r1 == 6) if (r1 == 6)
@ -2335,7 +2335,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg)
if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE)) if (gBattleMons[i].ability == ABILITY_TRACE && (gStatuses3[i] & STATUS3_TRACE))
{ {
u8 target2; u8 target2;
side = (GetBankIdentity(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon side = (GetBankPosition(i) ^ BIT_SIDE) & BIT_SIDE; // side of the opposing pokemon
target1 = GetBankByIdentity(side); target1 = GetBankByIdentity(side);
target2 = GetBankByIdentity(side + BIT_MON); target2 = GetBankByIdentity(side + BIT_MON);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -3268,7 +3268,7 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
case MOVE_TARGET_BOTH: case MOVE_TARGET_BOTH:
case MOVE_TARGET_FOES_AND_ALLY: case MOVE_TARGET_FOES_AND_ALLY:
case MOVE_TARGET_OPPONENTS_FIELD: case MOVE_TARGET_OPPONENTS_FIELD:
targetBank = GetBankByIdentity((GetBankIdentity(gBankAttacker) & BIT_SIDE) ^ BIT_SIDE); targetBank = GetBankByIdentity((GetBankPosition(gBankAttacker) & BIT_SIDE) ^ BIT_SIDE);
if (gAbsentBankFlags & gBitTable[targetBank]) if (gAbsentBankFlags & gBitTable[targetBank])
targetBank ^= BIT_MON; targetBank ^= BIT_MON;
break; break;
@ -3281,22 +3281,22 @@ u8 GetMoveTarget(u16 move, u8 useMoveTarget)
if (GetBankSide(gBankAttacker) == SIDE_PLAYER) if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{ {
if (Random() & 1) if (Random() & 1)
targetBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); targetBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
else else
targetBank = GetBankByIdentity(IDENTITY_OPPONENT_MON2); targetBank = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
} }
else else
{ {
if (Random() & 1) if (Random() & 1)
targetBank = GetBankByIdentity(IDENTITY_PLAYER_MON1); targetBank = GetBankByIdentity(B_POSITION_PLAYER_LEFT);
else else
targetBank = GetBankByIdentity(IDENTITY_PLAYER_MON2); targetBank = GetBankByIdentity(B_POSITION_PLAYER_RIGHT);
} }
if (gAbsentBankFlags & gBitTable[targetBank]) if (gAbsentBankFlags & gBitTable[targetBank])
targetBank ^= BIT_MON; targetBank ^= BIT_MON;
} }
else else
targetBank = GetBankByIdentity((GetBankIdentity(gBankAttacker) & BIT_SIDE) ^ BIT_SIDE); targetBank = GetBankByIdentity((GetBankPosition(gBankAttacker) & BIT_SIDE) ^ BIT_SIDE);
break; break;
case MOVE_TARGET_USER: case MOVE_TARGET_USER:
case MOVE_TARGET_x10: case MOVE_TARGET_x10:
@ -3332,7 +3332,7 @@ u8 IsMonDisobedient(void)
if (HasObedientBitSet(gBankAttacker)) // only if species is Mew or Deoxys if (HasObedientBitSet(gBankAttacker)) // only if species is Mew or Deoxys
{ {
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBankIdentity(gBankAttacker) == 2) if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBankPosition(gBankAttacker) == 2)
return 0; return 0;
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
return 0; return 0;

View File

@ -87,15 +87,15 @@ void AdjustFriendshipOnBattleFaint(u8 bank)
{ {
u8 opposingBank2; u8 opposingBank2;
opposingBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); opposingBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
opposingBank2 = GetBankByIdentity(IDENTITY_OPPONENT_MON2); opposingBank2 = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
if (gBattleMons[opposingBank2].level > gBattleMons[opposingBank].level) if (gBattleMons[opposingBank2].level > gBattleMons[opposingBank].level)
opposingBank = opposingBank2; opposingBank = opposingBank2;
} }
else else
{ {
opposingBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); opposingBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
} }
if (gBattleMons[opposingBank].level > gBattleMons[bank].level) if (gBattleMons[opposingBank].level > gBattleMons[bank].level)

View File

@ -384,14 +384,14 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1; gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
break; break;
case POKEBALL_OPPONENT_SENDOUT: case POKEBALL_OPPONENT_SENDOUT:
gSprites[ballSpriteId].pos1.x = GetBankPosition(bank, BANK_X_POS); gSprites[ballSpriteId].pos1.x = GetBankCoord(bank, BANK_X_POS);
gSprites[ballSpriteId].pos1.y = GetBankPosition(bank, BANK_Y_POS) + 24; gSprites[ballSpriteId].pos1.y = GetBankCoord(bank, BANK_Y_POS) + 24;
gBankTarget = bank; gBankTarget = bank;
gSprites[ballSpriteId].data[0] = 0; gSprites[ballSpriteId].data[0] = 0;
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut; gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
break; break;
default: default:
gBankTarget = GetBankByIdentity(IDENTITY_OPPONENT_MON1); gBankTarget = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
notSendOut = TRUE; notSendOut = TRUE;
break; break;
} }
@ -405,8 +405,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
// this will perform an unused ball throw animation // this will perform an unused ball throw animation
gSprites[ballSpriteId].data[0] = 0x22; gSprites[ballSpriteId].data[0] = 0x22;
gSprites[ballSpriteId].data[2] = GetBankPosition(gBankTarget, BANK_X_POS); gSprites[ballSpriteId].data[2] = GetBankCoord(gBankTarget, BANK_X_POS);
gSprites[ballSpriteId].data[4] = GetBankPosition(gBankTarget, BANK_Y_POS) - 16; gSprites[ballSpriteId].data[4] = GetBankCoord(gBankTarget, BANK_Y_POS) - 16;
gSprites[ballSpriteId].data[5] = -40; gSprites[ballSpriteId].data[5] = -40;
sub_80A68D4(&gSprites[ballSpriteId]); sub_80A68D4(&gSprites[ballSpriteId]);
gSprites[ballSpriteId].oam.affineParam = taskId; gSprites[ballSpriteId].oam.affineParam = taskId;
@ -767,7 +767,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
} }
species = GetMonData(mon, MON_DATA_SPECIES); species = GetMonData(mon, MON_DATA_SPECIES);
if ((bank == GetBankByIdentity(IDENTITY_PLAYER_MON1) || bank == GetBankByIdentity(IDENTITY_OPPONENT_MON1)) if ((bank == GetBankByIdentity(B_POSITION_PLAYER_LEFT) || bank == GetBankByIdentity(B_POSITION_OPPONENT_LEFT))
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1) && IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
@ -783,7 +783,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1) if (!IsDoubleBattle() || !gBattleSpritesDataPtr->animationData->field_9_x1)
wantedCryCase = 0; wantedCryCase = 0;
else if (bank == GetBankByIdentity(IDENTITY_PLAYER_MON1) || bank == GetBankByIdentity(IDENTITY_OPPONENT_MON1)) else if (bank == GetBankByIdentity(B_POSITION_PLAYER_LEFT) || bank == GetBankByIdentity(B_POSITION_OPPONENT_LEFT))
wantedCryCase = 1; wantedCryCase = 1;
else else
wantedCryCase = 2; wantedCryCase = 2;
@ -900,8 +900,8 @@ static void sub_80760F8(struct Sprite *sprite)
static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite) static void SpriteCB_PlayerMonSendOut_1(struct Sprite *sprite)
{ {
sprite->data[0] = 25; sprite->data[0] = 25;
sprite->data[2] = GetBankPosition(sprite->sBank, 2); sprite->data[2] = GetBankCoord(sprite->sBank, 2);
sprite->data[4] = GetBankPosition(sprite->sBank, 3) + 24; sprite->data[4] = GetBankCoord(sprite->sBank, 3) + 24;
sprite->data[5] = -30; sprite->data[5] = -30;
sprite->oam.affineParam = sprite->sBank; sprite->oam.affineParam = sprite->sBank;
sub_80A68D4(sprite); sub_80A68D4(sprite);
@ -956,7 +956,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
sprite->data[0] = 0; sprite->data[0] = 0;
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1 if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
&& sprite->sBank == GetBankByIdentity(IDENTITY_PLAYER_MON2)) && sprite->sBank == GetBankByIdentity(B_POSITION_PLAYER_RIGHT))
sprite->callback = SpriteCB_ReleaseMon2FromBall; sprite->callback = SpriteCB_ReleaseMon2FromBall;
else else
sprite->callback = SpriteCB_ReleaseMonFromBall; sprite->callback = SpriteCB_ReleaseMonFromBall;
@ -982,7 +982,7 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite)
{ {
sprite->data[0] = 0; sprite->data[0] = 0;
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1 if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
&& sprite->sBank == GetBankByIdentity(IDENTITY_OPPONENT_MON2)) && sprite->sBank == GetBankByIdentity(B_POSITION_OPPONENT_RIGHT))
sprite->callback = SpriteCB_ReleaseMon2FromBall; sprite->callback = SpriteCB_ReleaseMon2FromBall;
else else
sprite->callback = SpriteCB_ReleaseMonFromBall; sprite->callback = SpriteCB_ReleaseMonFromBall;
@ -1198,7 +1198,7 @@ void sub_8076918(u8 bank)
healthboxSprite->pos2.y = -healthboxSprite->pos2.y; healthboxSprite->pos2.y = -healthboxSprite->pos2.y;
} }
gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]); gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]);
if (GetBankIdentity(bank) == IDENTITY_PLAYER_MON2) if (GetBankPosition(bank) == B_POSITION_PLAYER_RIGHT)
healthboxSprite->callback = sub_80769A8; healthboxSprite->callback = sub_80769A8;
} }

View File

@ -36,7 +36,7 @@ extern const u8 gText_EggNickname[];
extern u8 GetBankSide(u8 bank); extern u8 GetBankSide(u8 bank);
extern u8 GetBankByIdentity(u8 bank); extern u8 GetBankByIdentity(u8 bank);
extern u8 GetBankIdentity(u8 bank); extern u8 GetBankPosition(u8 bank);
u8 CountAliveMonsInBattle(u8 caseId) u8 CountAliveMonsInBattle(u8 caseId)
{ {
@ -86,7 +86,7 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 bank)
u8 GetDefaultMoveTarget(u8 bank) u8 GetDefaultMoveTarget(u8 bank)
{ {
u8 status = GetBankIdentity(bank) & 1; u8 status = GetBankPosition(bank) & 1;
status ^= 1; status ^= 1;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))

View File

@ -42,7 +42,7 @@ extern u8 GetBankSpriteDefault_Y(u8 bank);
extern u8 sub_80A82E4(u8 bank); extern u8 sub_80A82E4(u8 bank);
extern void sub_806A068(u16 species, u8 bankIdentity); extern void sub_806A068(u16 species, u8 bankIdentity);
extern void sub_806A12C(u16 backPicId, u8 bankIdentity); extern void sub_806A12C(u16 backPicId, u8 bankIdentity);
extern u8 GetBankPosition(u8 bank, u8 caseId); extern u8 GetBankCoord(u8 bank, u8 caseId);
// this file's functions // this file's functions
static void CB2_ReshowBattleScreenAfterMenu(void); static void CB2_ReshowBattleScreenAfterMenu(void);
@ -164,13 +164,13 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
LoadAndCreateEnemyShadowSprites(); LoadAndCreateEnemyShadowSprites();
opponentBank = GetBankByIdentity(IDENTITY_OPPONENT_MON1); opponentBank = GetBankByIdentity(B_POSITION_OPPONENT_LEFT);
species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES); species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES);
SetBankEnemyShadowSpriteCallback(opponentBank, species); SetBankEnemyShadowSpriteCallback(opponentBank, species);
if (IsDoubleBattle()) if (IsDoubleBattle())
{ {
opponentBank = GetBankByIdentity(IDENTITY_OPPONENT_MON2); opponentBank = GetBankByIdentity(B_POSITION_OPPONENT_RIGHT);
species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES); species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES);
SetBankEnemyShadowSpriteCallback(opponentBank, species); SetBankEnemyShadowSpriteCallback(opponentBank, species);
} }
@ -259,8 +259,8 @@ static void CreateBankSprite(u8 bank)
if (GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_HP) == 0) if (GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_HP) == 0)
return; return;
sub_806A068(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankIdentity(bank)); sub_806A068(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankPosition(bank, 2), posY, sub_80A82E4(bank)); gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankCoord(bank, 2), posY, sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gBankSpriteIds[bank]].data[0] = bank; gSprites[gBankSpriteIds[bank]].data[0] = bank;
@ -272,7 +272,7 @@ static void CreateBankSprite(u8 bank)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0) else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0)
{ {
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankIdentity(IDENTITY_PLAYER_MON1)); sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankPosition(B_POSITION_PLAYER_LEFT));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50, gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80, (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
sub_80A82E4(0)); sub_80A82E4(0));
@ -282,7 +282,7 @@ static void CreateBankSprite(u8 bank)
} }
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0) else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0)
{ {
sub_806A12C(BACK_PIC_WALLY, GetBankIdentity(0)); sub_806A12C(BACK_PIC_WALLY, GetBankPosition(0));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50, gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50,
(8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords) * 4 + 80, (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords) * 4 + 80,
sub_80A82E4(0)); sub_80A82E4(0));
@ -295,8 +295,8 @@ static void CreateBankSprite(u8 bank)
if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_HP) == 0) if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_HP) == 0)
return; return;
sub_806A068(GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankIdentity(bank)); sub_806A068(GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankPosition(bank, 2), posY, sub_80A82E4(bank)); gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankCoord(bank, 2), posY, sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank; gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy; gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
gSprites[gBankSpriteIds[bank]].data[0] = bank; gSprites[gBankSpriteIds[bank]].data[0] = bank;
@ -335,7 +335,7 @@ static void CreateHealthboxSprite(u8 bank)
else else
UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[gBattlePartyID[bank]], HEALTHBOX_ALL); UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[gBattlePartyID[bank]], HEALTHBOX_ALL);
if (GetBankIdentity(bank) == IDENTITY_OPPONENT_MON2 || GetBankIdentity(bank) == IDENTITY_PLAYER_MON2) if (GetBankPosition(bank) == B_POSITION_OPPONENT_RIGHT || GetBankPosition(bank) == B_POSITION_PLAYER_RIGHT)
DummyBattleInterfaceFunc(gHealthBoxesIds[bank], TRUE); DummyBattleInterfaceFunc(gHealthBoxesIds[bank], TRUE);
else else
DummyBattleInterfaceFunc(gHealthBoxesIds[bank], FALSE); DummyBattleInterfaceFunc(gHealthBoxesIds[bank], FALSE);

View File

@ -282,7 +282,7 @@ gNoOfAllBanks: @ 202406C
gBattlePartyID: @ 202406E gBattlePartyID: @ 202406E
.space 0x8 .space 0x8
gBanksByIdentity: @ 2024076 gBankPositions: @ 2024076
.space 0x4 .space 0x4
gActionsByTurnOrder: @ 202407A gActionsByTurnOrder: @ 202407A