rename bank to battler

This commit is contained in:
camthesaxman 2018-02-05 19:46:59 -06:00
parent 607cba8c2e
commit f78fa6aabf
42 changed files with 6993 additions and 6994 deletions

View File

@ -40,7 +40,7 @@ _080A5C9C:
_080A5CB0:
ldr r4, =gUnknown_08525F58
adds r0, r5, 0
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 22
ldr r1, =gBattleTypeFlags
@ -56,7 +56,7 @@ _080A5CB0:
_080A5CD8:
ldr r4, =gUnknown_08525F58
adds r0, r5, 0
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 22
ldr r1, =gBattleTypeFlags
@ -90,7 +90,7 @@ _080A5D24:
b _080A5D9A
_080A5D28:
adds r0, r5, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A5D60
@ -164,7 +164,7 @@ sub_80A5DB8: @ 80A5DB8
lsls r1, 16
lsrs r5, r1, 16
adds r0, r4, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A5DDA
@ -394,7 +394,7 @@ sub_80A5FA0: @ 80A5FA0
adds r7, r4, 0
movs r5, 0
adds r0, r6, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -445,7 +445,7 @@ sub_80A600C: @ 80A600C
lsls r2, 24
lsrs r7, r2, 24
adds r0, r6, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A6030
@ -476,7 +476,7 @@ _080A603E:
lsrs r4, r0, 16
_080A605C:
adds r0, r6, 0
bl GetBankPosition
bl GetBattlerPosition
ldr r3, =gUnknown_08525F58
lsls r0, 24
lsrs r0, 22
@ -494,7 +494,7 @@ _080A605C:
cmp r7, 0
beq _080A609C
adds r0, r6, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _080A6096
@ -605,7 +605,7 @@ GetSubstituteSpriteDefault_Y: @ 80A614C
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A6170
@ -650,7 +650,7 @@ sub_80A6190: @ 80A6190
cmp r0, 0
bne _080A6238
adds r0, r5, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A61E4
@ -699,7 +699,7 @@ _080A621C:
ldrh r4, [r1, 0x2]
_080A621E:
adds r0, r5, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A6238
@ -1596,7 +1596,7 @@ sub_80A6864: @ 80A6864
.pool
_080A68A4:
ldrb r0, [r7]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A68BC
@ -1806,41 +1806,41 @@ _080A6A04:
.pool
thumb_func_end sub_80A69CC
thumb_func_start GetBankSide
GetBankSide: @ 80A6A30
thumb_func_start GetBattlerSide
GetBattlerSide: @ 80A6A30
lsls r0, 24
lsrs r0, 24
ldr r1, =gBankPositions
ldr r1, =gBattlerPositions
adds r0, r1
ldrb r1, [r0]
movs r0, 0x1
ands r0, r1
bx lr
.pool
thumb_func_end GetBankSide
thumb_func_end GetBattlerSide
thumb_func_start GetBankPosition
GetBankPosition: @ 80A6A44
thumb_func_start GetBattlerPosition
GetBattlerPosition: @ 80A6A44
lsls r0, 24
lsrs r0, 24
ldr r1, =gBankPositions
ldr r1, =gBattlerPositions
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end GetBankPosition
thumb_func_end GetBattlerPosition
thumb_func_start GetBankByPosition
GetBankByPosition: @ 80A6A54
thumb_func_start GetBattlerAtPosition
GetBattlerAtPosition: @ 80A6A54
push {r4,lr}
lsls r0, 24
lsrs r3, r0, 24
movs r1, 0
ldr r0, =gBattleBanksCount
ldr r0, =gBattlersCount
ldrb r2, [r0]
cmp r1, r2
bcs _080A6A7E
ldr r4, =gBankPositions
ldr r4, =gBattlerPositions
ldrb r0, [r4]
cmp r0, r3
beq _080A6A7E
@ -1860,7 +1860,7 @@ _080A6A7E:
pop {r1}
bx r1
.pool
thumb_func_end GetBankByPosition
thumb_func_end GetBattlerAtPosition
thumb_func_start IsBankSpritePresent
IsBankSpritePresent: @ 80A6A90
@ -1883,13 +1883,13 @@ IsBankSpritePresent: @ 80A6A90
b _080A6B18
.pool
_080A6ABC:
ldr r0, =gBankPositions
ldr r0, =gBattlerPositions
adds r0, r4, r0
ldrb r0, [r0]
cmp r0, 0xFF
beq _080A6B18
adds r0, r4, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A6AF0
@ -3496,7 +3496,7 @@ _080A76F2:
cmp r5, 0
beq _080A771A
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
bl IsAnimBankSpriteVisible
@ -3504,7 +3504,7 @@ _080A76F2:
cmp r0, 0
beq _080A771A
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
adds r0, 0x10
@ -3514,7 +3514,7 @@ _080A771A:
cmp r6, 0
beq _080A7746
movs r0, 0x2
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
bl IsAnimBankSpriteVisible
@ -3522,7 +3522,7 @@ _080A771A:
cmp r0, 0
beq _080A7746
movs r0, 0x2
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
@ -3534,7 +3534,7 @@ _080A7746:
cmp r7, 0
beq _080A7772
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
bl IsAnimBankSpriteVisible
@ -3542,7 +3542,7 @@ _080A7746:
cmp r0, 0
beq _080A7772
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
@ -3555,7 +3555,7 @@ _080A7772:
cmp r0, 0
beq _080A77A0
movs r0, 0x3
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
bl IsAnimBankSpriteVisible
@ -3563,7 +3563,7 @@ _080A7772:
cmp r0, 0
beq _080A77A0
movs r0, 0x3
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
@ -3592,7 +3592,7 @@ sub_80A77B4: @ 80A77B4
push {lr}
lsls r0, 24
lsrs r0, 24
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
pop {r1}
@ -3672,7 +3672,7 @@ _080A7842:
bl sub_80A69CC
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A785C
@ -3718,7 +3718,7 @@ sub_80A78AC: @ 80A78AC
bl sub_80A69CC
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A78CC
@ -3811,7 +3811,7 @@ _080A7976:
ldrb r6, [r0]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A798E
@ -4567,7 +4567,7 @@ _080A7F42:
_080A7F78:
lsls r0, r4, 24
lsrs r0, 24
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _080A7FD8
@ -4959,7 +4959,7 @@ _080A825C:
sub_80A8278: @ 80A8278
push {r4-r6,lr}
movs r5, 0
ldr r0, =gBattleBanksCount
ldr r0, =gBattlersCount
ldrb r0, [r0]
cmp r5, r0
bge _080A82D2
@ -4998,7 +4998,7 @@ _080A8286:
strb r2, [r0, 0x5]
_080A82C8:
adds r5, 0x1
ldr r0, =gBattleBanksCount
ldr r0, =gBattlersCount
ldrb r0, [r0]
cmp r5, r0
blt _080A8286
@ -5027,7 +5027,7 @@ _080A82FC:
b _080A8320
_080A8300:
adds r0, r4, 0
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 24
movs r1, 0x1E
@ -5053,7 +5053,7 @@ sub_80A8328: @ 80A8328
push {r4,lr}
lsls r0, 24
lsrs r0, 24
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r4, r0, 24
bl IsContest
@ -5093,7 +5093,7 @@ sub_80A8364: @ 80A8364
cmp r0, 0
bne _080A838A
adds r0, r4, 0
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 24
cmp r0, 0
@ -5486,7 +5486,7 @@ _080A86AC:
.pool
_080A86C4:
mov r0, r8
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _080A8790
@ -5943,7 +5943,7 @@ sub_80A8A6C: @ 80A8A6C
bl sub_80A6838
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A8AAC
@ -6000,7 +6000,7 @@ sub_80A8AEC: @ 80A8AEC
adds r4, r0, 0
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A8B1C
@ -6056,7 +6056,7 @@ sub_80A8B64: @ 80A8B64
bl sub_80A6838
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080A8B90
@ -6108,7 +6108,7 @@ sub_80A8BC4: @ 80A8BC4
strh r0, [r5, 0x8]
ldr r7, =gAnimBankAttacker
ldrb r0, [r7]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
movs r1, 0x8
cmp r0, 0
@ -6403,7 +6403,7 @@ sub_80A8E30: @ 80A8E30
lsrs r0, 24
strh r0, [r5, 0x22]
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _080A8E68
@ -6489,7 +6489,7 @@ sub_80A8EE4: @ 80A8EE4
strh r0, [r4, 0x36]
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _080A8F24

View File

@ -200,7 +200,7 @@ _080D5320:
_080D5324:
movs r0, 0x3
_080D5326:
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r4, r0, 24
adds r0, r4, 0
@ -844,7 +844,7 @@ sub_80D5830: @ 80D5830
lsrs r4, r0, 24
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D584C
@ -873,7 +873,7 @@ sub_80D5860: @ 80D5860
strb r0, [r2]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D5890
@ -1144,7 +1144,7 @@ _080D5AB2:
adds r0, r2, r0
ldrb r6, [r0]
adds r0, r2, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D5ADC
@ -1229,7 +1229,7 @@ _080D5B72:
adds r0, r1, r0
ldrb r7, [r0]
adds r0, r1, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D5B9C
@ -1340,7 +1340,7 @@ sub_80D5C50: @ 80D5C50
lsrs r7, r0, 16
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D5C82
@ -1551,7 +1551,7 @@ _080D5E18:
strh r2, [r5, 0x8]
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D5E44
@ -1624,7 +1624,7 @@ sub_80D5EB8: @ 80D5EB8
lsrs r5, r0, 24
ldr r6, =gAnimBankAttacker
ldrb r0, [r6]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D5ED4
@ -1722,7 +1722,7 @@ sub_80D5F3C: @ 80D5F3C
.pool
_080D5F94:
ldrb r0, [r4, 0x12]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _080D5FBC
@ -2002,7 +2002,7 @@ _080D61C8:
ldr r0, =gAnimBankTarget
_080D61CA:
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
movs r1, 0
lsls r0, 24
cmp r0, 0
@ -2083,7 +2083,7 @@ _080D6274:
ldr r0, =gAnimBankTarget
_080D6276:
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080D6288

File diff suppressed because it is too large Load Diff

View File

@ -778,7 +778,7 @@ sub_815A6C4: @ 815A6C4
bl sub_80A8924
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815A6F8
@ -921,7 +921,7 @@ sub_815A7EC: @ 815A7EC
bne _0815A840
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815A830
@ -1019,7 +1019,7 @@ sub_815A8C8: @ 815A8C8
lsrs r4, r0, 24
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -2484,7 +2484,7 @@ sub_815B49C: @ 815B49C
adds r4, r0, 0
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815B4BC
@ -2515,7 +2515,7 @@ sub_815B4D4: @ 815B4D4
strh r0, [r4, 0x2E]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815B4F8
@ -3020,7 +3020,7 @@ _0815B8A8:
.pool
_0815B8E0:
ldrb r0, [r5]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r1, r0, 24
_0815B8EA:
@ -3234,7 +3234,7 @@ _0815BAB6:
bne _0815BAF6
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -3392,7 +3392,7 @@ _0815BC02:
_0815BC34:
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815BC58
@ -3998,7 +3998,7 @@ _0815C124:
_0815C15C:
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r4, r0, 24
bl IsDoubleBattle
@ -4087,7 +4087,7 @@ _0815C224:
strh r0, [r5, 0xE]
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -4327,7 +4327,7 @@ _0815C41E:
strh r0, [r4, 0x32]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815C450
@ -4434,7 +4434,7 @@ _0815C508:
ldr r0, =gAnimBankTarget
_0815C50A:
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -4645,7 +4645,7 @@ sub_815C6B0: @ 815C6B0
adds r4, r0, 0
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0
@ -4685,7 +4685,7 @@ sub_815C700: @ 815C700
strh r0, [r4, 0x2E]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815C744
@ -5172,7 +5172,7 @@ _0815CAD2:
cmp r0, 0
bne _0815CAF8
ldrb r0, [r6, 0x1E]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsls r2, r5, 4
cmp r0, 0
@ -5695,7 +5695,7 @@ sub_815CED8: @ 815CED8
_0815CF18:
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815CFC4
@ -5733,7 +5733,7 @@ _0815CF18:
cmp r0, 0
bne _0815CFBC
adds r0, r2, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815CF9C
@ -5801,7 +5801,7 @@ _0815CFC4:
cmp r0, 0
bne _0815D054
adds r0, r2, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815D03C
@ -6093,7 +6093,7 @@ _0815D26E:
movs r0, 0x18
strh r0, [r4, 0x18]
adds r0, r5, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -6829,7 +6829,7 @@ sub_815D870: @ 815D870
bl StartSpriteAffineAnim
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815D896
@ -7261,7 +7261,7 @@ sub_815DB90: @ 815DB90
strh r0, [r4, 0x14]
_0815DBD4:
ldrb r0, [r2]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815DC04
@ -7777,7 +7777,7 @@ sub_815E01C: @ 815E01C
adds r5, r0, 0
ldr r6, =gAnimBankAttacker
ldrb r0, [r6]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -7839,7 +7839,7 @@ _0815E09A:
_0815E0A8:
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815E0C8
@ -7925,7 +7925,7 @@ _0815E144:
_0815E14E:
ldr r5, =gAnimBankAttacker
ldrb r0, [r5]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815E188
@ -8451,7 +8451,7 @@ _0815E4EE:
bl sub_80A68D4
mov r1, r10
ldrb r0, [r1]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -9365,7 +9365,7 @@ _0815ECAC:
_0815ECB4:
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815ECD0
@ -9617,7 +9617,7 @@ _0815EEAA:
ldrh r0, [r4, 0x3C]
lsls r0, 24
lsrs r0, 24
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -9999,7 +9999,7 @@ sub_815F18C: @ 815F18C
movs r1, 0x3
bl GetBankCoord
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _0815F1B8
@ -10362,7 +10362,7 @@ sub_815F48C: @ 815F48C
adds r5, r0, 0
ldr r4, =gAnimBankTarget
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815F4B8
@ -10960,7 +10960,7 @@ _0815F940:
strh r0, [r6, 0xA]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
mov r9, r4
cmp r0, 0
@ -11047,7 +11047,7 @@ _0815F9F4:
_0815FA28:
ldr r4, =gAnimBankAttacker
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815FAC8
@ -11255,7 +11255,7 @@ _0815FBE8:
strh r0, [r6, 0xA]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
mov r9, r4
cmp r0, 0
@ -11309,7 +11309,7 @@ _0815FC56:
bne _0815FCD6
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815FCB4
@ -11385,7 +11385,7 @@ _0815FD08:
bl sub_80A8610
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
mov r9, r4
cmp r0, 0
@ -11444,7 +11444,7 @@ _0815FD8C:
mov r10, r0
ldrb r0, [r0]
str r2, [sp, 0x18]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
mov r9, r4
ldr r2, [sp, 0x18]
@ -11585,7 +11585,7 @@ _0815FE92:
strb r0, [r2]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -11654,7 +11654,7 @@ _0815FF6E:
strh r0, [r4, 0x32]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0815FF9C
@ -11900,7 +11900,7 @@ sub_8160164: @ 8160164
strh r0, [r4, 0xE]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
movs r2, 0x1
negs r2, r2
@ -12074,7 +12074,7 @@ sub_81602E0: @ 81602E0
adds r4, r0, 0
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
ldrh r0, [r4, 0x2E]
ldrh r1, [r4, 0x30]
@ -12117,7 +12117,7 @@ sub_8160338: @ 8160338
adds r4, r0, 0
ldr r0, =gAnimBankTarget
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0816037C

View File

@ -857,7 +857,7 @@ sub_8170BB0: @ 8170BB0
adds r1, r0, r1
ldrb r1, [r1]
mov r9, r1
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _08170BF8
@ -1283,7 +1283,7 @@ _08170F54:
lsls r4, 24
lsrs r4, 24
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
bl sub_80A82E4
@ -1335,7 +1335,7 @@ _08170F54:
ldr r0, =SpriteCallbackDummy
str r0, [r4]
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
ldr r1, =gBankSpriteIds
lsls r0, 24
lsrs r0, 24
@ -1371,7 +1371,7 @@ sub_8171030: @ 8171030
lsrs r5, r0, 24
ldr r6, =gSprites
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
ldr r1, =gBankSpriteIds
lsls r0, 24
lsrs r0, 24
@ -1422,7 +1422,7 @@ sub_81710A8: @ 81710A8
lsrs r5, r0, 24
ldr r6, =gSprites
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
ldr r4, =gBankSpriteIds
lsls r0, 24
lsrs r0, 24
@ -1438,7 +1438,7 @@ sub_81710A8: @ 81710A8
cmp r0, 0
bge _081710F4
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
adds r0, r4
@ -4764,7 +4764,7 @@ _08172C36:
adds r0, r4
strh r0, [r5, 0x8]
ldrb r0, [r3]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08172C78
@ -4838,7 +4838,7 @@ _08172CDA:
adds r0, r2
strh r0, [r5, 0x8]
ldrb r0, [r3]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08172D10
@ -4879,7 +4879,7 @@ _08172D28:
strh r1, [r0, 0x8]
ldr r0, =gAnimBankAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0
@ -5347,7 +5347,7 @@ _08173118:
cmp r0, 0
bne _08173160
mov r0, r8
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
movs r1, 0x3F
cmp r0, 0
@ -5575,7 +5575,7 @@ sub_817330C: @ 817330C
movs r0, 0x1E
strh r0, [r4, 0x2E]
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
movs r1, 0
@ -5587,7 +5587,7 @@ sub_817330C: @ 817330C
adds r0, r1
strh r0, [r4, 0x32]
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
@ -5732,7 +5732,7 @@ sub_817345C: @ 817345C
.pool
_08173478:
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
ldr r1, =gAnimBankAttacker
strb r0, [r1]
movs r0, 0x1
@ -5740,12 +5740,12 @@ _08173478:
.pool
_0817348C:
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
ldr r1, =gAnimBankAttacker
strb r0, [r1]
movs r0, 0
_08173498:
bl GetBankByPosition
bl GetBattlerAtPosition
ldr r1, =gAnimBankTarget
strb r0, [r1]
_081734A0:

View File

@ -379,7 +379,7 @@ _08158E1E:
.pool
_08158E38:
adds r0, r4, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08158E5C
@ -504,7 +504,7 @@ _08158F2E:
.pool
_08158F48:
adds r0, r4, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _08158F6C

View File

@ -34,26 +34,26 @@ _0817C988:
movs r1, 0x81
lsls r1, 2
adds r7, r0, r1
ldr r5, =gBankAttacker
ldr r5, =gBattleAttacker
ldrb r0, [r5]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r6, r0, 24
ldr r0, =gEffectBank
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
mov r9, r0
ldr r0, =gStringInfo
ldr r0, [r0]
ldrb r0, [r0, 0x7]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4]
@ -83,7 +83,7 @@ _0817CA10:
str r1, [sp, 0x8]
cmp r6, 0
bne _0817CA3C
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
lsls r0, 1
adds r0, r2
@ -94,7 +94,7 @@ _0817CA10:
b _0817CA4C
.pool
_0817CA3C:
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
lsls r0, 1
adds r0, r2
@ -105,7 +105,7 @@ _0817CA3C:
_0817CA4C:
adds r1, r0
str r1, [sp, 0xC]
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
ldr r1, =gStringInfo
ldr r1, [r1]
@ -134,20 +134,20 @@ _0817CA4C:
bl _0817E0A2
.pool
_0817CA9C:
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 25
mov r8, r0
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r5, r0, 25
ldr r0, =gEffectBank
ldrb r0, [r0]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r3, r0, 25
ldr r1, [sp]
@ -572,7 +572,7 @@ _0817D0DC:
lsls r3, 2
adds r3, r7, r3
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -602,7 +602,7 @@ _0817D124:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -635,7 +635,7 @@ _0817D16C:
lsls r0, 2
adds r5, r7, r0
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -716,7 +716,7 @@ _0817D216:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -776,7 +776,7 @@ _0817D296:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -834,7 +834,7 @@ _0817D314:
adds r3, r0
adds r3, r7, r3
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -940,8 +940,8 @@ _0817D3F2:
bne _0817D3FE
bl _0817E0A6
_0817D3FE:
ldr r0, =gBankAttacker
ldr r1, =gBankDefender
ldr r0, =gBattleAttacker
ldr r1, =gBattleDefender
ldrb r0, [r0]
ldrb r1, [r1]
cmp r0, r1
@ -1015,7 +1015,7 @@ _0817D498:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1092,7 +1092,7 @@ _0817D53C:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1162,7 +1162,7 @@ _0817D5CE:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1227,7 +1227,7 @@ _0817D65E:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1314,7 +1314,7 @@ _0817D704:
lsls r4, 3
adds r2, r4
adds r2, r7, r2
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
@ -1354,7 +1354,7 @@ _0817D76C:
bl _0817E0A6
_0817D77E:
ldr r6, =gBattlePartyID
ldr r5, =gBankAttacker
ldr r5, =gBattleAttacker
ldrb r0, [r5]
lsls r0, 1
adds r0, r6
@ -1408,7 +1408,7 @@ _0817D7D8:
lsls r4, 3
adds r2, r4
adds r2, r7, r2
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
@ -1452,7 +1452,7 @@ _0817D838:
lsls r4, 3
adds r2, r4
adds r2, r7, r2
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
@ -1498,7 +1498,7 @@ _0817D8A4:
_0817D8B6:
ldr r2, =gBattlePartyID
mov r8, r2
ldr r6, =gBankAttacker
ldr r6, =gBattleAttacker
ldrb r0, [r6]
lsls r0, 1
add r0, r8
@ -1574,7 +1574,7 @@ _0817D94C:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1640,7 +1640,7 @@ _0817D9C2:
lsls r4, 3
adds r2, r4
adds r2, r7, r2
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
@ -1672,7 +1672,7 @@ _0817D9C2:
.pool
_0817DA24:
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1715,7 +1715,7 @@ _0817DA68:
lsls r4, 3
adds r2, r4
adds r2, r7, r2
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
@ -1748,7 +1748,7 @@ _0817DA68:
.pool
_0817DACC:
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1803,7 +1803,7 @@ _0817DB24:
lsls r4, 3
adds r3, r4
adds r3, r7, r3
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r5
@ -1839,7 +1839,7 @@ _0817DB76:
.pool
_0817DB90:
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1876,7 +1876,7 @@ _0817DBD4:
adds r3, r0
adds r3, r7, r3
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -1944,7 +1944,7 @@ _0817DC62:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2022,7 +2022,7 @@ _0817DCFC:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2050,7 +2050,7 @@ _0817DD38:
adds r2, r0
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2122,7 +2122,7 @@ _0817DDC8:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2155,7 +2155,7 @@ _0817DE10:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2254,7 +2254,7 @@ _0817DEDC:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2332,7 +2332,7 @@ _0817DF70:
lsls r2, 2
adds r2, r7, r2
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2414,7 +2414,7 @@ _0817DFE6:
ands r0, r2
strb r0, [r1]
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -2557,16 +2557,16 @@ _0817E122:
lsls r1, 2
adds r1, r0, r1
str r1, [sp, 0x8]
ldr r2, =gBankAttacker
ldr r2, =gBattleAttacker
mov r10, r2
ldrb r0, [r2]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
mov r9, r0
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r4, r0, 24
mov r1, r10
@ -2593,7 +2593,7 @@ _0817E122:
_0817E184:
mov r2, r10
ldrb r0, [r2]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 25
lsls r0, 3
@ -2617,7 +2617,7 @@ _0817E184:
strb r1, [r0]
mov r1, r10
ldrb r0, [r1]
bl GetBankPosition
bl GetBattlerPosition
lsls r0, 24
lsrs r0, 25
lsls r0, 3
@ -2812,9 +2812,9 @@ sub_817E32C: @ 817E32C
movs r1, 0x81
lsls r1, 2
adds r4, r0, r1
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r2, r0, 24
cmp r5, 0x12
@ -3244,14 +3244,14 @@ sub_817E684: @ 817E684
movs r2, 0x81
lsls r2, 2
adds r7, r0, r2
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r3, r0, 24
mov r0, r10
@ -3298,7 +3298,7 @@ _0817E6F0:
.4byte _0817E760
_0817E760:
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -3330,7 +3330,7 @@ _0817E79C:
lsls r2, r0, 4
ldr r4, =0x0000ffff
ldr r1, [r1]
ldr r3, =gBankAttacker
ldr r3, =gBattleAttacker
ldrh r0, [r1]
cmp r6, r0
bne _0817E7E0
@ -3708,15 +3708,15 @@ sub_817EA80: @ 817EA80
movs r1, 0x81
lsls r1, 2
adds r5, r0, r1
ldr r3, =gBankAttacker
ldr r3, =gBattleAttacker
mov r8, r3
ldrb r0, [r3]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r2, r0, 24
lsls r0, r4, 1
@ -4006,7 +4006,7 @@ _0817ECCC:
lsrs r0, 5
subs r6, r0, 0x1
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -4165,7 +4165,7 @@ _0817EE1C:
bne _0817EEBC
adds r2, r4, 0
ldr r1, =gBattlePartyID
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
lsls r0, 1
adds r0, r1
@ -4269,9 +4269,9 @@ sub_817EECC: @ 817EECC
beq _0817EEE6
b _0817F1FA
_0817EEE6:
ldr r4, =gBankAttacker
ldr r4, =gBattleAttacker
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -4291,7 +4291,7 @@ _0817EEF8:
bgt _0817EF10
b _0817F1FA
_0817EF10:
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
muls r0, r1
adds r0, r5
@ -4367,7 +4367,7 @@ _0817EF8A:
beq _0817EF98
b _0817F1FA
_0817EF98:
ldr r2, =gBankAttacker
ldr r2, =gBattleAttacker
ldrb r0, [r2]
adds r0, r6
ldrb r0, [r0]
@ -4386,11 +4386,11 @@ _0817EF98:
mov r10, r3
mov r8, r0
add r7, sp, 0x10
ldr r4, =gBankDefender
ldr r4, =gBattleDefender
mov r9, r4
_0817EFC2:
lsls r1, r5, 1
ldr r6, =gBankAttacker
ldr r6, =gBattleAttacker
ldrb r0, [r6]
movs r2, 0x58
muls r0, r2
@ -4414,13 +4414,13 @@ _0817EFC2:
ldr r4, =gSideStatuses
mov r1, r9
ldrb r0, [r1]
bl GetBankPosition
bl GetBattlerPosition
movs r1, 0x1
ands r1, r0
lsls r1, 1
adds r1, r4
ldrh r3, [r1]
ldr r2, =gBankAttacker
ldr r2, =gBattleAttacker
ldrb r0, [r2]
movs r4, 0x58
muls r0, r4
@ -4437,7 +4437,7 @@ _0817EFC2:
str r4, [sp]
movs r4, 0
str r4, [sp, 0x4]
ldr r6, =gBankAttacker
ldr r6, =gBattleAttacker
ldrb r4, [r6]
str r4, [sp, 0x8]
mov r6, r9
@ -4448,7 +4448,7 @@ _0817EFC2:
ldr r4, =gBattleMoveDamage
str r3, [r4]
ldr r1, =gStatuses3
ldr r2, =gBankAttacker
ldr r2, =gBattleAttacker
ldrb r0, [r2]
lsls r0, 2
adds r0, r1
@ -4472,7 +4472,7 @@ _0817EFC2:
str r0, [r4]
_0817F06A:
ldr r0, =gProtectStructs
ldr r6, =gBankAttacker
ldr r6, =gBattleAttacker
ldrb r1, [r6]
lsls r1, 4
adds r1, r0
@ -4513,7 +4513,7 @@ _0817F0B4:
cmp r5, 0x3
ble _0817EFC2
movs r5, 0
ldr r3, =gBankAttacker
ldr r3, =gBattleAttacker
ldr r6, =gMoveSelectionCursor
ldr r4, =gBattlePartyID
mov r8, r4
@ -4545,9 +4545,9 @@ _0817F0D8:
movs r7, 0
_0817F0F6:
movs r5, 0
ldr r4, =gBankDefender
ldr r4, =gBattleDefender
ldr r6, =gEnemyParty
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
add r0, r10
ldrb r3, [r0]
@ -4582,7 +4582,7 @@ _0817F11A:
adds r6, r0, 0
lsls r6, 16
lsrs r6, 16
ldr r2, =gBankAttacker
ldr r2, =gBattleAttacker
ldrb r0, [r2]
lsls r0, 1
add r0, r8
@ -4598,7 +4598,7 @@ _0817F11A:
adds r1, r0, 0
lsls r1, 16
lsrs r1, 16
ldr r4, =gBankAttacker
ldr r4, =gBattleAttacker
ldrb r3, [r4]
mov r2, r10
adds r0, r3, r2
@ -4625,7 +4625,7 @@ _0817F1D4:
_0817F1DC:
ldr r2, =gBattleMoveDamage
ldr r1, =gMoveSelectionCursor
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
adds r0, r1
ldrb r0, [r0]
@ -4695,7 +4695,7 @@ _0817F270:
cmp r2, 0x95
bne _0817F294
ldr r2, =gBattleMons
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r1, [r0]
movs r0, 0x58
muls r0, r1
@ -4801,7 +4801,7 @@ GetBankMoveSlotId: @ 817F33C
lsls r1, 16
lsrs r7, r1, 16
adds r0, r5, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
ldr r6, =gEnemyParty
cmp r0, 0

View File

@ -1048,7 +1048,7 @@ _080D8004:
bl sub_80DC594
bl sub_80DC5E8
bl sub_80DC7EC
ldr r1, =gBankPositions
ldr r1, =gBattlerPositions
strb r4, [r1]
movs r0, 0x1
strb r0, [r1, 0x1]
@ -1058,9 +1058,9 @@ _080D8004:
strb r2, [r1, 0x3]
ldr r0, =gBattleTypeFlags
str r4, [r0]
ldr r4, =gBankAttacker
ldr r4, =gBattleAttacker
strb r2, [r4]
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
strb r3, [r0]
bl sub_80DB0C4
ldr r2, =gBankSpriteIds
@ -2548,7 +2548,7 @@ _080D8DD0:
adds r4, r0
strh r5, [r4, 0xC]
ldr r1, =gBankSpriteIds
ldr r0, =gBankAttacker
ldr r0, =gBattleAttacker
ldrb r0, [r0]
adds r0, r1
strb r5, [r0]
@ -13798,7 +13798,7 @@ sub_80DEA20: @ 80DEA20
bl CreateInvisibleSpriteWithCallback
ldr r1, =gBankSpriteIds
strb r0, [r1, 0x3]
ldr r0, =gBankDefender
ldr r0, =gBattleDefender
ldrb r0, [r0]
adds r0, r1
ldrb r1, [r0]
@ -13905,12 +13905,12 @@ _080DEAD0:
.4byte _080DEB60
.4byte _080DEB60
_080DEB54:
ldr r1, =gBankDefender
ldr r1, =gBattleDefender
movs r0, 0x2
b _080DEB64
.pool
_080DEB60:
ldr r1, =gBankDefender
ldr r1, =gBattleDefender
movs r0, 0x3
_080DEB64:
strb r0, [r1]

View File

@ -16041,7 +16041,7 @@ _081B8AF8:
b _081B8B24
_081B8AFC:
adds r0, r4, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _081B8B1E
@ -16060,7 +16060,7 @@ _081B8B1E:
lsls r0, 24
lsrs r4, r0, 24
_081B8B24:
ldr r0, =gBattleBanksCount
ldr r0, =gBattlersCount
ldrb r0, [r0]
cmp r4, r0
bcc _081B8AFC
@ -16228,7 +16228,7 @@ _081B8CBE:
bne _081B8CFC
movs r5, 0x1
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
mov r2, sp
ldr r1, =gBattlePartyID
lsls r0, 24
@ -16255,7 +16255,7 @@ _081B8CF0:
_081B8CFC:
movs r5, 0x2
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
mov r1, sp
ldr r4, =gBattlePartyID
lsls r0, 24
@ -16264,7 +16264,7 @@ _081B8CFC:
ldrh r0, [r0]
strb r0, [r1]
movs r0, 0x2
bl GetBankByPosition
bl GetBattlerAtPosition
mov r1, sp
lsls r0, 24
lsrs r0, 23
@ -16339,24 +16339,24 @@ sub_81B8D88: @ 81B8D88
lsrs r7, r1, 24
lsls r0, 24
lsrs r0, 24
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _081B8DB0
movs r0, 0
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r4, r0, 24
movs r0, 0x2
b _081B8DBC
_081B8DB0:
movs r0, 0x1
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r4, r0, 24
movs r0, 0x3
_081B8DBC:
bl GetBankByPosition
bl GetBattlerAtPosition
lsls r0, 24
lsrs r6, r0, 24
bl sub_81B1250

View File

@ -581,7 +581,7 @@ _080689E4:
beq _080689CE
_080689F4:
adds r0, r5, 0
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
beq _080689CE

View File

@ -114,17 +114,17 @@ _0806BDC4:
lsrs r1, r0, 24
cmp r1, 0
beq _0806BE64
ldr r0, =gActiveBank
ldr r0, =gActiveBattler
strb r2, [r0]
ldrb r0, [r0]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
negs r1, r0
orrs r1, r0
lsrs r1, 31
str r1, [sp, 0x1C]
ldr r0, =gBattleBanksCount
ldr r0, =gBattlersCount
ldr r4, [sp, 0xC]
subs r4, 0xD
ldrb r0, [r0]
@ -148,7 +148,7 @@ _0806BE3C:
ldr r1, [sp, 0x1C]
adds r1, 0x2
str r1, [sp, 0x1C]
ldr r0, =gBattleBanksCount
ldr r0, =gBattlersCount
ldrb r0, [r0]
cmp r1, r0
bge _0806BE70
@ -165,7 +165,7 @@ _0806BE3C:
b _0806BE70
.pool
_0806BE64:
ldr r0, =gActiveBank
ldr r0, =gActiveBattler
strb r1, [r0]
movs r3, 0x4
str r3, [sp, 0x38]
@ -200,7 +200,7 @@ _0806BE9A:
ands r0, r1
cmp r0, 0
beq _0806BECC
ldr r0, =gActiveBank
ldr r0, =gActiveBattler
ldrb r1, [r0]
lsls r0, r1, 3
subs r0, r1
@ -297,7 +297,7 @@ _0806BF76:
cmp r0, 0
beq _0806BFA4
ldr r1, =gBattleMons
ldr r0, =gActiveBank
ldr r0, =gActiveBattler
ldrb r2, [r0]
movs r0, 0x58
muls r0, r2
@ -323,7 +323,7 @@ _0806BFA4:
bl _0806CD4C
_0806BFB2:
ldr r6, =gBattleMons
ldr r5, =gActiveBank
ldr r5, =gActiveBattler
ldrb r0, [r5]
movs r4, 0x58
muls r0, r4
@ -362,7 +362,7 @@ _0806BFFC:
cmp r3, 0
beq _0806C042
ldr r7, =gBattleMons
ldr r5, =gActiveBank
ldr r5, =gActiveBattler
ldrb r0, [r5]
movs r4, 0x58
muls r0, r4
@ -396,7 +396,7 @@ _0806C042:
bl _0806CD4C
_0806C050:
ldr r6, =gBattleMons
ldr r5, =gActiveBank
ldr r5, =gActiveBattler
ldrb r0, [r5]
movs r4, 0x58
muls r0, r4
@ -433,7 +433,7 @@ _0806C08C:
cmp r3, 0
beq _0806C0D2
ldr r7, =gBattleMons
ldr r5, =gActiveBank
ldr r5, =gActiveBattler
ldrb r0, [r5]
movs r4, 0x58
muls r0, r4
@ -467,7 +467,7 @@ _0806C0D2:
bl _0806CD4C
_0806C0E0:
ldr r6, =gBattleMons
ldr r5, =gActiveBank
ldr r5, =gActiveBattler
ldrb r0, [r5]
movs r4, 0x58
muls r0, r4
@ -506,9 +506,9 @@ _0806C120:
cmp r0, 0
beq _0806C168
ldr r5, =gSideTimers
ldr r4, =gActiveBank
ldr r4, =gActiveBattler
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 1
@ -519,7 +519,7 @@ _0806C120:
cmp r0, 0
bne _0806C168
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 1
@ -965,7 +965,7 @@ _0806C4FC:
ldr r3, [sp, 0x38]
cmp r3, 0x4
beq _0806C55C
ldr r2, =gAbsentBankFlags
ldr r2, =gAbsentBattlerFlags
ldr r1, =gBitTable
lsls r0, r3, 2
adds r0, r1
@ -983,14 +983,14 @@ _0806C4FC:
lsrs r1, 24
ldr r0, [sp, 0x38]
bl CopyPlayerPartyMonToBattleData
ldr r0, =gActiveBank
ldr r0, =gActiveBattler
ldrb r0, [r0]
b _0806C574
.pool
_0806C55C:
ldr r3, =gAbsentBankFlags
ldr r3, =gAbsentBattlerFlags
ldr r1, =gBitTable
ldr r2, =gActiveBank
ldr r2, =gActiveBattler
ldrb r0, [r2]
eors r0, r4
lsls r0, 2
@ -1001,7 +1001,7 @@ _0806C55C:
strb r0, [r3]
ldrb r0, [r2]
_0806C574:
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0806C5B2
@ -1135,9 +1135,9 @@ _0806C65E:
ands r0, r3
cmp r0, 0
bne _0806C6EC
ldr r4, =gActiveBank
ldr r4, =gActiveBattler
ldrb r0, [r4]
bl GetBankSide
bl GetBattlerSide
lsls r0, 24
cmp r0, 0
bne _0806C6EC

View File

@ -735,7 +735,7 @@ BattleScript_AlreadyPoisoned::
goto BattleScript_MoveEnd
BattleScript_ImmunityProtected::
copybyte gEffectBank, gBankDefender
copybyte gEffectBank, gBattleDefender
setbyte cMULTISTRING_CHOOSER, 0x0
call BattleScript_PSNPrevention
goto BattleScript_MoveEnd
@ -1055,7 +1055,7 @@ BattleScript_AlreadyParalyzed::
goto BattleScript_MoveEnd
BattleScript_LimberProtected::
copybyte gEffectBank, gBankDefender
copybyte gEffectBank, gBattleDefender
setbyte cMULTISTRING_CHOOSER, 0x0
call BattleScript_PRLZPrevention
goto BattleScript_MoveEnd
@ -1513,7 +1513,7 @@ BattleScript_EffectCurse::
jumpifstat ATTACKER, NOT_EQUAL, ATK, 0xC, BattleScript_CurseTrySpeed
jumpifstat ATTACKER, EQUAL, DEF, 0xC, BattleScript_ButItFailed
BattleScript_CurseTrySpeed::
copybyte gBankDefender, gBankAttacker
copybyte gBattleDefender, gBattleAttacker
setbyte sANIM_TURN, 0x1
attackanimation
waitanimation
@ -1534,7 +1534,7 @@ BattleScript_CurseTryDefence::
BattleScript_CurseEnd::
goto BattleScript_MoveEnd
BattleScript_GhostCurse::
jumpifbytenotequal gBankAttacker, gBankDefender, BattleScript_DoGhostCurse
jumpifbytenotequal gBattleAttacker, gBattleDefender, BattleScript_DoGhostCurse
getmovetarget ATTACKER
BattleScript_DoGhostCurse::
attackcanceler
@ -1603,7 +1603,7 @@ BattleScript_PerishSongLoop::
jumpifability SCRIPTING_BANK, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected
BattleScript_PerishSongLoopIncrement::
addbyte sBANK, 0x1
jumpifbytenotequal sBANK, gBattleBanksCount, BattleScript_PerishSongLoop
jumpifbytenotequal sBANK, gBattlersCount, BattleScript_PerishSongLoop
goto BattleScript_MoveEnd
BattleScript_PerishSongNotAffected::
@ -2217,7 +2217,7 @@ BattleScript_EffectWillOWisp::
goto BattleScript_MoveEnd
BattleScript_WaterVeilPrevents::
copybyte gEffectBank, gBankDefender
copybyte gEffectBank, gBattleDefender
setbyte cMULTISTRING_CHOOSER, 0x0
call BattleScript_BRNPrevention
goto BattleScript_MoveEnd
@ -2598,11 +2598,11 @@ BattleScript_EffectTeeterDance::
attackcanceler
attackstring
ppreduce
setbyte gBankDefender, 0x0
setbyte gBattleDefender, 0x0
BattleScript_TeeterDanceLoop::
movevaluescleanup
setmoveeffect EFFECT_CONFUSION
jumpifbyteequal gBankAttacker, gBankDefender, BattleScript_TeeterDanceLoopIncrement
jumpifbyteequal gBattleAttacker, gBattleDefender, BattleScript_TeeterDanceLoopIncrement
jumpifability TARGET, ABILITY_OWN_TEMPO, BattleScript_TeeterDanceOwnTempoPrevents
jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_TeeterDanceSubstitutePrevents
jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_TeeterDanceAlreadyConfused
@ -2618,8 +2618,8 @@ BattleScript_TeeterDanceDoMoveEndIncrement::
setbyte sMOVEEND_STATE, 0x0
moveend 0x2, 0x10
BattleScript_TeeterDanceLoopIncrement::
addbyte gBankDefender, 0x1
jumpifbytenotequal gBankDefender, gBattleBanksCount, BattleScript_TeeterDanceLoop
addbyte gBattleDefender, 0x1
jumpifbytenotequal gBattleDefender, gBattlersCount, BattleScript_TeeterDanceLoop
end
BattleScript_TeeterDanceOwnTempoPrevents::
@ -2935,7 +2935,7 @@ BattleScript_82DA908::
switchinanim GBANK_1, FALSE
waitstate
switchineffects 5
jumpifbytenotequal gBank1, gBattleBanksCount, BattleScript_82DA908
jumpifbytenotequal gBank1, gBattlersCount, BattleScript_82DA908
BattleScript_82DA92C::
end2
@ -3228,7 +3228,7 @@ BattleScript_DamagingWeatherContinues::
playanimation2 ATTACKER, sANIM_ARG1, NULL
setbyte gBattleCommunication, 0x0
BattleScript_DamagingWeatherLoop::
copyarraywithindex gBankAttacker, gBanksByTurnOrder, gBattleCommunication, 0x1
copyarraywithindex gBattleAttacker, gBattleTurnOrder, gBattleCommunication, 0x1
weatherdamage
jumpifword EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement
printfromtable gSandStormHailDmgStringIds
@ -3243,7 +3243,7 @@ BattleScript_DamagingWeatherLoop::
BattleScript_DamagingWeatherLoopIncrement::
jumpifbyte NOT_EQUAL, gBattleOutcome, 0, BattleScript_DamagingWeatherContinuesEnd
addbyte gBattleCommunication, 0x1
jumpifbytenotequal gBattleCommunication, gBattleBanksCount, BattleScript_DamagingWeatherLoop
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamagingWeatherLoop
BattleScript_DamagingWeatherContinuesEnd::
bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
end2
@ -3521,7 +3521,7 @@ BattleScript_RapidSpinAway::
BattleScript_WrapFree::
printstring STRINGID_PKMNGOTFREE
waitmessage 0x40
copybyte gBankDefender, sBANK
copybyte gBattleDefender, sBANK
return
BattleScript_LeechSeedFree::
@ -4032,7 +4032,7 @@ BattleScript_WeatherFormChanges::
BattleScript_WeatherFormChangesLoop::
trycastformdatachange
addbyte sBANK, 0x1
jumpifbytenotequal sBANK, gBattleBanksCount, BattleScript_WeatherFormChangesLoop
jumpifbytenotequal sBANK, gBattlersCount, BattleScript_WeatherFormChangesLoop
return
BattleScript_CastformChange::
@ -4053,7 +4053,7 @@ BattleScript_82DB4B8::
BattleScript_82DB4BE::
pause 0x20
BattleScript_82DB4C1::
setbyte gBankDefender, 0x0
setbyte gBattleDefender, 0x0
setstatchanger ATK, 1, TRUE
BattleScript_82DB4CD::
trygetintimidatetarget BattleScript_82DB51B
@ -4068,7 +4068,7 @@ BattleScript_82DB4CD::
printstring STRINGID_PKMNCUTSATTACKWITH
waitmessage 0x40
BattleScript_82DB510::
addbyte gBankDefender, 0x1
addbyte gBattleDefender, 0x1
goto BattleScript_82DB4CD
BattleScript_82DB51B::
return
@ -4474,7 +4474,7 @@ BattleScript_82DB887::
waitmessage 0x40
BattleScript_82DB89D::
addbyte gBattleCommunication + 1, 0x1
jumpifbytenotequal gBattleCommunication + 1, gBattleBanksCount, BattleScript_82DB887
jumpifbytenotequal gBattleCommunication + 1, gBattlersCount, BattleScript_82DB887
setbyte gBattleCommunication, 0x0
setbyte gBattleCommunication + 1, 0x0
end2

View File

@ -11,46 +11,45 @@
#include "battle_bg.h"
/*
* Banks are a name given to what could be called a 'battlerId' or 'monControllerId'.
* A battler may be in one of four positions on the field. The first bit determines
* what side the battler is on, either the player's side or the opponent's side.
* 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
* numbers correspond to their perspective. The battler 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 |
* ------------------------+
* | |
* | |
* +-----------------------+
* + ------------------------- +
* | Opponent's side |
* | 3 1 |
* | |
* | |
* | Player's side |
* | 0 2 |
* ----------------------------+
* | |
* | |
* +---------------------------+
*/
#define BATTLE_BANKS_COUNT 4
#define MAX_BATTLERS_COUNT 4
#define B_POSITION_PLAYER_LEFT 0
#define B_POSITION_OPPONENT_LEFT 1
#define B_POSITION_PLAYER_RIGHT 2
#define B_POSITION_OPPONENT_RIGHT 3
#define B_POSITION_PARTNER(position) ((position) ^ 2)
#define B_POSITION_PARTNER(position) ((position) ^ 2)
#define B_POSITION_OPPOSITE(position) ((position) ^ 1)
#define SIDE_PLAYER 0x0
#define SIDE_OPPONENT 0x1
#define B_SIDE_PLAYER 0
#define B_SIDE_OPPONENT 1
#define BIT_SIDE 0x1
#define BIT_MON 0x2
#define BIT_SIDE 1
#define BIT_FLANK 2
#define GET_BANK_POSITION(bank) (gBankPositions[bank])
#define GET_BANK_SIDE(bank) (GetBankPosition(bank) & BIT_SIDE)
#define GET_BANK_SIDE2(bank) (GET_BANK_POSITION(bank) & BIT_SIDE)
#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
// Battle Type Flags
@ -133,8 +132,8 @@ extern u8 gBattleOutcome;
#define STATUS2_LOCK_CONFUSE 0x00000C00
#define STATUS2_MULTIPLETURNS 0x00001000
#define STATUS2_WRAPPED 0x0000E000
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every bank
#define STATUS2_INFATUATED_WITH(bank) (gBitTable[bank] << 16)
#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler
#define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16)
#define STATUS2_FOCUS_ENERGY 0x00100000
#define STATUS2_TRANSFORMED 0x00200000
#define STATUS2_RECHARGE 0x00400000
@ -148,7 +147,7 @@ extern u8 gBattleOutcome;
#define STATUS2_DEFENSE_CURL 0x40000000
#define STATUS2_TORMENT 0x80000000
// Seems like per-bank statuses. Not quite sure how to categorize these
// Seems like per-battler statuses. Not quite sure how to categorize these
#define STATUS3_LEECHSEED_BANK 0x3
#define STATUS3_LEECHSEED 0x4
#define STATUS3_ALWAYS_HITS 0x18 // two bits
@ -169,7 +168,7 @@ extern u8 gBattleOutcome;
#define STATUS3_TRACE 0x100000
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
extern u32 gStatuses3[MAX_BATTLERS_COUNT];
//
@ -197,8 +196,8 @@ extern u32 gStatuses3[BATTLE_BANKS_COUNT];
#define HITMARKER_OBEYS 0x02000000
#define HITMARKER_x4000000 0x04000000
#define HITMARKER_x8000000 0x08000000
#define HITMARKER_FAINTED(bank) (gBitTable[bank] << 0x1C)
#define HITMARKER_UNK(bank) (0x10000000 << bank)
#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 0x1C)
#define HITMARKER_UNK(battler) (0x10000000 << battler)
extern u32 gHitMarker;
@ -339,7 +338,7 @@ struct TrainerMonNoItemDefaultMoves
u16 species;
};
u8 GetBankSide(u8 bank);
u8 GetBattlerSide(u8 battler);
struct TrainerMonItemDefaultMoves
{
@ -434,7 +433,7 @@ struct DisableStruct
/*0x1A*/ u8 unk1A[2];
};
extern struct DisableStruct gDisableStructs[BATTLE_BANKS_COUNT];
extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT];
struct ProtectStruct
{
@ -474,7 +473,7 @@ struct ProtectStruct
/* field_E */ u16 fieldE;
};
extern struct ProtectStruct gProtectStructs[BATTLE_BANKS_COUNT];
extern struct ProtectStruct gProtectStructs[MAX_BATTLERS_COUNT];
struct SpecialStatus
{
@ -496,7 +495,7 @@ struct SpecialStatus
u8 field13;
};
extern struct SpecialStatus gSpecialStatuses[BATTLE_BANKS_COUNT];
extern struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT];
struct SideTimer
{
@ -518,12 +517,12 @@ extern struct SideTimer gSideTimers[];
struct WishFutureKnock
{
u8 futureSightCounter[BATTLE_BANKS_COUNT];
u8 futureSightAttacker[BATTLE_BANKS_COUNT];
s32 futureSightDmg[BATTLE_BANKS_COUNT];
u16 futureSightMove[BATTLE_BANKS_COUNT];
u8 wishCounter[BATTLE_BANKS_COUNT];
u8 wishUserID[BATTLE_BANKS_COUNT];
u8 futureSightCounter[MAX_BATTLERS_COUNT];
u8 futureSightAttacker[MAX_BATTLERS_COUNT];
s32 futureSightDmg[MAX_BATTLERS_COUNT];
u16 futureSightMove[MAX_BATTLERS_COUNT];
u8 wishCounter[MAX_BATTLERS_COUNT];
u8 wishUserID[MAX_BATTLERS_COUNT];
u8 weatherDuration;
u8 knockedOffPokes[2];
};
@ -546,16 +545,16 @@ struct AI_ThinkingStruct
struct UsedMoves
{
u16 moves[BATTLE_BANKS_COUNT];
u16 unknown[BATTLE_BANKS_COUNT];
u16 moves[MAX_BATTLERS_COUNT];
u16 unknown[MAX_BATTLERS_COUNT];
};
struct BattleHistory
{
struct UsedMoves usedMoves[BATTLE_BANKS_COUNT];
u8 abilities[BATTLE_BANKS_COUNT];
u8 itemEffects[BATTLE_BANKS_COUNT];
u16 trainerItems[BATTLE_BANKS_COUNT];
struct UsedMoves usedMoves[MAX_BATTLERS_COUNT];
u8 abilities[MAX_BATTLERS_COUNT];
u8 itemEffects[MAX_BATTLERS_COUNT];
u16 trainerItems[MAX_BATTLERS_COUNT];
u8 itemsNo;
};
@ -661,9 +660,9 @@ struct BattleStruct
u16 expValue;
u8 field_52;
u8 sentInPokes;
bool8 selectionScriptFinished[BATTLE_BANKS_COUNT];
bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
u8 field_58[4];
u8 monToSwitchIntoId[BATTLE_BANKS_COUNT];
u8 monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_60[4][3];
u8 runTries;
u8 caughtMonNick[11];
@ -675,8 +674,8 @@ struct BattleStruct
u8 field_7D;
u8 field_7E;
u8 formToChangeInto;
u8 chosenMovePositions[BATTLE_BANKS_COUNT];
u8 stateIdAfterSelScript[BATTLE_BANKS_COUNT];
u8 chosenMovePositions[MAX_BATTLERS_COUNT];
u8 stateIdAfterSelScript[MAX_BATTLERS_COUNT];
u8 field_88;
u8 field_89;
u8 field_8A;
@ -709,12 +708,12 @@ struct BattleStruct
u8 synchronizeMoveEffect;
u8 field_B3;
void (*savedCallback)(void);
u16 usedHeldItems[BATTLE_BANKS_COUNT];
u16 usedHeldItems[MAX_BATTLERS_COUNT];
u8 chosenItem[4]; // why is this an u8?
u8 AI_itemType[2];
u8 AI_itemFlags[2];
u16 choicedMove[BATTLE_BANKS_COUNT];
u16 changedItems[BATTLE_BANKS_COUNT];
u16 choicedMove[MAX_BATTLERS_COUNT];
u16 changedItems[MAX_BATTLERS_COUNT];
u8 intimidateBank;
u8 switchInItemsCounter;
u8 field_DA;
@ -722,7 +721,7 @@ struct BattleStruct
u8 fillerDC[0xDF-0xDC];
u8 field_DF;
u8 mirrorMoveArrays[32];
u16 castformPalette[BATTLE_BANKS_COUNT][16];
u16 castformPalette[MAX_BATTLERS_COUNT][16];
u8 field_180;
u8 field_181;
u8 field_182;
@ -735,7 +734,7 @@ struct BattleStruct
u8 field_1A4[96];
u8 field_204[104];
u8 field_26C[40];
u8 AI_monToSwitchIntoId[BATTLE_BANKS_COUNT];
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_298[8];
u8 field_2A0;
u8 field_2A1;
@ -839,7 +838,7 @@ struct BattleScripting
u8 atk49_state;
u8 bankWithAbility;
u8 multihitMoveEffect;
u8 bank;
u8 battler;
u8 animTurn;
u8 animTargetsHit;
u8 statChanger;
@ -871,9 +870,9 @@ enum
};
// rom_80A5C6C
u8 GetBankSide(u8 bank);
u8 GetBankPosition(u8 bank);
u8 GetBankByPosition(u8 bank);
u8 GetBattlerSide(u8 bank);
u8 GetBattlerPosition(u8 bank);
u8 GetBattlerAtPosition(u8 bank);
struct BattleSpriteInfo
{

View File

@ -47,7 +47,7 @@ extern s16 gBattleAnimArgs[ANIM_ARGS_COUNT];
extern u8 gAnimMoveTurn;
extern u8 gAnimBankAttacker;
extern u8 gAnimBankTarget;
extern u16 gAnimSpeciesByBanks[BATTLE_BANKS_COUNT];
extern u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT];
extern u8 gUnknown_02038440;
void ClearBattleAnimationVars(void);

View File

@ -45,17 +45,17 @@ AI scripts.
*/
extern u32 gBattleTypeFlags;
extern u8 gActiveBank;
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u8 gActiveBattler;
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u16 gCurrentMove;
extern u8 gBankDefender;
extern u8 gAbsentBankFlags;
extern u16 gLastMoves[BATTLE_BANKS_COUNT];
extern u8 gBattleDefender;
extern u8 gAbsentBattlerFlags;
extern u16 gLastMoves[MAX_BATTLERS_COUNT];
extern u16 gTrainerBattleOpponent_A;
extern u16 gTrainerBattleOpponent_B;
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
extern u32 gStatuses3[MAX_BATTLERS_COUNT];
extern u16 gSideStatuses[2];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u16 gDynamicBasePower;
extern u8 gMoveResultFlags;
extern s32 gBattleMoveDamage;
@ -352,7 +352,7 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
defaultScoreMoves >>= 1;
}
moveLimitations = CheckMoveLimitations(gActiveBank, 0, 0xFF);
moveLimitations = CheckMoveLimitations(gActiveBattler, 0, 0xFF);
// ignore moves that aren't possible to use
for (i = 0; i < 4; i++)
@ -363,18 +363,18 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
AI_THINKING_STRUCT->simulatedRNG[i] = 100 - (Random() % 16);
}
gBattleResources->AI_ScriptsStack->size = 0;
sBank_AI = gActiveBank;
sBank_AI = gActiveBattler;
// decide a random target bank in doubles
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
gBankDefender = (Random() & BIT_MON) + (GetBankSide(gActiveBank) ^ BIT_SIDE);
if (gAbsentBankFlags & gBitTable[gBankDefender])
gBankDefender ^= BIT_MON;
gBattleDefender = (Random() & BIT_FLANK) + (GetBattlerSide(gActiveBattler) ^ BIT_SIDE);
if (gAbsentBattlerFlags & gBitTable[gBattleDefender])
gBattleDefender ^= BIT_FLANK;
}
// in singles there's only one choice
else
{
gBankDefender = sBank_AI ^ BIT_SIDE;
gBattleDefender = sBank_AI ^ BIT_SIDE;
}
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
@ -491,7 +491,7 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void)
else
BattleAI_SetupAIData(0xF);
gBankDefender = i;
gBattleDefender = i;
if ((i & BIT_SIDE) != (sBank_AI & BIT_SIDE))
RecordLastUsedMoveByTarget();
@ -542,7 +542,7 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void)
bestMovePointsForTarget[i] = mostViableMovesScores[0];
// don't use a move against ally if it has less than 100 pts
if (i == (sBank_AI ^ BIT_MON) && bestMovePointsForTarget[i] < 100)
if (i == (sBank_AI ^ BIT_FLANK) && bestMovePointsForTarget[i] < 100)
{
bestMovePointsForTarget[i] = -1;
mostViableMovesScores[0] = mostViableMovesScores[0]; // needed to match
@ -573,8 +573,8 @@ static u8 BattleAI_ChooseMoveOrAction_Doubles(void)
}
}
gBankDefender = mostViableTargetsArray[Random() % mostViableTargetsNo];
return actionOrMoveIndex[gBankDefender];
gBattleDefender = mostViableTargetsArray[Random() % mostViableTargetsNo];
return actionOrMoveIndex[gBattleDefender];
}
static void BattleAI_DoAIProcessing(void)
@ -627,12 +627,12 @@ static void RecordLastUsedMoveByTarget(void)
for (i = 0; i < 4; i++)
{
if (gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] == gLastMoves[gBankDefender])
if (gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] == gLastMoves[gBattleDefender])
break;
if (gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] != gLastMoves[gBankDefender] // HACK: This redundant condition is a hack to make the asm match.
&& gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] == 0)
if (gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] != gLastMoves[gBattleDefender] // HACK: This redundant condition is a hack to make the asm match.
&& gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] == 0)
{
gBattleResources->battleHistory->usedMoves[gBankDefender].moves[i] = gLastMoves[gBankDefender];
gBattleResources->battleHistory->usedMoves[gBattleDefender].moves[i] = gLastMoves[gBattleDefender];
break;
}
}
@ -723,7 +723,7 @@ static void BattleAICmd_if_hp_less_than(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) < gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
@ -738,7 +738,7 @@ static void BattleAICmd_if_hp_more_than(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) > gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
@ -753,7 +753,7 @@ static void BattleAICmd_if_hp_equal(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) == gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
@ -768,7 +768,7 @@ static void BattleAICmd_if_hp_not_equal(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if ((u32)(100 * gBattleMons[bank].hp / gBattleMons[bank].maxHP) != gAIScriptPtr[2])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 3);
@ -784,7 +784,7 @@ static void BattleAICmd_if_status(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
status = AIScriptRead32(gAIScriptPtr + 2);
@ -802,7 +802,7 @@ static void BattleAICmd_if_not_status(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
status = AIScriptRead32(gAIScriptPtr + 2);
@ -820,7 +820,7 @@ static void BattleAICmd_if_status2(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
status = AIScriptRead32(gAIScriptPtr + 2);
@ -838,7 +838,7 @@ static void BattleAICmd_if_not_status2(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
status = AIScriptRead32(gAIScriptPtr + 2);
@ -856,7 +856,7 @@ static void BattleAICmd_if_status3(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
status = AIScriptRead32(gAIScriptPtr + 2);
@ -874,7 +874,7 @@ static void BattleAICmd_if_not_status3(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
status = AIScriptRead32(gAIScriptPtr + 2);
@ -892,9 +892,9 @@ static void BattleAICmd_if_side_affecting(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
side = GET_BANK_SIDE(bank);
side = GET_BATTLER_SIDE(bank);
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gSideStatuses[side] & status) != 0)
@ -911,9 +911,9 @@ static void BattleAICmd_if_not_side_affecting(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
side = GET_BANK_SIDE(bank);
side = GET_BATTLER_SIDE(bank);
status = AIScriptRead32(gAIScriptPtr + 2);
if ((gSideStatuses[side] & status) == 0)
@ -1126,13 +1126,13 @@ static void BattleAICmd_get_type(void)
AI_THINKING_STRUCT->funcResult = gBattleMons[sBank_AI].type1;
break;
case AI_TYPE1_TARGET: // target primary type
AI_THINKING_STRUCT->funcResult = gBattleMons[gBankDefender].type1;
AI_THINKING_STRUCT->funcResult = gBattleMons[gBattleDefender].type1;
break;
case AI_TYPE2_USER: // AI user secondary type
AI_THINKING_STRUCT->funcResult = gBattleMons[sBank_AI].type2;
break;
case AI_TYPE2_TARGET: // target secondary type
AI_THINKING_STRUCT->funcResult = gBattleMons[gBankDefender].type2;
AI_THINKING_STRUCT->funcResult = gBattleMons[gBattleDefender].type2;
break;
case AI_TYPE_MOVE: // type of move being pointed to
AI_THINKING_STRUCT->funcResult = gBattleMoves[AI_THINKING_STRUCT->moveConsidered].type;
@ -1149,11 +1149,11 @@ static u8 BattleAI_GetWantedBank(u8 bank)
return sBank_AI;
case AI_TARGET:
default:
return gBankDefender;
return gBattleDefender;
case AI_USER_PARTNER:
return sBank_AI ^ BIT_MON;
return sBank_AI ^ BIT_FLANK;
case AI_TARGET_PARTNER:
return gBankDefender ^ BIT_MON;
return gBattleDefender ^ BIT_FLANK;
}
}
@ -1212,8 +1212,8 @@ static void BattleAICmd_get_how_powerful_move_is(void)
&& gBattleMoves[gBattleMons[sBank_AI].moves[checkedMove]].power > 1)
{
gCurrentMove = gBattleMons[sBank_AI].moves[checkedMove];
AI_CalcDmg(sBank_AI, gBankDefender);
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
AI_CalcDmg(sBank_AI, gBattleDefender);
TypeCalc(gCurrentMove, sBank_AI, gBattleDefender);
moveDmgs[checkedMove] = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[checkedMove] / 100;
if (moveDmgs[checkedMove] == 0)
moveDmgs[checkedMove] = 1;
@ -1248,7 +1248,7 @@ static void BattleAICmd_get_last_used_bank_move(void)
if (gAIScriptPtr[1] == AI_USER)
AI_THINKING_STRUCT->funcResult = gLastMoves[sBank_AI];
else
AI_THINKING_STRUCT->funcResult = gLastMoves[gBankDefender];
AI_THINKING_STRUCT->funcResult = gLastMoves[gBattleDefender];
gAIScriptPtr += 2;
}
@ -1271,7 +1271,7 @@ static void BattleAICmd_if_not_equal_(void) // same as if_not_equal
static void BattleAICmd_if_user_goes(void)
{
if (GetWhoStrikesFirst(sBank_AI, gBankDefender, TRUE) == gAIScriptPtr[1])
if (GetWhoStrikesFirst(sBank_AI, gBattleDefender, TRUE) == gAIScriptPtr[1])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
else
gAIScriptPtr += 6;
@ -1279,7 +1279,7 @@ static void BattleAICmd_if_user_goes(void)
static void BattleAICmd_if_user_doesnt_go(void)
{
if (GetWhoStrikesFirst(sBank_AI, gBankDefender, TRUE) != gAIScriptPtr[1])
if (GetWhoStrikesFirst(sBank_AI, gBattleDefender, TRUE) != gAIScriptPtr[1])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
else
gAIScriptPtr += 6;
@ -1305,9 +1305,9 @@ static void BattleAICmd_count_usable_party_mons(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -1316,8 +1316,8 @@ static void BattleAICmd_count_usable_party_mons(void)
{
u32 position;
bankOnField1 = gBattlePartyID[bank];
position = GetBankPosition(bank) ^ BIT_MON;
bankOnField2 = gBattlePartyID[GetBankByPosition(position)];
position = GetBattlerPosition(bank) ^ BIT_FLANK;
bankOnField2 = gBattlePartyID[GetBattlerAtPosition(position)];
}
else // in singles there's only one bank by side
{
@ -1358,9 +1358,9 @@ static void BattleAICmd_get_ability(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gActiveBank != bank)
if (gActiveBattler != bank)
{
if (BATTLE_HISTORY->abilities[bank] != 0)
{
@ -1493,7 +1493,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void)
if (gCurrentMove)
{
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
TypeCalc(gCurrentMove, sBank_AI, gBattleDefender);
// reduce by 1/3.
if (gBattleMoveDamage == 120)
@ -1528,7 +1528,7 @@ static void BattleAICmd_if_type_effectiveness(void)
gBattleMoveDamage = AI_EFFECTIVENESS_x1;
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
TypeCalc(gCurrentMove, sBank_AI, gBattleDefender);
if (gBattleMoveDamage == 120)
gBattleMoveDamage = AI_EFFECTIVENESS_x2;
@ -1572,11 +1572,11 @@ static void BattleAICmd_if_status_in_party(void)
bank = sBank_AI;
break;
default:
bank = gBankDefender;
bank = gBattleDefender;
break;
}
party = (GetBankSide(bank) == SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
party = (GetBattlerSide(bank) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
statusToCompareTo = AIScriptRead32(gAIScriptPtr + 2);
@ -1609,11 +1609,11 @@ static void BattleAICmd_if_status_not_in_party(void)
bank = sBank_AI;
break;
default:
bank = gBankDefender;
bank = gBattleDefender;
break;
}
party = (GetBankSide(bank) == SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
party = (GetBattlerSide(bank) == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
statusToCompareTo = AIScriptRead32(gAIScriptPtr + 2);
@ -1669,7 +1669,7 @@ static void BattleAICmd_if_stat_level_less_than(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] < gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
@ -1684,7 +1684,7 @@ static void BattleAICmd_if_stat_level_more_than(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] > gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
@ -1699,7 +1699,7 @@ static void BattleAICmd_if_stat_level_equal(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] == gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
@ -1714,7 +1714,7 @@ static void BattleAICmd_if_stat_level_not_equal(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gBattleMons[bank].statStages[gAIScriptPtr[2]] != gAIScriptPtr[3])
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 4);
@ -1736,8 +1736,8 @@ static void BattleAICmd_if_can_faint(void)
gMoveResultFlags = 0;
gCritMultiplier = 1;
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
AI_CalcDmg(sBank_AI, gBankDefender);
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
AI_CalcDmg(sBank_AI, gBattleDefender);
TypeCalc(gCurrentMove, sBank_AI, gBattleDefender);
gBattleMoveDamage = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[AI_THINKING_STRUCT->movesetIndex] / 100;
@ -1745,7 +1745,7 @@ static void BattleAICmd_if_can_faint(void)
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (gBattleMons[gBankDefender].hp <= gBattleMoveDamage)
if (gBattleMons[gBattleDefender].hp <= gBattleMoveDamage)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
else
gAIScriptPtr += 5;
@ -1765,14 +1765,14 @@ static void BattleAICmd_if_cant_faint(void)
gMoveResultFlags = 0;
gCritMultiplier = 1;
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
AI_CalcDmg(sBank_AI, gBankDefender);
TypeCalc(gCurrentMove, sBank_AI, gBankDefender);
AI_CalcDmg(sBank_AI, gBattleDefender);
TypeCalc(gCurrentMove, sBank_AI, gBattleDefender);
gBattleMoveDamage = gBattleMoveDamage * AI_THINKING_STRUCT->simulatedRNG[AI_THINKING_STRUCT->movesetIndex] / 100;
// this macro is missing the damage 0 = 1 assumption.
if (gBattleMons[gBankDefender].hp > gBattleMoveDamage)
if (gBattleMons[gBattleDefender].hp > gBattleMoveDamage)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
else
gAIScriptPtr += 5;
@ -1802,7 +1802,7 @@ static void BattleAICmd_if_has_move(void)
return;
}
case AI_USER_PARTNER:
if (gBattleMons[sBank_AI ^ BIT_MON].hp == 0)
if (gBattleMons[sBank_AI ^ BIT_FLANK].hp == 0)
{
gAIScriptPtr += 8;
return;
@ -1811,7 +1811,7 @@ static void BattleAICmd_if_has_move(void)
{
for (i = 0; i < 4; i++)
{
if (gBattleMons[sBank_AI ^ BIT_MON].moves[i] == *movePtr)
if (gBattleMons[sBank_AI ^ BIT_FLANK].moves[i] == *movePtr)
break;
}
}
@ -1829,7 +1829,7 @@ static void BattleAICmd_if_has_move(void)
case AI_TARGET_PARTNER:
for (i = 0; i < 4; i++)
{
if (BATTLE_HISTORY->usedMoves[gBankDefender].moves[i] == *movePtr)
if (BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i] == *movePtr)
break;
}
if (i == 4)
@ -1873,7 +1873,7 @@ static void BattleAICmd_if_doesnt_have_move(void)
case AI_TARGET_PARTNER:
for (i = 0; i < 4; i++)
{
if (BATTLE_HISTORY->usedMoves[gBankDefender].moves[i] == *movePtr)
if (BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i] == *movePtr)
break;
}
if (i != 4)
@ -1911,8 +1911,8 @@ static void BattleAICmd_if_has_move_with_effect(void)
case AI_TARGET_PARTNER:
for (i = 0; i < 4; i++)
{
// UB: checks sBank_AI instead of gBankDefender
if (gBattleMons[sBank_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBankDefender].moves[i]].effect == gAIScriptPtr[2])
// UB: checks sBank_AI instead of gBattleDefender
if (gBattleMons[sBank_AI].moves[i] != 0 && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i]].effect == gAIScriptPtr[2])
break;
}
if (i == 4)
@ -1945,7 +1945,7 @@ static void BattleAICmd_if_doesnt_have_move_with_effect(void)
case AI_TARGET_PARTNER:
for (i = 0; i < 4; i++)
{
if (BATTLE_HISTORY->usedMoves[gBankDefender].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBankDefender].moves[i]].effect == gAIScriptPtr[2])
if (BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i] && gBattleMoves[BATTLE_HISTORY->usedMoves[gBattleDefender].moves[i]].effect == gAIScriptPtr[2])
break;
}
if (i != 4)
@ -1963,7 +1963,7 @@ static void BattleAICmd_if_any_move_disabled_or_encored(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gAIScriptPtr[2] == 0)
{
@ -1993,7 +1993,7 @@ static void BattleAICmd_if_curr_move_disabled_or_encored(void)
switch (gAIScriptPtr[1])
{
case 0:
if (gDisableStructs[gActiveBank].disabledMove == AI_THINKING_STRUCT->moveConsidered)
if (gDisableStructs[gActiveBattler].disabledMove == AI_THINKING_STRUCT->moveConsidered)
{
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
return;
@ -2001,7 +2001,7 @@ static void BattleAICmd_if_curr_move_disabled_or_encored(void)
gAIScriptPtr += 6;
return;
case 1:
if (gDisableStructs[gActiveBank].encoredMove == AI_THINKING_STRUCT->moveConsidered)
if (gDisableStructs[gActiveBattler].encoredMove == AI_THINKING_STRUCT->moveConsidered)
{
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
return;
@ -2041,9 +2041,9 @@ static void BattleAICmd_get_hold_effect(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
if (gActiveBank != bank)
if (gActiveBattler != bank)
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(BATTLE_HISTORY->itemEffects[bank]);
else
AI_THINKING_STRUCT->funcResult = ItemId_GetHoldEffect(gBattleMons[bank].item);
@ -2079,7 +2079,7 @@ static void BattleAICmd_get_gender(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
AI_THINKING_STRUCT->funcResult = GetGenderFromSpeciesAndPersonality(gBattleMons[bank].species, gBattleMons[bank].personality);
@ -2093,7 +2093,7 @@ static void BattleAICmd_is_first_turn_for(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].isFirstTurn;
@ -2107,7 +2107,7 @@ static void BattleAICmd_get_stockpile_count(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].stockpileCounter;
@ -2128,7 +2128,7 @@ static void BattleAICmd_get_used_held_item(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
// This is likely a leftover from Ruby's code and its ugly ewram access
#ifdef NONMATCHING
@ -2168,7 +2168,7 @@ static void BattleAICmd_get_protect_count(void)
if (gAIScriptPtr[1] == AI_USER)
bank = sBank_AI;
else
bank = gBankDefender;
bank = gBattleDefender;
AI_THINKING_STRUCT->funcResult = gDisableStructs[bank].protectUses;
@ -2221,7 +2221,7 @@ static void BattleAICmd_if_level_cond(void)
switch (gAIScriptPtr[1])
{
case 0: // greater than
if (gBattleMons[sBank_AI].level > gBattleMons[gBankDefender].level)
if (gBattleMons[sBank_AI].level > gBattleMons[gBattleDefender].level)
{
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
return;
@ -2229,7 +2229,7 @@ static void BattleAICmd_if_level_cond(void)
gAIScriptPtr += 6;
return;
case 1: // less than
if (gBattleMons[sBank_AI].level < gBattleMons[gBankDefender].level)
if (gBattleMons[sBank_AI].level < gBattleMons[gBattleDefender].level)
{
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
return;
@ -2237,7 +2237,7 @@ static void BattleAICmd_if_level_cond(void)
gAIScriptPtr += 6;
return;
case 2: // equal
if (gBattleMons[sBank_AI].level == gBattleMons[gBankDefender].level)
if (gBattleMons[sBank_AI].level == gBattleMons[gBattleDefender].level)
{
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 2);
return;
@ -2249,7 +2249,7 @@ static void BattleAICmd_if_level_cond(void)
static void BattleAICmd_if_target_taunted(void)
{
if (gDisableStructs[gBankDefender].tauntTimer1 != 0)
if (gDisableStructs[gBattleDefender].tauntTimer1 != 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
else
gAIScriptPtr += 5;
@ -2257,7 +2257,7 @@ static void BattleAICmd_if_target_taunted(void)
static void BattleAICmd_if_target_not_taunted(void)
{
if (gDisableStructs[gBankDefender].tauntTimer1 == 0)
if (gDisableStructs[gBattleDefender].tauntTimer1 == 0)
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
else
gAIScriptPtr += 5;
@ -2265,7 +2265,7 @@ static void BattleAICmd_if_target_not_taunted(void)
static void BattleAICmd_if_target_is_ally(void)
{
if ((sBank_AI & BIT_SIDE) == (gBankDefender & BIT_SIDE))
if ((sBank_AI & BIT_SIDE) == (gBattleDefender & BIT_SIDE))
gAIScriptPtr = AIScriptReadPtr(gAIScriptPtr + 1);
else
gAIScriptPtr += 5;

View File

@ -10,14 +10,14 @@
#include "constants/items.h"
#include "pokemon_item_effects.h"
extern u8 gActiveBank;
extern u8 gAbsentBankFlags;
extern u8 gActiveBattler;
extern u8 gAbsentBattlerFlags;
extern u32 gBattleTypeFlags;
extern u32 gStatuses3[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u16 gLastLandedMoves[BATTLE_BANKS_COUNT];
extern u8 gLastHitBy[BATTLE_BANKS_COUNT];
extern u32 gStatuses3[MAX_BATTLERS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u16 gLastLandedMoves[MAX_BATTLERS_COUNT];
extern u8 gLastHitBy[MAX_BATTLERS_COUNT];
extern u16 gDynamicBasePower;
extern u8 gMoveResultFlags;
extern u8 gCritMultiplier;
@ -35,10 +35,10 @@ static bool8 ShouldUseItem(void);
static bool8 ShouldSwitchIfPerishSong(void)
{
if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG
&& gDisableStructs[gActiveBank].perishSongTimer1 == 0)
if (gStatuses3[gActiveBattler] & STATUS3_PERISH_SONG
&& gDisableStructs[gActiveBattler].perishSongTimer1 == 0)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -60,15 +60,15 @@ static bool8 ShouldSwitchIfWonderGuard(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
return FALSE;
opposingPosition = B_POSITION_OPPOSITE(GetBankPosition(gActiveBank));
opposingPosition = B_POSITION_OPPOSITE(GetBattlerPosition(gActiveBattler));
if (gBattleMons[GetBankByPosition(opposingPosition)].ability != ABILITY_WONDER_GUARD)
if (gBattleMons[GetBattlerAtPosition(opposingPosition)].ability != ABILITY_WONDER_GUARD)
return FALSE;
// check if pokemon has a super effective move
for (opposingBank = GetBankByPosition(opposingPosition), i = 0; i < 4; i++)
for (opposingBank = GetBattlerAtPosition(opposingPosition), i = 0; i < 4; i++)
{
move = gBattleMons[gActiveBank].moves[i];
move = gBattleMons[gActiveBattler].moves[i];
if (move == MOVE_NONE)
continue;
@ -80,7 +80,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
// get party information
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBank & BIT_MON) == 0)
if ((gActiveBattler & BIT_FLANK) == 0)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -90,7 +90,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
firstId = 0, lastId = 6;
}
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -104,13 +104,13 @@ static bool8 ShouldSwitchIfWonderGuard(void)
continue;
if (GetMonData(&party[i], MON_DATA_SPECIES2) == SPECIES_EGG)
continue;
if (i == gBattlePartyID[gActiveBank])
if (i == gBattlePartyID[gActiveBattler])
continue;
GetMonData(&party[i], MON_DATA_SPECIES); // unused return value
GetMonData(&party[i], MON_DATA_ALT_ABILITY); // unused return value
for (opposingBank = GetBankByPosition(opposingPosition), j = 0; j < 4; j++)
for (opposingBank = GetBattlerAtPosition(opposingPosition), j = 0; j < 4; j++)
{
move = GetMonData(&party[i], MON_DATA_MOVE1 + j);
if (move == MOVE_NONE)
@ -120,7 +120,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % 3 < 2)
{
// we found a mon
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -141,42 +141,42 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (HasSuperEffectiveMoveAgainstOpponents(TRUE) && Random() % 3 != 0)
return FALSE;
if (gLastLandedMoves[gActiveBank] == 0)
if (gLastLandedMoves[gActiveBattler] == 0)
return FALSE;
if (gLastLandedMoves[gActiveBank] == 0xFFFF)
if (gLastLandedMoves[gActiveBattler] == 0xFFFF)
return FALSE;
if (gBattleMoves[gLastLandedMoves[gActiveBank]].power == 0)
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = gActiveBank;
if (gAbsentBankFlags & gBitTable[GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)))])
bankIn2 = gActiveBank;
bankIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_PARTNER(GetBattlerPosition(gActiveBattler)))])
bankIn2 = gActiveBattler;
else
bankIn2 = GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)));
bankIn2 = GetBattlerAtPosition(B_POSITION_PARTNER(GetBattlerPosition(gActiveBattler)));
}
else
{
bankIn1 = gActiveBank;
bankIn2 = gActiveBank;
bankIn1 = gActiveBattler;
bankIn2 = gActiveBattler;
}
if (gBattleMoves[gLastLandedMoves[gActiveBank]].type == TYPE_FIRE)
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_FIRE)
absorbingTypeAbility = ABILITY_FLASH_FIRE;
else if (gBattleMoves[gLastLandedMoves[gActiveBank]].type == TYPE_WATER)
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_WATER)
absorbingTypeAbility = ABILITY_WATER_ABSORB;
else if (gBattleMoves[gLastLandedMoves[gActiveBank]].type == TYPE_ELECTRIC)
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].type == TYPE_ELECTRIC)
absorbingTypeAbility = ABILITY_VOLT_ABSORB;
else
return FALSE;
if (gBattleMons[gActiveBank].ability == absorbingTypeAbility)
if (gBattleMons[gActiveBattler].ability == absorbingTypeAbility)
return FALSE;
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBank & BIT_MON) == 0)
if ((gActiveBattler & BIT_FLANK) == 0)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -186,7 +186,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
firstId = 0, lastId = 6;
}
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -220,7 +220,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (absorbingTypeAbility == monAbility && Random() & 1)
{
// we found a mon
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -231,22 +231,22 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
static bool8 ShouldSwitchIfNaturalCure(void)
{
if (!(gBattleMons[gActiveBank].status1 & STATUS1_SLEEP))
if (!(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP))
return FALSE;
if (gBattleMons[gActiveBank].ability != ABILITY_NATURAL_CURE)
if (gBattleMons[gActiveBattler].ability != ABILITY_NATURAL_CURE)
return FALSE;
if (gBattleMons[gActiveBank].hp < gBattleMons[gActiveBank].maxHP / 2)
if (gBattleMons[gActiveBattler].hp < gBattleMons[gActiveBattler].maxHP / 2)
return FALSE;
if ((gLastLandedMoves[gActiveBank] == 0 || gLastLandedMoves[gActiveBank] == 0xFFFF) && Random() & 1)
if ((gLastLandedMoves[gActiveBattler] == 0 || gLastLandedMoves[gActiveBattler] == 0xFFFF) && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
else if (gBattleMoves[gLastLandedMoves[gActiveBank]].power == 0 && Random() & 1)
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0 && Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -257,7 +257,7 @@ static bool8 ShouldSwitchIfNaturalCure(void)
return TRUE;
if (Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = 6;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = 6;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -273,14 +273,14 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
u8 moveFlags;
u16 move;
opposingPosition = B_POSITION_OPPOSITE(GetBankPosition(gActiveBank));
opposingBank = GetBankByPosition(opposingPosition);
opposingPosition = B_POSITION_OPPOSITE(GetBattlerPosition(gActiveBattler));
opposingBank = GetBattlerAtPosition(opposingPosition);
if (!(gAbsentBankFlags & gBitTable[opposingBank]))
if (!(gAbsentBattlerFlags & gBitTable[opposingBank]))
{
for (i = 0; i < 4; i++)
{
move = gBattleMons[gActiveBank].moves[i];
move = gBattleMons[gActiveBattler].moves[i];
if (move == MOVE_NONE)
continue;
@ -297,13 +297,13 @@ static bool8 HasSuperEffectiveMoveAgainstOpponents(bool8 noRng)
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return FALSE;
opposingBank = GetBankByPosition(B_POSITION_PARTNER(opposingPosition));
opposingBank = GetBattlerAtPosition(B_POSITION_PARTNER(opposingPosition));
if (!(gAbsentBankFlags & gBitTable[opposingBank]))
if (!(gAbsentBattlerFlags & gBitTable[opposingBank]))
{
for (i = 0; i < 4; i++)
{
move = gBattleMons[gActiveBank].moves[i];
move = gBattleMons[gActiveBattler].moves[i];
if (move == MOVE_NONE)
continue;
@ -328,8 +328,8 @@ static bool8 AreStatsRaised(void)
for (i = 0; i < BATTLE_STATS_NO; i++)
{
if (gBattleMons[gActiveBank].statStages[i] > 6)
buffedStatsValue += gBattleMons[gActiveBank].statStages[i] - 6;
if (gBattleMons[gActiveBattler].statStages[i] > 6)
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6;
}
return (buffedStatsValue > 3);
@ -345,32 +345,32 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
u16 move;
u8 moveFlags;
if (gLastLandedMoves[gActiveBank] == 0)
if (gLastLandedMoves[gActiveBattler] == 0)
return FALSE;
if (gLastLandedMoves[gActiveBank] == 0xFFFF)
if (gLastLandedMoves[gActiveBattler] == 0xFFFF)
return FALSE;
if (gLastHitBy[gActiveBank] == 0xFF)
if (gLastHitBy[gActiveBattler] == 0xFF)
return FALSE;
if (gBattleMoves[gLastLandedMoves[gActiveBank]].power == 0)
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = gActiveBank;
if (gAbsentBankFlags & gBitTable[GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)))])
bankIn2 = gActiveBank;
bankIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(B_POSITION_PARTNER(GetBattlerPosition(gActiveBattler)))])
bankIn2 = gActiveBattler;
else
bankIn2 = GetBankByPosition(B_POSITION_PARTNER(GetBankPosition(gActiveBank)));
bankIn2 = GetBattlerAtPosition(B_POSITION_PARTNER(GetBattlerPosition(gActiveBattler)));
}
else
{
bankIn1 = gActiveBank;
bankIn2 = gActiveBank;
bankIn1 = gActiveBattler;
bankIn2 = gActiveBattler;
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBank & BIT_MON) == 0)
if ((gActiveBattler & BIT_FLANK) == 0)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -380,7 +380,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
firstId = 0, lastId = 6;
}
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -411,10 +411,10 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
else
monAbility = gBaseStats[species].ability1;
moveFlags = AI_TypeCalc(gLastLandedMoves[gActiveBank], species, monAbility);
moveFlags = AI_TypeCalc(gLastLandedMoves[gActiveBattler], species, monAbility);
if (moveFlags & flags)
{
bankIn1 = gLastHitBy[gActiveBank];
bankIn1 = gLastHitBy[gActiveBattler];
for (j = 0; j < 4; j++)
{
@ -425,7 +425,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
moveFlags = AI_TypeCalc(move, gBattleMons[bankIn1].species, gBattleMons[bankIn1].ability);
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % moduloPercent == 0)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = i;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
EmitTwoReturnValues(1, ACTION_SWITCH, 0);
return TRUE;
}
@ -446,19 +446,19 @@ static bool8 ShouldSwitch(void)
s32 i;
s32 availableToSwitch;
if (gBattleMons[*(activeBankPtr = &gActiveBank)].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
if (gBattleMons[*(activeBankPtr = &gActiveBattler)].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
return FALSE;
if (gStatuses3[gActiveBank] & STATUS3_ROOTED)
if (gStatuses3[gActiveBattler] & STATUS3_ROOTED)
return FALSE;
if (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBank, ABILITY_SHADOW_TAG, 0, 0))
if (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_SHADOW_TAG, 0, 0))
return FALSE;
if (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBank, ABILITY_ARENA_TRAP, 0, 0))
if (AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, gActiveBattler, ABILITY_ARENA_TRAP, 0, 0))
return FALSE; // misses the flying or levitate check
if (AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, ABILITY_MAGNET_PULL, 0, 0))
{
if (gBattleMons[gActiveBank].type1 == TYPE_STEEL)
if (gBattleMons[gActiveBattler].type1 == TYPE_STEEL)
return FALSE;
if (gBattleMons[gActiveBank].type2 == TYPE_STEEL)
if (gBattleMons[gActiveBattler].type2 == TYPE_STEEL)
return FALSE;
}
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
@ -468,10 +468,10 @@ static bool8 ShouldSwitch(void)
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = *activeBankPtr;
if (gAbsentBankFlags & gBitTable[GetBankByPosition(GetBankPosition(*activeBankPtr) ^ BIT_MON)])
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(*activeBankPtr) ^ BIT_FLANK)])
bankIn2 = *activeBankPtr;
else
bankIn2 = GetBankByPosition(GetBankPosition(*activeBankPtr) ^ BIT_MON);
bankIn2 = GetBattlerAtPosition(GetBattlerPosition(*activeBankPtr) ^ BIT_FLANK);
}
else
{
@ -481,7 +481,7 @@ static bool8 ShouldSwitch(void)
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBank & BIT_MON) == 0)
if ((gActiveBattler & BIT_FLANK) == 0)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -491,7 +491,7 @@ static bool8 ShouldSwitch(void)
firstId = 0, lastId = 6;
}
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -543,9 +543,9 @@ void AI_TrySwitchOrUseItem(void)
u8 bankIn1, bankIn2;
s32 firstId;
s32 lastId; // + 1
u8 bankIdentity = GetBankPosition(gActiveBank);
u8 bankIdentity = GetBattlerPosition(gActiveBattler);
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -554,25 +554,25 @@ void AI_TrySwitchOrUseItem(void)
{
if (ShouldSwitch())
{
if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) == 6)
if (*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) == 6)
{
s32 monToSwitchId = GetMostSuitableMonToSwitchInto();
if (monToSwitchId == 6)
{
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
{
bankIn1 = GetBankByPosition(bankIdentity);
bankIn1 = GetBattlerAtPosition(bankIdentity);
bankIn2 = bankIn1;
}
else
{
bankIn1 = GetBankByPosition(bankIdentity);
bankIn2 = GetBankByPosition(bankIdentity ^ BIT_MON);
bankIn1 = GetBattlerAtPosition(bankIdentity);
bankIn2 = GetBattlerAtPosition(bankIdentity ^ BIT_FLANK);
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBank & BIT_MON) == 0)
if ((gActiveBattler & BIT_FLANK) == 0)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -599,10 +599,10 @@ void AI_TrySwitchOrUseItem(void)
}
}
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBank) = monToSwitchId;
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = monToSwitchId;
}
*(gBattleStruct->monToSwitchIntoId + gActiveBank) = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBank);
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = *(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler);
return;
}
else if (ShouldUseItem())
@ -611,7 +611,7 @@ void AI_TrySwitchOrUseItem(void)
}
}
EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBank ^ BIT_SIDE) << 8);
EmitTwoReturnValues(1, ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8);
}
static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 *var)
@ -651,34 +651,34 @@ u8 GetMostSuitableMonToSwitchInto(void)
u8 invalidMons;
u16 move;
if (*(gBattleStruct->monToSwitchIntoId + gActiveBank) != 6)
return *(gBattleStruct->monToSwitchIntoId + gActiveBank);
if (*(gBattleStruct->monToSwitchIntoId + gActiveBattler) != 6)
return *(gBattleStruct->monToSwitchIntoId + gActiveBattler);
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
return gBattlePartyID[gActiveBank] + 1;
return gBattlePartyID[gActiveBattler] + 1;
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
bankIn1 = gActiveBank;
if (gAbsentBankFlags & gBitTable[GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON)])
bankIn2 = gActiveBank;
bankIn1 = gActiveBattler;
if (gAbsentBattlerFlags & gBitTable[GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK)])
bankIn2 = gActiveBattler;
else
bankIn2 = GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_MON);
bankIn2 = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_FLANK);
// UB: It considers the opponent only player's side even though it can battle alongside player;
opposingBank = Random() & BIT_MON;
if (gAbsentBankFlags & gBitTable[opposingBank])
opposingBank ^= BIT_MON;
opposingBank = Random() & BIT_FLANK;
if (gAbsentBattlerFlags & gBitTable[opposingBank])
opposingBank ^= BIT_FLANK;
}
else
{
opposingBank = GetBankByPosition(GetBankPosition(gActiveBank) ^ BIT_SIDE);
bankIn1 = gActiveBank;
bankIn2 = gActiveBank;
opposingBank = GetBattlerAtPosition(GetBattlerPosition(gActiveBattler) ^ BIT_SIDE);
bankIn1 = gActiveBattler;
bankIn2 = gActiveBattler;
}
if (gBattleTypeFlags & (BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_x800000))
{
if ((gActiveBank & BIT_MON) == 0)
if ((gActiveBattler & BIT_FLANK) == 0)
firstId = 0, lastId = 3;
else
firstId = 3, lastId = 6;
@ -688,7 +688,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
firstId = 0, lastId = 6;
}
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -734,7 +734,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
for (i = 0; i < 4; i++)
{
move = GetMonData(&party[bestMonId], MON_DATA_MOVE1 + i);
if (move != MOVE_NONE && TypeCalc(move, gActiveBank, opposingBank) & MOVE_RESULT_SUPER_EFFECTIVE)
if (move != MOVE_NONE && TypeCalc(move, gActiveBattler, opposingBank) & MOVE_RESULT_SUPER_EFFECTIVE)
break;
}
@ -779,8 +779,8 @@ u8 GetMostSuitableMonToSwitchInto(void)
gBattleMoveDamage = 0;
if (move != MOVE_NONE && gBattleMoves[move].power != 1)
{
AI_CalcDmg(gActiveBank, opposingBank);
TypeCalc(move, gActiveBank, opposingBank);
AI_CalcDmg(gActiveBattler, opposingBank);
TypeCalc(move, gActiveBattler, opposingBank);
}
if (bestDmg < gBattleMoveDamage)
{
@ -817,10 +817,10 @@ static bool8 ShouldUseItem(void)
u8 validMons = 0;
bool8 shouldUse = FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBankPosition(gActiveBank) == B_POSITION_PLAYER_RIGHT)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT)
return FALSE;
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
@ -855,14 +855,14 @@ static bool8 ShouldUseItem(void)
else
itemEffects = gItemEffectTable[item - 13];
*(gBattleStruct->AI_itemType + gActiveBank / 2) = GetAI_ItemType(item, itemEffects);
*(gBattleStruct->AI_itemType + gActiveBattler / 2) = GetAI_ItemType(item, itemEffects);
switch (*(gBattleStruct->AI_itemType + gActiveBank / 2))
switch (*(gBattleStruct->AI_itemType + gActiveBattler / 2))
{
case AI_ITEM_FULL_RESTORE:
if (gBattleMons[gActiveBank].hp >= gBattleMons[gActiveBank].maxHP / 4)
if (gBattleMons[gActiveBattler].hp >= gBattleMons[gActiveBattler].maxHP / 4)
break;
if (gBattleMons[gActiveBank].hp == 0)
if (gBattleMons[gActiveBattler].hp == 0)
break;
shouldUse = TRUE;
break;
@ -870,65 +870,65 @@ static bool8 ShouldUseItem(void)
paramOffset = GetItemEffectParamOffset(item, 4, 4);
if (paramOffset == 0)
break;
if (gBattleMons[gActiveBank].hp == 0)
if (gBattleMons[gActiveBattler].hp == 0)
break;
if (gBattleMons[gActiveBank].hp < gBattleMons[gActiveBank].maxHP / 4 || gBattleMons[gActiveBank].maxHP - gBattleMons[gActiveBank].hp > itemEffects[paramOffset])
if (gBattleMons[gActiveBattler].hp < gBattleMons[gActiveBattler].maxHP / 4 || gBattleMons[gActiveBattler].maxHP - gBattleMons[gActiveBattler].hp > itemEffects[paramOffset])
shouldUse = TRUE;
break;
case AI_ITEM_CURE_CONDITION:
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) = 0;
if (itemEffects[3] & 0x20 && gBattleMons[gActiveBank].status1 & STATUS1_SLEEP)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
if (itemEffects[3] & 0x20 && gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP)
{
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x20;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
shouldUse = TRUE;
}
if (itemEffects[3] & 0x10 && (gBattleMons[gActiveBank].status1 & STATUS1_POISON || gBattleMons[gActiveBank].status1 & STATUS1_TOXIC_POISON))
if (itemEffects[3] & 0x10 && (gBattleMons[gActiveBattler].status1 & STATUS1_POISON || gBattleMons[gActiveBattler].status1 & STATUS1_TOXIC_POISON))
{
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x10;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x10;
shouldUse = TRUE;
}
if (itemEffects[3] & 0x8 && gBattleMons[gActiveBank].status1 & STATUS1_BURN)
if (itemEffects[3] & 0x8 && gBattleMons[gActiveBattler].status1 & STATUS1_BURN)
{
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x8;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
shouldUse = TRUE;
}
if (itemEffects[3] & 0x4 && gBattleMons[gActiveBank].status1 & STATUS1_FREEZE)
if (itemEffects[3] & 0x4 && gBattleMons[gActiveBattler].status1 & STATUS1_FREEZE)
{
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x4;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
shouldUse = TRUE;
}
if (itemEffects[3] & 0x2 && gBattleMons[gActiveBank].status1 & STATUS1_PARALYSIS)
if (itemEffects[3] & 0x2 && gBattleMons[gActiveBattler].status1 & STATUS1_PARALYSIS)
{
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x2;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
shouldUse = TRUE;
}
if (itemEffects[3] & 0x1 && gBattleMons[gActiveBank].status2 & STATUS2_CONFUSION)
if (itemEffects[3] & 0x1 && gBattleMons[gActiveBattler].status2 & STATUS2_CONFUSION)
{
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x1;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
shouldUse = TRUE;
}
break;
case AI_ITEM_X_STAT:
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) = 0;
if (gDisableStructs[gActiveBank].isFirstTurn == 0)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) = 0;
if (gDisableStructs[gActiveBattler].isFirstTurn == 0)
break;
if (itemEffects[0] & 0xF)
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x1;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x1;
if (itemEffects[1] & 0xF0)
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x2;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x2;
if (itemEffects[1] & 0xF)
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x4;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x4;
if (itemEffects[2] & 0xF)
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x8;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
if (itemEffects[2] & 0xF0)
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x20;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
if (itemEffects[0] & 0x30)
*(gBattleStruct->AI_itemFlags + gActiveBank / 2) |= 0x80;
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x80;
shouldUse = TRUE;
break;
case AI_ITEM_GUARD_SPECS:
bankSide = GetBankSide(gActiveBank);
if (gDisableStructs[gActiveBank].isFirstTurn != 0 && gSideTimers[bankSide].mistTimer == 0)
bankSide = GetBattlerSide(gActiveBattler);
if (gDisableStructs[gActiveBattler].isFirstTurn != 0 && gSideTimers[bankSide].mistTimer == 0)
shouldUse = TRUE;
break;
case AI_ITEM_NOT_RECOGNIZABLE:
@ -938,7 +938,7 @@ static bool8 ShouldUseItem(void)
if (shouldUse)
{
EmitTwoReturnValues(1, ACTION_USE_ITEM, 0);
*(gBattleStruct->chosenItem + (gActiveBank / 2) * 2) = item;
*(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2) = item;
gBattleResources->battleHistory->trainerItems[i] = 0;
return shouldUse;
}

View File

@ -25,8 +25,8 @@
#define ANIM_SPRITE_INDEX_COUNT 8
extern u8 gBankAttacker;
extern u8 gBankDefender;
extern u8 gBattleAttacker;
extern u8 gBattleDefender;
extern u16 gBattle_WIN0H;
extern u16 gBattle_WIN0V;
extern u16 gBattle_WIN1H;
@ -35,8 +35,8 @@ extern u16 gBattle_BG1_X;
extern u16 gBattle_BG1_Y;
extern u16 gBattle_BG2_X;
extern u16 gBattle_BG2_Y;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT];
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
@ -132,7 +132,7 @@ EWRAM_DATA static u8 sAnimBackgroundFadeState = 0;
EWRAM_DATA static u16 sAnimMoveIndex = 0; // set but unused.
EWRAM_DATA u8 gAnimBankAttacker = 0;
EWRAM_DATA u8 gAnimBankTarget = 0;
EWRAM_DATA u16 gAnimSpeciesByBanks[BATTLE_BANKS_COUNT] = {0};
EWRAM_DATA u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gUnknown_02038440 = 0;
// const rom data
@ -221,8 +221,8 @@ void ClearBattleAnimationVars(void)
void DoMoveAnim(u16 move)
{
gAnimBankAttacker = gBankAttacker;
gAnimBankTarget = gBankDefender;
gAnimBankAttacker = gBattleAttacker;
gAnimBankTarget = gBattleDefender;
LaunchBattleAnimation(gBattleAnims_Moves, move, TRUE);
}
@ -234,9 +234,9 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
{
sub_80A8278();
UpdateOamPriorityInAllHealthboxes(0);
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (GetBankSide(i) != 0)
if (GetBattlerSide(i) != 0)
gAnimSpeciesByBanks[i] = GetMonData(&gEnemyParty[gBattlePartyID[i]], MON_DATA_SPECIES);
else
gAnimSpeciesByBanks[i] = GetMonData(&gPlayerParty[gBattlePartyID[i]], MON_DATA_SPECIES);
@ -613,7 +613,7 @@ static void ScriptCmd_monbg(void)
if (IsAnimBankSpriteVisible(bank))
{
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE;
else
@ -629,10 +629,10 @@ static void ScriptCmd_monbg(void)
}
bank ^= BIT_MON;
bank ^= BIT_FLANK;
if (IsAnimBankSpriteVisible(bank))
{
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE;
else
@ -718,7 +718,7 @@ void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible)
if (IsContest())
bankIdentity = 0;
else
bankIdentity = GetBankPosition(bank);
bankIdentity = GetBattlerPosition(bank);
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);
CpuCopy32(&gPlttBufferUnfaded[0x100 + bank * 16], (void*)(BG_PLTT + 0x120), 0x20);
sub_8118FBC(2, 0, 0, GetBankPosition(bank), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
sub_8118FBC(2, 0, 0, GetBattlerPosition(bank), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
}
}
@ -876,7 +876,7 @@ static void ScriptCmd_clearmonbg(void)
if (sMonAnimTaskIdArray[0] != 0xFF)
gSprites[gBankSpriteIds[bank]].invisible = 0;
if (animBankId > 1 && sMonAnimTaskIdArray[1] != 0xFF)
gSprites[gBankSpriteIds[bank ^ BIT_MON]].invisible = 0;
gSprites[gBankSpriteIds[bank ^ BIT_FLANK]].invisible = 0;
else
animBankId = 0;
@ -893,7 +893,7 @@ static void sub_80A4980(u8 taskId)
if (gTasks[taskId].data[1] != 1)
{
u8 to_BG2;
u8 position = GetBankPosition(gTasks[taskId].data[2]);
u8 position = GetBattlerPosition(gTasks[taskId].data[2]);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
to_BG2 = FALSE;
else
@ -937,7 +937,7 @@ static void ScriptCmd_monbg_22(void)
if (IsAnimBankSpriteVisible(bank))
{
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE;
else
@ -946,10 +946,10 @@ static void ScriptCmd_monbg_22(void)
sub_80A438C(bank, toBG_2, FALSE);
}
bank ^= BIT_MON;
bank ^= BIT_FLANK;
if (animBankId > 1 && IsAnimBankSpriteVisible(bank))
{
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE;
else
@ -982,8 +982,8 @@ static void ScriptCmd_clearmonbg_23(void)
if (IsAnimBankSpriteVisible(bank))
gSprites[gBankSpriteIds[bank]].invisible = 0;
if (animBankId > 1 && IsAnimBankSpriteVisible(bank ^ BIT_MON))
gSprites[gBankSpriteIds[bank ^ BIT_MON]].invisible = 0;
if (animBankId > 1 && IsAnimBankSpriteVisible(bank ^ BIT_FLANK))
gSprites[gBankSpriteIds[bank ^ BIT_FLANK]].invisible = 0;
else
animBankId = 0;
@ -1001,7 +1001,7 @@ static void sub_80A4BB0(u8 taskId)
{
bool8 toBG_2;
u8 bank = gTasks[taskId].data[2];
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
if (position == B_POSITION_OPPONENT_LEFT || position == B_POSITION_PLAYER_RIGHT || IsContest())
toBG_2 = FALSE;
else
@ -1009,7 +1009,7 @@ static void sub_80A4BB0(u8 taskId)
if (IsAnimBankSpriteVisible(bank))
sub_80A477C(toBG_2);
if (gTasks[taskId].data[0] > 1 && IsAnimBankSpriteVisible(bank ^ BIT_MON))
if (gTasks[taskId].data[0] > 1 && IsAnimBankSpriteVisible(bank ^ BIT_FLANK))
sub_80A477C(toBG_2 ^ 1);
DestroyTask(taskId);
@ -1145,7 +1145,7 @@ static void ScriptCmd_fadetobgfromset(void)
if (IsContest())
gTasks[taskId].tBackgroundId = bg3;
else if (GetBankSide(gAnimBankTarget) == SIDE_PLAYER)
else if (GetBattlerSide(gAnimBankTarget) == B_SIDE_PLAYER)
gTasks[taskId].tBackgroundId = bg2;
else
gTasks[taskId].tBackgroundId = bg1;
@ -1272,7 +1272,7 @@ s8 BattleAnimAdjustPanning(s8 pan)
{
if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive)
{
if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER)
if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER)
pan = PAN_SIDE_OPPONENT;
else
pan = PAN_SIDE_PLAYER;
@ -1282,9 +1282,9 @@ s8 BattleAnimAdjustPanning(s8 pan)
if (gAnimBankAttacker != gAnimBankTarget || gAnimBankAttacker != 2 || pan != PAN_SIDE_OPPONENT)
pan *= -1;
}
else if (GetBankSide(gAnimBankAttacker) == SIDE_PLAYER)
else if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER)
{
if (GetBankSide(gAnimBankTarget) == SIDE_PLAYER)
if (GetBattlerSide(gAnimBankTarget) == B_SIDE_PLAYER)
{
if (pan == PAN_SIDE_OPPONENT)
pan = PAN_SIDE_PLAYER;
@ -1292,7 +1292,7 @@ s8 BattleAnimAdjustPanning(s8 pan)
pan *= -1;
}
}
else if (GetBankSide(gAnimBankTarget) == SIDE_OPPONENT)
else if (GetBattlerSide(gAnimBankTarget) == B_SIDE_OPPONENT)
{
if (pan == PAN_SIDE_PLAYER)
pan = PAN_SIDE_OPPONENT;
@ -1314,14 +1314,14 @@ s8 BattleAnimAdjustPanning2(s8 pan)
{
if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gAnimBankAttacker].statusAnimActive)
{
if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER)
if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER)
pan = PAN_SIDE_OPPONENT;
else
pan = PAN_SIDE_PLAYER;
}
else
{
if (GetBankSide(gAnimBankAttacker) != SIDE_PLAYER || IsContest())
if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER || IsContest())
pan = -pan;
}
return pan;
@ -1705,7 +1705,7 @@ static void ScriptCmd_monbgprio_28(void)
else
bank = gAnimBankAttacker;
bankIdentity = GetBankPosition(bank);
bankIdentity = GetBattlerPosition(bank);
if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
{
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
@ -1731,14 +1731,14 @@ static void ScriptCmd_monbgprio_2A(void)
wantedBank = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (GetBankSide(gAnimBankAttacker) != GetBankSide(gAnimBankTarget))
if (GetBattlerSide(gAnimBankAttacker) != GetBattlerSide(gAnimBankTarget))
{
if (wantedBank != ANIM_ATTACKER)
bank = gAnimBankTarget;
else
bank = gAnimBankAttacker;
bankIdentity = GetBankPosition(bank);
bankIdentity = GetBattlerPosition(bank);
if (!IsContest() && (bankIdentity == B_POSITION_PLAYER_LEFT || bankIdentity == B_POSITION_OPPONENT_RIGHT))
{
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
@ -1778,7 +1778,7 @@ static void ScriptCmd_doublebattle_2D(void)
wantedBank = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (!IsContest() && IsDoubleBattle()
&& GetBankSide(gAnimBankAttacker) == GetBankSide(gAnimBankTarget))
&& GetBattlerSide(gAnimBankAttacker) == GetBattlerSide(gAnimBankTarget))
{
if (wantedBank == ANIM_ATTACKER)
{
@ -1813,7 +1813,7 @@ static void ScriptCmd_doublebattle_2E(void)
wantedBank = sBattleAnimScriptPtr[1];
sBattleAnimScriptPtr += 2;
if (!IsContest() && IsDoubleBattle()
&& GetBankSide(gAnimBankAttacker) == GetBankSide(gAnimBankTarget))
&& GetBattlerSide(gAnimBankAttacker) == GetBattlerSide(gAnimBankTarget))
{
if (wantedBank == ANIM_ATTACKER)
{

View File

@ -363,7 +363,7 @@ void sub_8035D74(u8 taskId)
case 0:
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
name = gLinkPlayers[i].name;
linkPlayer = &gLinkPlayers[i];

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -23,20 +23,20 @@
#include "pokeblock.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gBattleBanksCount;
extern u8 gActiveBattler;
extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gBattlersCount;
extern bool8 gDoingBattleAnim;
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void);
extern void (*gPreBattleCallback1)(void);
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200];
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern struct SpriteTemplate gUnknown_0202499C;
extern u16 gSpecialVar_ItemId;
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT];
extern u8 gBattleOutcome;
extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y;
@ -180,15 +180,15 @@ static void nullsub_114(void)
void SetControllerToSafari(void)
{
gBattleBankFunc[gActiveBank] = SafariBufferRunCommand;
gBattlerFuncs[gActiveBattler] = SafariBufferRunCommand;
}
static void SafariBufferRunCommand(void)
{
if (gBattleExecBuffer & gBitTable[gActiveBank])
if (gBattleExecBuffer & gBitTable[gActiveBattler])
{
if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sSafariBufferCommands))
sSafariBufferCommands[gBattleBufferA[gActiveBank][0]]();
if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sSafariBufferCommands))
sSafariBufferCommands[gBattleBufferA[gActiveBattler][0]]();
else
SafariBufferExecCompleted();
}
@ -200,7 +200,7 @@ static void HandleInputChooseAction(void)
{
PlaySE(SE_SELECT);
switch (gActionSelectionCursor[gActiveBank])
switch (gActionSelectionCursor[gActiveBattler])
{
case 0:
EmitTwoReturnValues(1, ACTION_SAFARI_ZONE_BALL, 0);
@ -219,49 +219,49 @@ static void HandleInputChooseAction(void)
}
else if (gMain.newKeys & DPAD_LEFT)
{
if (gActionSelectionCursor[gActiveBank] & 1)
if (gActionSelectionCursor[gActiveBattler] & 1)
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]);
gActionSelectionCursor[gActiveBank] ^= 1;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 1;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_RIGHT)
{
if (!(gActionSelectionCursor[gActiveBank] & 1))
if (!(gActionSelectionCursor[gActiveBattler] & 1))
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]);
gActionSelectionCursor[gActiveBank] ^= 1;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 1;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_UP)
{
if (gActionSelectionCursor[gActiveBank] & 2)
if (gActionSelectionCursor[gActiveBattler] & 2)
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]);
gActionSelectionCursor[gActiveBank] ^= 2;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 2;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_DOWN)
{
if (!(gActionSelectionCursor[gActiveBank] & 2))
if (!(gActionSelectionCursor[gActiveBattler] & 2))
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBank]);
gActionSelectionCursor[gActiveBank] ^= 2;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 2;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
}
static void CompleteOnBankSpriteCallbackDummy(void)
{
if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
SafariBufferExecCompleted();
}
@ -273,7 +273,7 @@ static void CompleteOnInactiveTextPrinter(void)
static void CompleteOnHealthboxSpriteCallbackDummy(void)
{
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy)
SafariBufferExecCompleted();
}
@ -289,7 +289,7 @@ static void sub_81595E4(void)
static void CompleteOnSpecialAnimDone(void)
{
if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
SafariBufferExecCompleted();
}
@ -297,7 +297,7 @@ static void SafariOpenPokeblockCase(void)
{
if (!gPaletteFade.active)
{
gBattleBankFunc[gActiveBank] = CompleteWhenChosePokeblock;
gBattlerFuncs[gActiveBattler] = CompleteWhenChosePokeblock;
FreeAllWindowBuffers();
OpenPokeblockCaseInBattle();
}
@ -314,29 +314,29 @@ static void CompleteWhenChosePokeblock(void)
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
SafariBufferExecCompleted();
}
static void SafariBufferExecCompleted(void)
{
gBattleBankFunc[gActiveBank] = SafariBufferRunCommand;
gBattlerFuncs[gActiveBattler] = SafariBufferRunCommand;
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP;
gBattleBufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP;
}
else
{
gBattleExecBuffer &= ~gBitTable[gActiveBank];
gBattleExecBuffer &= ~gBitTable[gActiveBattler];
}
}
static void CompleteOnFinishedStatusAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive)
SafariBufferExecCompleted();
}
@ -377,18 +377,18 @@ static void SafariHandleReturnMonToBall(void)
static void SafariHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBank);
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler);
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler));
gBankSpriteIds[gActiveBattler] = CreateSprite(
&gUnknown_0202499C,
80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
30);
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240;
gSprites[gBankSpriteIds[gActiveBank]].data[0] = -2;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC;
gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy;
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
}
static void SafariHandleTrainerSlide(void)
@ -415,18 +415,18 @@ static void SafariHandleSuccessBallThrowAnim(void)
{
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattlerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone;
}
static void SafariHandleBallThrowAnim(void)
{
u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1];
u8 ballThrowCaseId = gBattleBufferA[gActiveBattler][1];
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnSpecialAnimDone;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattlerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone;
}
static void SafariHandlePause(void)
@ -445,15 +445,15 @@ static void SafariHandlePrintString(void)
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBank][2]);
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter;
gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
}
static void SafariHandlePrintSelectionString(void)
{
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
SafariHandlePrintString();
else
SafariBufferExecCompleted();
@ -465,7 +465,7 @@ static void HandleChooseActionAfterDma3(void)
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 160;
gBattleBankFunc[gActiveBank] = HandleInputChooseAction;
gBattlerFuncs[gActiveBattler] = HandleInputChooseAction;
}
}
@ -473,13 +473,13 @@ static void SafariHandleChooseAction(void)
{
s32 i;
gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3;
gBattlerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
BattleHandleAddTextPrinter(gText_SafariZoneMenu, 2);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 1);
}
@ -499,8 +499,8 @@ static void SafariHandleChooseItem(void)
s32 i;
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gBattleBankFunc[gActiveBank] = SafariOpenPokeblockCase;
gBankInMenu = gActiveBank;
gBattlerFuncs[gActiveBattler] = SafariOpenPokeblockCase;
gBankInMenu = gActiveBattler;
}
static void SafariHandleChoosePokemon(void)
@ -525,7 +525,7 @@ static void SafariHandleExpUpdate(void)
static void SafariHandleStatusIconUpdate(void)
{
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_BALLS_TEXT);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_SAFARI_BALLS_TEXT);
SafariBufferExecCompleted();
}
@ -613,25 +613,25 @@ static void SafariHandlePlaySE(void)
{
s8 pan;
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
else
pan = PAN_SIDE_OPPONENT;
PlaySE12WithPanning(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8), pan);
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
SafariBufferExecCompleted();
}
static void SafariHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
if (gBattleBufferA[gActiveBattler][3])
{
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
PlayBGM(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
}
else
{
PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
PlayFanfare(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
}
SafariBufferExecCompleted();
@ -639,7 +639,7 @@ static void SafariHandlePlayFanfareOrBGM(void)
static void SafariHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES);
PlayCry1(species, 25);
SafariBufferExecCompleted();
@ -647,17 +647,17 @@ static void SafariHandleFaintingCry(void)
static void SafariHandleIntroSlide(void)
{
HandleIntroSlide(gBattleBufferA[gActiveBank][1]);
HandleIntroSlide(gBattleBufferA[gActiveBattler][1]);
gUnknown_020243FC |= 1;
SafariBufferExecCompleted();
}
static void SafariHandleIntroTrainerBallThrow(void)
{
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_SAFARI_ALL_TEXT);
sub_8076918(gActiveBank);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]);
gBattleBankFunc[gActiveBank] = CompleteOnHealthboxSpriteCallbackDummy;
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT);
sub_8076918(gActiveBattler);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]);
gBattlerFuncs[gActiveBattler] = CompleteOnHealthboxSpriteCallbackDummy;
}
static void SafariHandleDrawPartyStatusSummary(void)
@ -682,13 +682,13 @@ static void SafariHandleSpriteInvisibility(void)
static void SafariHandleBattleAnimation(void)
{
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
u8 animationId = gBattleBufferA[gActiveBattler][1];
u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
SafariBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
}
static void SafariHandleLinkStandbyMsg(void)
@ -703,12 +703,12 @@ static void SafariHandleResetActionMoveSelection(void)
static void SafariHandleCmd55(void)
{
gBattleOutcome = gBattleBufferA[gActiveBank][1];
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
FadeOutMapMusic(5);
BeginFastPaletteFade(3);
SafariBufferExecCompleted();
if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_WILD))
gBattleBankFunc[gActiveBank] = sub_81595E4;
gBattlerFuncs[gActiveBattler] = sub_81595E4;
}
static void nullsub_115(void)

View File

@ -29,26 +29,26 @@
#include "party_menu.h"
extern u32 gBattleExecBuffer;
extern u8 gActiveBank;
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gAbsentBankFlags;
extern u8 gBattleBanksCount;
extern u8 gActiveBattler;
extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gAbsentBattlerFlags;
extern u8 gBattlersCount;
extern bool8 gDoingBattleAnim;
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200];
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void);
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
extern u8 gMultiUsePlayerCursor;
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern u16 gPartnerTrainerId;
extern struct SpriteTemplate gUnknown_0202499C;
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
extern u16 gSpecialVar_ItemId;
extern u8 gUnknown_03005D7C[BATTLE_BANKS_COUNT];
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT];
extern u8 gBattleOutcome;
extern u8 gNumberOfMovesToChoose;
extern u16 gBattle_BG0_X;
@ -56,7 +56,7 @@ extern u16 gBattle_BG0_Y;
extern s32 gUnknown_0203CD70;
extern u8 gBankInMenu;
extern u32 gBattlePalaceMoveSelectionRngValue;
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
extern u8 gUnknown_020244B4[];
extern u16 gUnknown_020243FC;
extern struct UnusedControllerStruct gUnknown_02022D0C;
@ -204,7 +204,7 @@ static void nullsub_117(void)
void SetControllerToWally(void)
{
gBattleBankFunc[gActiveBank] = WallyBufferRunCommand;
gBattlerFuncs[gActiveBattler] = WallyBufferRunCommand;
gBattleStruct->wallyBattleState = 0;
gBattleStruct->wallyMovesState = 0;
gBattleStruct->wallyWaitFrames = 0;
@ -213,10 +213,10 @@ void SetControllerToWally(void)
static void WallyBufferRunCommand(void)
{
if (gBattleExecBuffer & gBitTable[gActiveBank])
if (gBattleExecBuffer & gBitTable[gActiveBattler])
{
if (gBattleBufferA[gActiveBank][0] < ARRAY_COUNT(sWallyBufferCommands))
sWallyBufferCommands[gBattleBufferA[gActiveBank][0]]();
if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sWallyBufferCommands))
sWallyBufferCommands[gBattleBufferA[gActiveBattler][0]]();
else
WallyBufferExecCompleted();
}
@ -284,7 +284,7 @@ static void WallyHandleActions(void)
static void CompleteOnBankSpriteCallbackDummy(void)
{
if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
WallyBufferExecCompleted();
}
@ -304,7 +304,7 @@ static void OpenBagAfterPaletteFade(void)
{
if (!gPaletteFade.active)
{
gBattleBankFunc[gActiveBank] = CompleteOnChosenItem;
gBattlerFuncs[gActiveBattler] = CompleteOnChosenItem;
nullsub_35();
FreeAllWindowBuffers();
DoWallyTutorialBagMenu();
@ -322,30 +322,30 @@ static void CompleteOnChosenItem(void)
static void sub_816864C(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive)
sub_8172EF0(gActiveBank, &gPlayerParty[gBattlePartyID[gActiveBank]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive)
sub_8172EF0(gActiveBank ^ BIT_MON, &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 && !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive)
sub_8172EF0(gActiveBattler ^ BIT_FLANK, &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]]);
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].ballAnimActive
&& gSprites[gUnknown_03005D7C[gActiveBank]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
{
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank ^ BIT_MON]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank ^ BIT_MON], &gPlayerParty[gBattlePartyID[gActiveBank ^ BIT_MON]], HEALTHBOX_ALL);
sub_8076918(gActiveBank ^ BIT_MON);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank ^ BIT_MON]);
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
sub_8076918(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]);
}
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBank]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBank], &gPlayerParty[gBattlePartyID[gActiveBank]], HEALTHBOX_ALL);
sub_8076918(gActiveBank);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]);
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL);
sub_8076918(gActiveBattler);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]);
gBattleSpritesDataPtr->animationData->field_9_x1 = 0;
gBattleBankFunc[gActiveBank] = sub_8168818;
gBattlerFuncs[gActiveBattler] = sub_8168818;
}
}
@ -354,23 +354,23 @@ static void sub_8168818(void)
{
bool32 r4 = FALSE;
if (gSprites[gHealthBoxesIds[gActiveBank]].callback == SpriteCallbackDummy)
if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy)
r4 = TRUE;
if (r4 && gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1)
if (r4 && gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1
&& gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x1)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_1_x1 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank ^ BIT_MON].field_1_x1 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].field_1_x1 = 0;
FreeSpriteTilesByTag(0x27F9);
FreeSpritePaletteByTag(0x27F9);
CreateTask(c3_0802FDF4, 10);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
WallyBufferExecCompleted();
}
@ -378,24 +378,24 @@ static void sub_8168818(void)
static void CompleteOnHealthbarDone(void)
{
s16 hpValue = sub_8074AA0(gActiveBank, gHealthBoxesIds[gActiveBank], HEALTH_BAR, 0);
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBank]);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]);
if (hpValue != -1)
{
UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], hpValue, HP_CURRENT);
UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT);
}
else
{
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
WallyBufferExecCompleted();
}
}
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBankSpriteIds[gActiveBank];
u8 spriteId = gBankSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
@ -414,46 +414,46 @@ static void DoHitAnimBlinkSpriteEffect(void)
static void sub_8168A20(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]);
WallyBufferExecCompleted();
}
}
static void CompleteOnBankSpriteCallbackDummy2(void)
{
if (gSprites[gBankSpriteIds[gActiveBank]].callback == SpriteCallbackDummy)
if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
WallyBufferExecCompleted();
}
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animFromTableActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
WallyBufferExecCompleted();
}
static void WallyBufferExecCompleted(void)
{
gBattleBankFunc[gActiveBank] = WallyBufferRunCommand;
gBattlerFuncs[gActiveBattler] = WallyBufferRunCommand;
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleBufferA[gActiveBank][0] = CONTROLLER_TERMINATOR_NOP;
gBattleBufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP;
}
else
{
gBattleExecBuffer &= ~gBitTable[gActiveBank];
gBattleExecBuffer &= ~gBitTable[gActiveBattler];
}
}
static void CompleteOnFinishedStatusAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive)
WallyBufferExecCompleted();
}
@ -464,13 +464,13 @@ static void WallyHandleGetMonData(void)
u8 monToCheck;
s32 i;
if (gBattleBufferA[gActiveBank][2] == 0)
if (gBattleBufferA[gActiveBattler][2] == 0)
{
size += CopyWallyMonData(gBattlePartyID[gActiveBank], monData);
size += CopyWallyMonData(gBattlePartyID[gActiveBattler], monData);
}
else
{
monToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBattler][2];
for (i = 0; i < 6; i++)
{
if (monToCheck & 1)
@ -492,7 +492,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
u32 data32;
s32 size = 0;
switch (gBattleBufferA[gActiveBank][1])
switch (gBattleBufferA[gActiveBattler][1])
{
case REQUEST_ALL_BATTLE:
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
@ -558,7 +558,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
case REQUEST_MOVE2_BATTLE:
case REQUEST_MOVE3_BATTLE:
case REQUEST_MOVE4_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE);
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
@ -573,7 +573,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
case REQUEST_PPMOVE2_BATTLE:
case REQUEST_PPMOVE3_BATTLE:
case REQUEST_PPMOVE4_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE);
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
size = 1;
break;
case REQUEST_OTID_BATTLE:
@ -798,13 +798,13 @@ static void WallyHandleSetMonData(void)
u8 monToCheck;
u8 i;
if (gBattleBufferA[gActiveBank][2] == 0)
if (gBattleBufferA[gActiveBattler][2] == 0)
{
SetWallyMonData(gBattlePartyID[gActiveBank]);
SetWallyMonData(gBattlePartyID[gActiveBattler]);
}
else
{
monToCheck = gBattleBufferA[gActiveBank][2];
monToCheck = gBattleBufferA[gActiveBattler][2];
for (i = 0; i < 6; i++)
{
if (monToCheck & 1)
@ -817,11 +817,11 @@ static void WallyHandleSetMonData(void)
static void SetWallyMonData(u8 monId)
{
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBank][3];
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBank][3];
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBattler][3];
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBattler][3];
s32 i;
switch (gBattleBufferA[gActiveBank][1])
switch (gBattleBufferA[gActiveBattler][1])
{
case REQUEST_ALL_BATTLE:
{
@ -862,10 +862,10 @@ static void SetWallyMonData(u8 monId)
}
break;
case REQUEST_SPECIES_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_HELDITEM_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_MOVES_PP_BATTLE:
for (i = 0; i < 4; i++)
@ -879,158 +879,158 @@ static void SetWallyMonData(u8 monId)
case REQUEST_MOVE2_BATTLE:
case REQUEST_MOVE3_BATTLE:
case REQUEST_MOVE4_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBank][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_PP_DATA_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBank][4]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBank][5]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBank][6]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBank][7]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBattler][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBattler][4]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBattler][5]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBattler][6]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBattler][7]);
break;
case REQUEST_PPMOVE1_BATTLE:
case REQUEST_PPMOVE2_BATTLE:
case REQUEST_PPMOVE3_BATTLE:
case REQUEST_PPMOVE4_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBank][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_OTID_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_EXP_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_HP_EV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_ATK_EV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_DEF_EV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPEED_EV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPATK_EV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPDEF_EV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_FRIENDSHIP_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_POKERUS_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_MET_LOCATION_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_MET_LEVEL_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_MET_GAME_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_POKEBALL_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_ALL_IVS_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][4]);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][5]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][6]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][7]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][8]);
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBattler][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBattler][4]);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBattler][5]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBattler][6]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBattler][7]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBattler][8]);
break;
case REQUEST_HP_IV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_ATK_IV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_DEF_IV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPEED_IV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPATK_IV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPDEF_IV_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_PERSONALITY_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_CHECKSUM_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_STATUS_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_LEVEL_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_HP_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_MAX_HP_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_ATK_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_DEF_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPEED_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPATK_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SPDEF_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_COOL_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_BEAUTY_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_CUTE_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SMART_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_TOUGH_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SHEEN_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_COOL_RIBBON_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_BEAUTY_RIBBON_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_CUTE_RIBBON_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_SMART_RIBBON_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBattler][3]);
break;
case REQUEST_TOUGH_RIBBON_BATTLE:
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBank][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBattler][3]);
break;
}
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBank]], gActiveBank);
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
}
static void WallyHandleSetRawMonData(void)
@ -1050,48 +1050,48 @@ static void WallyHandleSwitchInAnim(void)
static void WallyHandleReturnMonToBall(void)
{
if (gBattleBufferA[gActiveBank][1] == 0)
if (gBattleBufferA[gActiveBattler][1] == 0)
{
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattleBankFunc[gActiveBank] = sub_8168A20;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattlerFuncs[gActiveBattler] = sub_8168A20;
}
else
{
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBank]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBank]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBank]);
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]);
WallyBufferExecCompleted();
}
}
static void WallyHandleDrawTrainerPic(void)
{
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank);
sub_806A12C(BACK_PIC_WALLY, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBattler);
sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
80,
80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords),
30);
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = 240;
gSprites[gBankSpriteIds[gActiveBank]].data[0] = -2;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC;
gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy;
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
}
static void WallyHandleTrainerSlide(void)
{
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBank);
sub_806A12C(BACK_PIC_WALLY, GetBankPosition(gActiveBank));
gBankSpriteIds[gActiveBank] = CreateSprite(&gUnknown_0202499C,
DecompressTrainerBackPic(BACK_PIC_WALLY, gActiveBattler);
sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
80,
80 + 4 * (8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords),
30);
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = gActiveBank;
gSprites[gBankSpriteIds[gActiveBank]].pos2.x = -96;
gSprites[gBankSpriteIds[gActiveBank]].data[0] = 2;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_805D7AC;
gBattleBankFunc[gActiveBank] = CompleteOnBankSpriteCallbackDummy2;
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -96;
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 2;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy2;
}
static void WallyHandleTrainerSlideBack(void)
@ -1113,18 +1113,18 @@ static void WallyHandleSuccessBallThrowAnim(void)
{
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedAnimation;
}
static void WallyHandleBallThrowAnim(void)
{
u8 ballThrowCaseId = gBattleBufferA[gActiveBank][1];
u8 ballThrowCaseId = gBattleBufferA[gActiveBattler][1];
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE;
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, GetBankByPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattleBankFunc[gActiveBank] = CompleteOnFinishedAnimation;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedAnimation;
}
static void WallyHandlePause(void)
@ -1134,46 +1134,46 @@ static void WallyHandlePause(void)
static void WallyHandleMoveAnimation(void)
{
u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8);
u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleBufferA[gActiveBank][3];
gAnimMovePower = gBattleBufferA[gActiveBank][4] | (gBattleBufferA[gActiveBank][5] << 8);
gAnimMoveDmg = gBattleBufferA[gActiveBank][6] | (gBattleBufferA[gActiveBank][7] << 8) | (gBattleBufferA[gActiveBank][8] << 16) | (gBattleBufferA[gActiveBank][9] << 24);
gAnimFriendship = gBattleBufferA[gActiveBank][10];
gWeatherMoveAnim = gBattleBufferA[gActiveBank][12] | (gBattleBufferA[gActiveBank][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBank][16];
gTransformedPersonalities[gActiveBank] = gAnimDisableStructPtr->transformedMonPersonality;
gAnimMoveTurn = gBattleBufferA[gActiveBattler][3];
gAnimMovePower = gBattleBufferA[gActiveBattler][4] | (gBattleBufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleBufferA[gActiveBattler][6] | (gBattleBufferA[gActiveBattler][7] << 8) | (gBattleBufferA[gActiveBattler][8] << 16) | (gBattleBufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleBufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleBufferA[gActiveBattler][12] | (gBattleBufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE
{
WallyBufferExecCompleted();
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
gBattleBankFunc[gActiveBank] = WallyDoMoveAnimation;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerFuncs[gActiveBattler] = WallyDoMoveAnimation;
}
}
static void WallyDoMoveAnimation(void)
{
u16 move = gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8);
u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8);
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState)
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute)
{
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_SUBSTITUTE_TO_MON);
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
sub_805EB9C(0);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 2;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
@ -1181,19 +1181,19 @@ static void WallyDoMoveAnimation(void)
if (!gAnimScriptActive)
{
sub_805EB9C(1);
if (gBattleSpritesDataPtr->bankData[gActiveBank].behindSubstitute)
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute)
{
InitAndLaunchSpecialAnimation(gActiveBank, gActiveBank, gActiveBank, B_ANIM_MON_TO_SUBSTITUTE);
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 3;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBank].specialAnimActive)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBank, gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].animationState = 0;
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
WallyBufferExecCompleted();
}
break;
@ -1206,15 +1206,15 @@ static void WallyHandlePrintString(void)
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
stringId = (u16*)(&gBattleBufferA[gActiveBank][2]);
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gBattleBankFunc[gActiveBank] = CompleteOnInactiveTextPrinter;
gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
}
static void WallyHandlePrintSelectionString(void)
{
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
WallyHandlePrintString();
else
WallyBufferExecCompleted();
@ -1226,7 +1226,7 @@ static void HandleChooseActionAfterDma3(void)
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 160;
gBattleBankFunc[gActiveBank] = WallyHandleActions;
gBattlerFuncs[gActiveBattler] = WallyHandleActions;
}
}
@ -1234,13 +1234,13 @@ static void WallyHandleChooseAction(void)
{
s32 i;
gBattleBankFunc[gActiveBank] = HandleChooseActionAfterDma3;
gBattlerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
BattleHandleAddTextPrinter(gText_BattleMenu, 2);
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBank], 0);
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillWallyDo);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 1);
}
@ -1281,8 +1281,8 @@ static void WallyHandleChooseMove(void)
static void WallyHandleChooseItem(void)
{
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
gBattleBankFunc[gActiveBank] = OpenBagAfterPaletteFade;
gBankInMenu = gActiveBank;
gBattlerFuncs[gActiveBattler] = OpenBagAfterPaletteFade;
gBankInMenu = gActiveBattler;
}
static void WallyHandleChoosePokemon(void)
@ -1300,24 +1300,24 @@ static void WallyHandleHealthBarUpdate(void)
s16 hpVal;
LoadBattleBarGfx(0);
hpVal = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
hpVal = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
if (hpVal != INSTANT_HP_BAR_DROP)
{
u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP);
u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_HP);
u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP);
u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP);
SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, curHP, hpVal);
SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal);
}
else
{
u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_MAX_HP);
u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP);
SetBattleBarStruct(gActiveBank, gHealthBoxesIds[gActiveBank], maxHP, 0, hpVal);
UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBank], 0, HP_CURRENT);
SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal);
UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], 0, HP_CURRENT);
}
gBattleBankFunc[gActiveBank] = CompleteOnHealthbarDone;
gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone;
}
static void WallyHandleExpUpdate(void)
@ -1402,16 +1402,16 @@ static void WallyHandleCmd40(void)
static void WallyHandleHitAnimation(void)
{
if (gSprites[gBankSpriteIds[gActiveBank]].invisible == TRUE)
if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE)
{
WallyBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBankSpriteIds[gActiveBank]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBank);
gBattleBankFunc[gActiveBank] = DoHitAnimBlinkSpriteEffect;
gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
@ -1422,20 +1422,20 @@ static void WallyHandleCmd42(void)
static void WallyHandlePlaySE(void)
{
PlaySE(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
PlaySE(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
WallyBufferExecCompleted();
}
static void WallyHandlePlayFanfareOrBGM(void)
{
if (gBattleBufferA[gActiveBank][3])
if (gBattleBufferA[gActiveBattler][3])
{
BattleStopLowHpSound();
PlayBGM(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
PlayBGM(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
}
else
{
PlayFanfare(gBattleBufferA[gActiveBank][1] | (gBattleBufferA[gActiveBank][2] << 8));
PlayFanfare(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
}
WallyBufferExecCompleted();
@ -1443,7 +1443,7 @@ static void WallyHandlePlayFanfareOrBGM(void)
static void WallyHandleFaintingCry(void)
{
u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBank]], MON_DATA_SPECIES);
u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES);
PlayCry1(species, 25);
WallyBufferExecCompleted();
@ -1451,7 +1451,7 @@ static void WallyHandleFaintingCry(void)
static void WallyHandleIntroSlide(void)
{
HandleIntroSlide(gBattleBufferA[gActiveBank][1]);
HandleIntroSlide(gBattleBufferA[gActiveBattler][1]);
gUnknown_020243FC |= 1;
WallyBufferExecCompleted();
}
@ -1461,29 +1461,29 @@ static void WallyHandleIntroTrainerBallThrow(void)
u8 paletteNum;
u8 taskId;
oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBank]]);
oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]);
gSprites[gBankSpriteIds[gActiveBank]].data[0] = 50;
gSprites[gBankSpriteIds[gActiveBank]].data[2] = -40;
gSprites[gBankSpriteIds[gActiveBank]].data[4] = gSprites[gBankSpriteIds[gActiveBank]].pos1.y;
gSprites[gBankSpriteIds[gActiveBank]].callback = sub_80A6EEC;
gSprites[gBankSpriteIds[gActiveBank]].data[5] = gActiveBank;
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBank]], sub_805CC00);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBank]], 1);
StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1);
paletteNum = AllocSpritePalette(0xD6F8);
LoadCompressedPalette(gTrainerBackPicPaletteTable[BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32);
gSprites[gBankSpriteIds[gActiveBank]].oam.paletteNum = paletteNum;
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;
taskId = CreateTask(sub_816AC04, 5);
gTasks[taskId].data[0] = gActiveBank;
gTasks[taskId].data[0] = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1)
gTasks[gUnknown_020244B4[gActiveBank]].func = sub_8073C30;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30;
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
gBattleBankFunc[gActiveBank] = nullsub_21;
gBattlerFuncs[gActiveBattler] = nullsub_21;
}
static void sub_816AA80(u8 bank)
@ -1494,7 +1494,7 @@ static void sub_816AA80(u8 bank)
gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
sub_806A068(species, GetBankPosition(bank));
sub_806A068(species, GetBattlerPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C,
GetBankCoord(bank, 2),
GetBankSpriteDefault_Y(bank),
@ -1521,27 +1521,27 @@ static void sub_816AC04(u8 taskId)
}
else
{
u8 savedActiveBank = gActiveBank;
u8 savedActiveBank = gActiveBattler;
gActiveBank = gTasks[taskId].data[0];
gBattleBufferA[gActiveBank][1] = gBattlePartyID[gActiveBank];
sub_816AA80(gActiveBank);
gBattleBankFunc[gActiveBank] = sub_816864C;
gActiveBank = savedActiveBank;
gActiveBattler = gTasks[taskId].data[0];
gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler];
sub_816AA80(gActiveBattler);
gBattlerFuncs[gActiveBattler] = sub_816864C;
gActiveBattler = savedActiveBank;
DestroyTask(taskId);
}
}
static void WallyHandleDrawPartyStatusSummary(void)
{
if (gBattleBufferA[gActiveBank][1] != 0 && GetBankSide(gActiveBank) == SIDE_PLAYER)
if (gBattleBufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
WallyBufferExecCompleted();
}
else
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].flag_x1 = 1;
gUnknown_020244B4[gActiveBank] = CreatePartyStatusSummarySprites(gActiveBank, (struct HpAndStatus *)&gBattleBufferA[gActiveBank][4], gBattleBufferA[gActiveBank][1], gBattleBufferA[gActiveBank][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gUnknown_020244B4[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
WallyBufferExecCompleted();
}
}
@ -1563,13 +1563,13 @@ static void WallyHandleSpriteInvisibility(void)
static void WallyHandleBattleAnimation(void)
{
u8 animationId = gBattleBufferA[gActiveBank][1];
u16 argument = gBattleBufferA[gActiveBank][2] | (gBattleBufferA[gActiveBank][3] << 8);
u8 animationId = gBattleBufferA[gActiveBattler][1];
u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBank, gActiveBank, gActiveBank, animationId, argument))
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
WallyBufferExecCompleted();
else
gBattleBankFunc[gActiveBank] = CompleteOnFinishedBattleAnimation;
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
}
static void WallyHandleLinkStandbyMsg(void)
@ -1584,13 +1584,13 @@ static void WallyHandleResetActionMoveSelection(void)
static void WallyHandleCmd55(void)
{
gBattleOutcome = gBattleBufferA[gActiveBank][1];
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
FadeOutMapMusic(5);
BeginFastPaletteFade(3);
WallyBufferExecCompleted();
if (!(gBattleTypeFlags & BATTLE_TYPE_WILD) && gBattleTypeFlags & BATTLE_TYPE_LINK)
gBattleBankFunc[gActiveBank] = sub_80587B0;
gBattlerFuncs[gActiveBattler] = sub_80587B0;
}
static void nullsub_118(void)

View File

@ -15,28 +15,28 @@
extern u32 gBattleTypeFlags;
extern u32 gBattleExecBuffer;
extern void (*gBattleMainFunc)(void);
extern void (*gBattleBankFunc[BATTLE_BANKS_COUNT])(void);
extern u8 gBankPositions[BATTLE_BANKS_COUNT];
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gBattleBanksCount;
extern u8 gActiveBank;
extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void);
extern u8 gBattlerPositions[MAX_BATTLERS_COUNT];
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gBattlersCount;
extern u8 gActiveBattler;
extern u8 gUnknown_0202428C;
extern u32 gUnknown_02022FF4;
extern u8 gUnknown_0203C7B4;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200];
extern u8 gBattleBufferB[BATTLE_BANKS_COUNT][0x200];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
extern u8 gBattleBuffersTransferData[0x100];
extern u8 gUnknown_02022D08;
extern u8 gUnknown_02022D09;
extern u8 gUnknown_02022D0A;
extern u8 gBankAttacker;
extern u8 gBankDefender;
extern u8 gAbsentBankFlags;
extern u8 gBattleAttacker;
extern u8 gBattleDefender;
extern u8 gAbsentBattlerFlags;
extern u8 gEffectBank;
extern u16 gBattleWeather;
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u16 gCurrentMove;
extern u16 gChosenMove;
extern u16 gLastUsedItem;
@ -76,10 +76,10 @@ void SetUpBattleVarsAndBirchZigzagoon(void)
gBattleMainFunc = nullsub_20;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
gBattleBankFunc[i] = nullsub_21;
gBankPositions[i] = 0xFF;
gBattlerFuncs[i] = nullsub_21;
gBattlerPositions[i] = 0xFF;
gActionSelectionCursor[i] = 0;
gMoveSelectionCursor[i] = 0;
}
@ -124,7 +124,7 @@ void sub_8032768(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
for (i = 0; i < gBattleBanksCount; i++)
for (i = 0; i < gBattlersCount; i++)
sub_81B8D64(i, 0);
}
@ -145,34 +145,34 @@ static void SetControllersVariables(void)
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToRecordedPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayerPartner;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToPlayerPartner;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
}
else
{
gBattleBankFunc[0] = SetControllerToPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayerPartner;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToPlayerPartner;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
}
gBattleBanksCount = 4;
gBattlersCount = 4;
sub_81B8D64(0, 0);
sub_81B8D64(1, 0);
@ -189,18 +189,18 @@ static void SetControllersVariables(void)
gBattleMainFunc = BeginBattleIntro;
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
gBattleBankFunc[0] = SetControllerToSafari;
gBattlerFuncs[0] = SetControllerToSafari;
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL)
gBattleBankFunc[0] = SetControllerToWally;
gBattlerFuncs[0] = SetControllerToWally;
else
gBattleBankFunc[0] = SetControllerToPlayer;
gBattlerFuncs[0] = SetControllerToPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBanksCount = 2;
gBattlersCount = 2;
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
@ -210,32 +210,32 @@ static void SetControllersVariables(void)
{
gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToRecordedPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToRecordedOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToRecordedOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBanksCount = 2;
gBattlersCount = 2;
}
else // see how the banks are switched
{
gBattleBankFunc[1] = SetControllerToRecordedPlayer;
gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[1] = SetControllerToRecordedPlayer;
gBattlerPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[0] = SetControllerToRecordedOpponent;
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[0] = SetControllerToRecordedOpponent;
gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBanksCount = 2;
gBattlersCount = 2;
}
}
else
{
gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToRecordedPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
}
}
}
@ -243,19 +243,19 @@ static void SetControllersVariables(void)
{
gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayer;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToPlayer;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattleBanksCount = 4;
gBattlersCount = 4;
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
{
@ -263,19 +263,19 @@ static void SetControllersVariables(void)
{
gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBankPositions[0] = 0;
gBattlerFuncs[0] = SetControllerToRecordedPlayer;
gBattlerPositions[0] = 0;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = 1;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = 1;
gBattleBankFunc[2] = SetControllerToRecordedPlayer;
gBankPositions[2] = 2;
gBattlerFuncs[2] = SetControllerToRecordedPlayer;
gBattlerPositions[2] = 2;
gBattleBankFunc[3] = SetControllerToOpponent;
gBankPositions[3] = 3;
gBattlerFuncs[3] = SetControllerToOpponent;
gBattlerPositions[3] = 3;
gBattleBanksCount = 4;
gBattlersCount = 4;
sub_81B8D64(0, 0);
sub_81B8D64(1, 0);
@ -291,7 +291,7 @@ static void SetControllersVariables(void)
{
u8 var; // multiplayer Id in a recorded battle?
for (var = gUnknown_0203C7B4, i = 0; i < BATTLE_BANKS_COUNT; i++)
for (var = gUnknown_0203C7B4, i = 0; i < MAX_BATTLERS_COUNT; i++)
{
switch (gLinkPlayers[i].lp_field_18)
{
@ -307,17 +307,17 @@ static void SetControllersVariables(void)
if (i == var)
{
gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer;
gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer;
switch (gLinkPlayers[i].lp_field_18)
{
case 0:
case 3:
gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break;
case 1:
case 2:
gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break;
}
@ -325,34 +325,34 @@ static void SetControllersVariables(void)
else if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[var].lp_field_18 & 1))
|| ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[var].lp_field_18 & 1)))
{
gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer;
gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedPlayer;
switch (gLinkPlayers[i].lp_field_18)
{
case 0:
case 3:
gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_LEFT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break;
case 1:
case 2:
gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_PLAYER_RIGHT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break;
}
}
else
{
gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent;
gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToRecordedOpponent;
switch (gLinkPlayers[i].lp_field_18)
{
case 0:
case 3:
gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_LEFT;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_LEFT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break;
case 1:
case 2:
gBankPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_RIGHT;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = B_POSITION_OPPONENT_RIGHT;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break;
}
@ -361,52 +361,52 @@ static void SetControllersVariables(void)
}
else if (gBattleTypeFlags & BATTLE_TYPE_WILD)
{
gBattleBankFunc[0] = SetControllerToRecordedPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToRecordedPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[2] = SetControllerToRecordedPlayer;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToRecordedPlayer;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{
gBattleBankFunc[1] = SetControllerToRecordedOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToRecordedOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[3] = SetControllerToRecordedOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToRecordedOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
}
else
{
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[3] = SetControllerToOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
}
}
else
{
gBattleBankFunc[1] = SetControllerToRecordedPlayer;
gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[1] = SetControllerToRecordedPlayer;
gBattlerPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[3] = SetControllerToRecordedPlayer;
gBankPositions[3] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[3] = SetControllerToRecordedPlayer;
gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT;
if (gBattleTypeFlags & BATTLE_TYPE_x2000000)
{
gBattleBankFunc[0] = SetControllerToRecordedOpponent;
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[0] = SetControllerToRecordedOpponent;
gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToRecordedOpponent;
gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[2] = SetControllerToRecordedOpponent;
gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT;
}
else
{
gBattleBankFunc[0] = SetControllerToOpponent;
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[0] = SetControllerToOpponent;
gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToOpponent;
gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[2] = SetControllerToOpponent;
gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT;
}
}
}
@ -424,23 +424,23 @@ static void SetControllersVariablesInLinkBattle(void)
{
gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToLinkOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToLinkOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBanksCount = 2;
gBattlersCount = 2;
}
else
{
gBattleBankFunc[1] = SetControllerToPlayer;
gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[1] = SetControllerToPlayer;
gBattlerPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[0] = SetControllerToLinkOpponent;
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[0] = SetControllerToLinkOpponent;
gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBanksCount = 2;
gBattlersCount = 2;
}
}
else if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
@ -449,35 +449,35 @@ static void SetControllersVariablesInLinkBattle(void)
{
gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToLinkOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToLinkOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayer;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToPlayer;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToLinkOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToLinkOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattleBanksCount = 4;
gBattlersCount = 4;
}
else
{
gBattleBankFunc[1] = SetControllerToPlayer;
gBankPositions[1] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[1] = SetControllerToPlayer;
gBattlerPositions[1] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[0] = SetControllerToLinkOpponent;
gBankPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[0] = SetControllerToLinkOpponent;
gBattlerPositions[0] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[3] = SetControllerToPlayer;
gBankPositions[3] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[3] = SetControllerToPlayer;
gBattlerPositions[3] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[2] = SetControllerToLinkOpponent;
gBankPositions[2] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[2] = SetControllerToLinkOpponent;
gBattlerPositions[2] = B_POSITION_OPPONENT_RIGHT;
gBattleBanksCount = 4;
gBattlersCount = 4;
}
}
else if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
@ -486,35 +486,35 @@ static void SetControllersVariablesInLinkBattle(void)
{
gBattleMainFunc = BeginBattleIntro;
gBattleBankFunc[0] = SetControllerToPlayer;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToPlayer;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToLinkPartner;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToLinkPartner;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattleBanksCount = 4;
gBattlersCount = 4;
}
else
{
gBattleBankFunc[0] = SetControllerToLinkPartner;
gBankPositions[0] = B_POSITION_PLAYER_LEFT;
gBattlerFuncs[0] = SetControllerToLinkPartner;
gBattlerPositions[0] = B_POSITION_PLAYER_LEFT;
gBattleBankFunc[1] = SetControllerToLinkOpponent;
gBankPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattlerFuncs[1] = SetControllerToLinkOpponent;
gBattlerPositions[1] = B_POSITION_OPPONENT_LEFT;
gBattleBankFunc[2] = SetControllerToPlayer;
gBankPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattlerFuncs[2] = SetControllerToPlayer;
gBattlerPositions[2] = B_POSITION_PLAYER_RIGHT;
gBattleBankFunc[3] = SetControllerToLinkOpponent;
gBankPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattlerFuncs[3] = SetControllerToLinkOpponent;
gBattlerPositions[3] = B_POSITION_OPPONENT_RIGHT;
gBattleBanksCount = 4;
gBattlersCount = 4;
}
sub_81B8D64(0, 0);
@ -533,7 +533,7 @@ static void SetControllersVariablesInLinkBattle(void)
if (gBattleTypeFlags & BATTLE_TYPE_WILD)
gBattleMainFunc = BeginBattleIntro;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
switch (gLinkPlayers[i].lp_field_18)
{
@ -549,17 +549,17 @@ static void SetControllersVariablesInLinkBattle(void)
if (i == multiplayerId)
{
gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer;
gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToPlayer;
switch (gLinkPlayers[i].lp_field_18)
{
case 0:
case 3:
gBankPositions[gLinkPlayers[i].lp_field_18] = 0;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 0;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break;
case 1:
case 2:
gBankPositions[gLinkPlayers[i].lp_field_18] = 2;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 2;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break;
}
@ -569,34 +569,34 @@ static void SetControllersVariablesInLinkBattle(void)
if ((!(gLinkPlayers[i].lp_field_18 & 1) && !(gLinkPlayers[multiplayerId].lp_field_18 & 1))
|| ((gLinkPlayers[i].lp_field_18 & 1) && (gLinkPlayers[multiplayerId].lp_field_18 & 1)))
{
gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner;
gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkPartner;
switch (gLinkPlayers[i].lp_field_18)
{
case 0:
case 3:
gBankPositions[gLinkPlayers[i].lp_field_18] = 0;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 0;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break;
case 1:
case 2:
gBankPositions[gLinkPlayers[i].lp_field_18] = 2;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 2;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break;
}
}
else
{
gBattleBankFunc[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent;
gBattlerFuncs[gLinkPlayers[i].lp_field_18] = SetControllerToLinkOpponent;
switch (gLinkPlayers[i].lp_field_18)
{
case 0:
case 3:
gBankPositions[gLinkPlayers[i].lp_field_18] = 1;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 1;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 0;
break;
case 1:
case 2:
gBankPositions[gLinkPlayers[i].lp_field_18] = 3;
gBattlerPositions[gLinkPlayers[i].lp_field_18] = 3;
gBattlePartyID[gLinkPlayers[i].lp_field_18] = 3;
break;
}
@ -604,7 +604,7 @@ static void SetControllersVariablesInLinkBattle(void)
}
}
gBattleBanksCount = 4;
gBattlersCount = 4;
}
}
@ -614,13 +614,13 @@ static void SetBattlePartyIds(void)
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
for (i = 0; i < gBattleBanksCount; i++)
for (i = 0; i < gBattlersCount; i++)
{
for (j = 0; j < 6; j++)
{
if (i < 2)
{
if (GET_BANK_SIDE2(i) == SIDE_PLAYER)
if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER)
{
if (GetMonData(&gPlayerParty[j], MON_DATA_HP) != 0
&& GetMonData(&gPlayerParty[j], MON_DATA_SPECIES2) != SPECIES_NONE
@ -645,7 +645,7 @@ static void SetBattlePartyIds(void)
}
else
{
if (GET_BANK_SIDE2(i) == SIDE_PLAYER)
if (GET_BATTLER_SIDE2(i) == B_SIDE_PLAYER)
{
if (GetMonData(&gPlayerParty[j], MON_DATA_HP) != 0
&& GetMonData(&gPlayerParty[j], MON_DATA_SPECIES) != SPECIES_NONE // Probably a typo by Game Freak. The rest use SPECIES2.
@ -693,14 +693,14 @@ static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
case 0:
for (i = 0; i < size; i++)
{
gBattleBufferA[gActiveBank][i] = *data;
gBattleBufferA[gActiveBattler][i] = *data;
data++;
}
break;
case 1:
for (i = 0; i < size; i++)
{
gBattleBufferB[gActiveBank][i] = *data;
gBattleBufferB[gActiveBattler][i] = *data;
data++;
}
break;
@ -751,12 +751,12 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data)
gTasks[gUnknown_02022D08].data[14] = 0;
}
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_BUFFER_ID] = bufferId;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ACTIVE_BANK] = gActiveBank;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ATTACKER] = gBankAttacker;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBankDefender;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ACTIVE_BANK] = gActiveBattler;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ATTACKER] = gBattleAttacker;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_TARGET] = gBattleDefender;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_LO] = alignedSize;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_SIZE_HI] = (alignedSize & 0x0000FF00) >> 8;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ABSENT_BANK_FLAGS] = gAbsentBankFlags;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_ABSENT_BANK_FLAGS] = gAbsentBattlerFlags;
gLinkBattleSendBuffer[gTasks[gUnknown_02022D08].data[14] + LINK_BUFF_EFFECT_BANK] = gEffectBank;
for (i = 0; i < size; i++)
@ -920,9 +920,9 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
if (!(gBattleTypeFlags & BATTLE_TYPE_WILD))
{
gBankAttacker = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 2];
gBankDefender = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 3];
gAbsentBankFlags = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 6];
gBattleAttacker = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 2];
gBattleDefender = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 3];
gAbsentBattlerFlags = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 6];
gEffectBank = gLinkBattleRecvBuffer[gTasks[taskId].data[15] + 7];
}
break;
@ -1123,13 +1123,13 @@ void EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.bank;
stringInfo->scrActive = gBattleScripting.battler;
stringInfo->unk1605E = gBattleStruct->field_52;
stringInfo->hpScale = gBattleStruct->hpScale;
stringInfo->StringBank = gStringBank;
stringInfo->moveType = gBattleMoves[gCurrentMove].type;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
stringInfo->abilities[i] = gBattleMons[i].ability;
for (i = 0; i < TEXT_BUFF_ARRAY_COUNT; i++)
{
@ -1155,10 +1155,10 @@ void EmitPrintSelectionString(u8 bufferId, u16 stringID)
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
stringInfo->lastAbility = gLastUsedAbility;
stringInfo->scrActive = gBattleScripting.bank;
stringInfo->scrActive = gBattleScripting.battler;
stringInfo->unk1605E = gBattleStruct->field_52;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
stringInfo->abilities[i] = gBattleMons[i].ability;
for (i = 0; i < TEXT_BUFF_ARRAY_COUNT; i++)
{

View File

@ -23,17 +23,17 @@
#include "contest.h"
#include "constants/songs.h"
extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200];
extern u8 gActiveBank;
extern u8 gBattleBanksCount;
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gActiveBattler;
extern u8 gBattlersCount;
extern u16 gUnknown_020243FC;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u8 gBankPositions[BATTLE_BANKS_COUNT];
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
extern u32 gTransformedPersonalities[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u8 gBattlerPositions[MAX_BATTLERS_COUNT];
extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT];
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
@ -109,7 +109,7 @@ static const struct CompressedSpriteSheet gUnknown_0832C100 =
gUnknown_08C1F8E8, 0x1000, TAG_HEALTHBOX_SAFARI_TILE
};
static const struct CompressedSpriteSheet gUnknown_0832C108[BATTLE_BANKS_COUNT] =
static const struct CompressedSpriteSheet gUnknown_0832C108[MAX_BATTLERS_COUNT] =
{
{gBlankGfxCompressed, 0x0100, 0xd704},
{gBlankGfxCompressed, 0x0120, 0xd705},
@ -127,10 +127,10 @@ static const struct SpritePalette gUnknown_0832C128[2] =
void AllocateBattleSpritesData(void)
{
gBattleSpritesDataPtr = AllocZeroed(sizeof(struct BattleSpriteData));
gBattleSpritesDataPtr->bankData = AllocZeroed(sizeof(struct BattleSpriteInfo) * BATTLE_BANKS_COUNT);
gBattleSpritesDataPtr->healthBoxesData = AllocZeroed(sizeof(struct BattleHealthboxInfo) * BATTLE_BANKS_COUNT);
gBattleSpritesDataPtr->bankData = AllocZeroed(sizeof(struct BattleSpriteInfo) * MAX_BATTLERS_COUNT);
gBattleSpritesDataPtr->healthBoxesData = AllocZeroed(sizeof(struct BattleHealthboxInfo) * MAX_BATTLERS_COUNT);
gBattleSpritesDataPtr->animationData = AllocZeroed(sizeof(struct BattleAnimationInfo));
gBattleSpritesDataPtr->battleBars = AllocZeroed(sizeof(struct BattleBarInfo) * BATTLE_BANKS_COUNT);
gBattleSpritesDataPtr->battleBars = AllocZeroed(sizeof(struct BattleBarInfo) * MAX_BATTLERS_COUNT);
}
void FreeBattleSpritesData(void)
@ -149,17 +149,17 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
{
s32 i, var1, var2;
s32 chosenMoveId = -1;
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]);
u8 unusableMovesBits = CheckMoveLimitations(gActiveBank, 0, 0xFF);
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
u8 unusableMovesBits = CheckMoveLimitations(gActiveBattler, 0, 0xFF);
s32 percent = Random() % 100;
i = (gBattleStruct->field_92 & gBitTable[gActiveBank]) ? 2 : 0;
i = (gBattleStruct->field_92 & gBitTable[gActiveBattler]) ? 2 : 0;
var2 = i;
var1 = i + 2;
for (; i < var1; i++)
{
if (gUnknown_0831C494[GetNatureFromPersonality(gBattleMons[gActiveBank].personality)][i] > percent)
if (gUnknown_0831C494[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)][i] > percent)
break;
}
@ -234,13 +234,13 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
if (Random() % 100 > 49)
{
gProtectStructs[gActiveBank].flag_x10 = 1;
gProtectStructs[gActiveBattler].flag_x10 = 1;
return 0;
}
}
else
{
gProtectStructs[gActiveBank].flag_x10 = 1;
gProtectStructs[gActiveBattler].flag_x10 = 1;
return 0;
}
}
@ -258,11 +258,11 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
}
if (var1 & MOVE_TARGET_x10)
chosenMoveId |= (gActiveBank << 8);
chosenMoveId |= (gActiveBattler << 8);
else if (var1 == MOVE_TARGET_SELECTED)
chosenMoveId |= (BattlePalaceGetTargetRetValue());
else
chosenMoveId |= (GetBankByPosition((GetBankPosition(gActiveBank) & BIT_SIDE) ^ BIT_SIDE) << 8);
chosenMoveId |= (GetBattlerAtPosition((GetBattlerPosition(gActiveBattler) & BIT_SIDE) ^ BIT_SIDE) << 8);
return chosenMoveId;
}
@ -297,21 +297,21 @@ static u16 BattlePalaceGetTargetRetValue(void)
{
u8 opposing1, opposing2;
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
opposing1 = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
opposing2 = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
opposing1 = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
opposing2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}
else
{
opposing1 = GetBankByPosition(B_POSITION_PLAYER_LEFT);
opposing2 = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
opposing1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
opposing2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
}
if (gBattleMons[opposing1].hp == gBattleMons[opposing2].hp)
return (((gActiveBank & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
switch (gUnknown_0831C604[GetNatureFromPersonality(gBattleMons[gActiveBank].personality)])
switch (gUnknown_0831C604[GetNatureFromPersonality(gBattleMons[gActiveBattler].personality)])
{
case 0:
if (gBattleMons[opposing1].hp > gBattleMons[opposing2].hp)
@ -324,11 +324,11 @@ static u16 BattlePalaceGetTargetRetValue(void)
else
return opposing2 << 8;
case 2:
return (((gActiveBank & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
return (((gActiveBattler & BIT_SIDE) ^ BIT_SIDE) + (Random() & 2)) << 8;
}
}
return (gActiveBank ^ BIT_SIDE) << 8;
return (gActiveBattler ^ BIT_SIDE) << 8;
}
void sub_805D714(struct Sprite *sprite)
@ -388,36 +388,36 @@ static void sub_805D7EC(struct Sprite *sprite)
void InitAndLaunchChosenStatusAnimation(bool8 isStatus2, u32 status)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 1;
if (!isStatus2)
{
if (status == STATUS1_FREEZE)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_FRZ);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_FRZ);
else if (status == STATUS1_POISON || status & STATUS1_TOXIC_POISON)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_PSN);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_PSN);
else if (status == STATUS1_BURN)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_BRN);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_BRN);
else if (status & STATUS1_SLEEP)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_SLP);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_SLP);
else if (status == STATUS1_PARALYSIS)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_PRZ);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_PRZ);
else // no animation
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 0;
}
else
{
if (status & STATUS2_INFATUATION)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_INFATUATION);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_INFATUATION);
else if (status & STATUS2_CONFUSION)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_CONFUSION);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_CONFUSION);
else if (status & STATUS2_CURSED)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_CURSED);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_CURSED);
else if (status & STATUS2_NIGHTMARE)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_NIGHTMARE);
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_NIGHTMARE);
else if (status & STATUS2_WRAPPED)
LaunchStatusAnimation(gActiveBank, B_ANIM_STATUS_WRAPPED); // this animation doesn't actually exist
LaunchStatusAnimation(gActiveBattler, B_ANIM_STATUS_WRAPPED); // this animation doesn't actually exist
else // no animation
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].statusAnimActive = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive = 0;
}
}
@ -524,7 +524,7 @@ bool8 mplay_80342A4(u8 bank)
if (IsSEPlaying())
{
gBattleSpritesDataPtr->healthBoxesData[bank].field_8++;
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBank].field_8 < 30)
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_8 < 30)
return TRUE;
m4aMPlayStop(&gMPlayInfo_SE1);
@ -561,7 +561,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 bank)
}
otId = GetMonData(mon, MON_DATA_OT_ID);
position = GetBankPosition(bank);
position = GetBattlerPosition(bank);
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
gMonSpritesGfxPtr->sprites[position],
species, currentPersonality);
@ -614,7 +614,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 bank)
}
otId = GetMonData(mon, MON_DATA_OT_ID);
position = GetBankPosition(bank);
position = GetBattlerPosition(bank);
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)
{
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
DecompressPicFromTable_2(&gTrainerFrontPicTable[frontPicId],
gMonSpritesGfxPtr->sprites[position],
SPECIES_NONE);
@ -674,7 +674,7 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 bank)
void DecompressTrainerBackPic(u16 backPicId, u8 bank)
{
u8 position = GetBankPosition(bank);
u8 position = GetBattlerPosition(bank);
DecompressPicFromTable_2(&gTrainerBackPicTable[backPicId],
gMonSpritesGfxPtr->sprites[position],
SPECIES_NONE);
@ -713,7 +713,7 @@ void sub_805DFFC(void)
numberOfBanks = 4;
}
for (i = 0; i < numberOfBanks; i++)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[i]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[i]]);
}
bool8 BattleLoadAllHealthBoxesGfx(u8 state)
@ -739,9 +739,9 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else if (state == 3)
LoadCompressedObjectPic(&gUnknown_0832C0D8);
else if (state == 4)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[0]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[0]]);
else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[1]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[1]]);
else
retVal = TRUE;
}
@ -756,13 +756,13 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
else if (state == 5)
LoadCompressedObjectPic(&gUnknown_0832C0F0[1]);
else if (state == 6)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[0]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[0]]);
else if (state == 7)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[1]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[1]]);
else if (state == 8)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[2]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[2]]);
else if (state == 9)
LoadCompressedObjectPic(&gUnknown_0832C108[gBankPositions[3]]);
LoadCompressedObjectPic(&gUnknown_0832C108[gBattlerPositions[3]]);
else
retVal = TRUE;
}
@ -807,7 +807,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
gHealthBoxesIds[*bank] = CreateBankHealthboxSprites(*bank);
(*bank)++;
if (*bank == gBattleBanksCount)
if (*bank == gBattlersCount)
{
*bank = 0;
(*state1)++;
@ -815,20 +815,20 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
break;
case 4:
SetBankHealthboxSpritePos(*bank);
if (gBankPositions[*bank] <= 1)
if (gBattlerPositions[*bank] <= 1)
DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], FALSE);
else
DummyBattleInterfaceFunc(gHealthBoxesIds[*bank], TRUE);
(*bank)++;
if (*bank == gBattleBanksCount)
if (*bank == gBattlersCount)
{
*bank = 0;
(*state1)++;
}
break;
case 5:
if (GetBankSide(*bank) == SIDE_PLAYER)
if (GetBattlerSide(*bank) == B_SIDE_PLAYER)
{
if (!(gBattleTypeFlags & BATTLE_TYPE_SAFARI))
UpdateHealthboxAttribute(gHealthBoxesIds[*bank], &gPlayerParty[gBattlePartyID[*bank]], HEALTHBOX_ALL);
@ -839,7 +839,7 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
}
SetHealthboxSpriteInvisible(gHealthBoxesIds[*bank]);
(*bank)++;
if (*bank == gBattleBanksCount)
if (*bank == gBattlersCount)
{
*bank = 0;
(*state1)++;
@ -857,21 +857,21 @@ bool8 BattleInitAllSprites(u8 *state1, u8 *bank)
void ClearSpritesHealthboxAnimData(void)
{
memset(gBattleSpritesDataPtr->healthBoxesData, 0, sizeof(struct BattleHealthboxInfo) * BATTLE_BANKS_COUNT);
memset(gBattleSpritesDataPtr->healthBoxesData, 0, sizeof(struct BattleHealthboxInfo) * MAX_BATTLERS_COUNT);
memset(gBattleSpritesDataPtr->animationData, 0, sizeof(struct BattleAnimationInfo));
}
static void ClearSpritesBankHealthboxAnimData(void)
{
ClearSpritesHealthboxAnimData();
memset(gBattleSpritesDataPtr->bankData, 0, sizeof(struct BattleSpriteInfo) * BATTLE_BANKS_COUNT);
memset(gBattleSpritesDataPtr->bankData, 0, sizeof(struct BattleSpriteInfo) * MAX_BATTLERS_COUNT);
}
void CopyAllBattleSpritesInvisibilities(void)
{
s32 i;
for (i = 0; i < gBattleBanksCount; i++)
for (i = 0; i < gBattlersCount; i++)
gBattleSpritesDataPtr->bankData[i].invisible = gSprites[gBankSpriteIds[i]].invisible;
}
@ -921,14 +921,14 @@ void HandleSpeciesGfxDataChange(u8 bankAtk, u8 bankDef, bool8 notTransform)
}
else
{
position = GetBankPosition(bankAtk);
position = GetBattlerPosition(bankAtk);
if (GetBankSide(bankDef) == SIDE_OPPONENT)
if (GetBattlerSide(bankDef) == B_SIDE_OPPONENT)
targetSpecies = GetMonData(&gEnemyParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES);
else
targetSpecies = GetMonData(&gPlayerParty[gBattlePartyID[bankDef]], MON_DATA_SPECIES);
if (GetBankSide(bankAtk) == SIDE_PLAYER)
if (GetBattlerSide(bankAtk) == B_SIDE_PLAYER)
{
personalityValue = GetMonData(&gPlayerParty[gBattlePartyID[bankAtk]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlePartyID[bankAtk]], MON_DATA_OT_ID);
@ -991,11 +991,11 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite)
if (IsContest())
position = 0;
else
position = GetBankPosition(bank);
position = GetBattlerPosition(bank);
if (IsContest())
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
else if (GetBankSide(bank) != SIDE_PLAYER)
else if (GetBattlerSide(bank) != B_SIDE_PLAYER)
LZDecompressVram(gSubstituteDollGfx, gMonSpritesGfxPtr->sprites[position]);
else
LZDecompressVram(gSubstituteDollTilemap, gMonSpritesGfxPtr->sprites[position]);
@ -1018,7 +1018,7 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 bank, bool8 loadMonSprite)
{
if (!IsContest())
{
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank);
else
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[bank]], bank);
@ -1057,7 +1057,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank)
{
if (!gBattleSpritesDataPtr->bankData[bank].lowHpSong)
{
if (!gBattleSpritesDataPtr->bankData[bank ^ BIT_MON].lowHpSong)
if (!gBattleSpritesDataPtr->bankData[bank ^ BIT_FLANK].lowHpSong)
PlaySE(SE_HINSI);
gBattleSpritesDataPtr->bankData[bank].lowHpSong = 1;
}
@ -1070,7 +1070,7 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank)
m4aSongNumStop(SE_HINSI);
return;
}
if (IsDoubleBattle() && !gBattleSpritesDataPtr->bankData[bank ^ BIT_MON].lowHpSong)
if (IsDoubleBattle() && !gBattleSpritesDataPtr->bankData[bank ^ BIT_FLANK].lowHpSong)
{
m4aSongNumStop(SE_HINSI);
return;
@ -1080,11 +1080,11 @@ void HandleLowHpMusicChange(struct Pokemon *mon, u8 bank)
void BattleStopLowHpSound(void)
{
u8 playerBank = GetBankByPosition(B_POSITION_PLAYER_LEFT);
u8 playerBank = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
gBattleSpritesDataPtr->bankData[playerBank].lowHpSong = 0;
if (IsDoubleBattle())
gBattleSpritesDataPtr->bankData[playerBank ^ BIT_MON].lowHpSong = 0;
gBattleSpritesDataPtr->bankData[playerBank ^ BIT_FLANK].lowHpSong = 0;
m4aSongNumStop(SE_HINSI);
}
@ -1101,8 +1101,8 @@ void sub_805EAE8(void)
{
if (gMain.inBattle)
{
u8 playerBank1 = GetBankByPosition(B_POSITION_PLAYER_LEFT);
u8 playerBank2 = GetBankByPosition(B_POSITION_PLAYER_RIGHT);
u8 playerBank1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 playerBank2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
u8 bank1PartyId = pokemon_order_func(gBattlePartyID[playerBank1]);
u8 bank2PartyId = pokemon_order_func(gBattlePartyID[playerBank2]);
@ -1117,7 +1117,7 @@ void sub_805EB9C(u8 affineMode)
{
s32 i;
for (i = 0; i < gBattleBanksCount; i++)
for (i = 0; i < gBattlersCount; i++)
{
if (IsBankSpritePresent(i))
{
@ -1143,13 +1143,13 @@ void LoadAndCreateEnemyShadowSprites(void)
LoadCompressedObjectPic(&gSpriteSheet_EnemyShadow);
bank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
bank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8);
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
if (IsDoubleBattle())
{
bank = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
bank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId = CreateSprite(&gSpriteTemplate_EnemyShadow, GetBankCoord(bank, 0), GetBankCoord(bank, 1) + 29, 0xC8);
gSprites[gBattleSpritesDataPtr->healthBoxesData[bank].shadowSpriteId].data[0] = bank;
}
@ -1189,7 +1189,7 @@ void SpriteCB_SetInvisible(struct Sprite *sprite)
void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species)
{
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
return;
if (gBattleSpritesDataPtr->bankData[bank].transformSpecies != SPECIES_NONE)
@ -1245,7 +1245,7 @@ void AllocateMonSpritesGfx(void)
gMonSpritesGfxPtr = AllocZeroed(sizeof(*gMonSpritesGfxPtr));
gMonSpritesGfxPtr->firstDecompressed = AllocZeroed(0x8000);
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
gMonSpritesGfxPtr->sprites[i] = gMonSpritesGfxPtr->firstDecompressed + (i * 0x2000);
*(gMonSpritesGfxPtr->templates + i) = gUnknown_08329D98[i];

View File

@ -153,10 +153,10 @@ enum
HEALTHBOX_GFX_117,
};
extern u8 gBankPositions[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gBattleBanksCount;
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gBattlerPositions[MAX_BATTLERS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBattlersCount;
extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT];
extern const u8 * const gNatureNamePointers[];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
@ -907,7 +907,7 @@ u8 CreateBankHealthboxSprites(u8 bank)
if (!IsDoubleBattle())
{
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
{
healthboxSpriteId_1 = CreateSprite(&sHealthboxPlayerSpriteTemplates[0], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[0], 240, 160, 1);
@ -932,10 +932,10 @@ u8 CreateBankHealthboxSprites(u8 bank)
}
else
{
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
{
healthboxSpriteId_1 = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_1 = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(bank) / 2], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
@ -947,8 +947,8 @@ u8 CreateBankHealthboxSprites(u8 bank)
}
else
{
healthboxSpriteId_1 = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBankPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_1 = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(bank) / 2], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
@ -960,9 +960,9 @@ u8 CreateBankHealthboxSprites(u8 bank)
}
}
unkSpriteId = CreateSpriteAtEnd(&sUnknown_0832C1C0[gBankPositions[bank]], 140, 60, 0);
unkSpriteId = CreateSpriteAtEnd(&sUnknown_0832C1C0[gBattlerPositions[bank]], 140, 60, 0);
unkSpritePtr = &gSprites[unkSpriteId];
SetSubspriteTables(unkSpritePtr, &sUnknown_0832C28C[GetBankSide(bank)]);
SetSubspriteTables(unkSpritePtr, &sUnknown_0832C28C[GetBattlerSide(bank)]);
unkSpritePtr->subspriteMode = 2;
unkSpritePtr->oam.priority = 1;
@ -1087,7 +1087,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority)
{
s32 i;
for (i = 0; i < gBattleBanksCount; i++)
for (i = 0; i < gBattlersCount; i++)
{
u8 healthboxSpriteId_1 = gHealthBoxesIds[i];
u8 healthboxSpriteId_2 = gSprites[gHealthBoxesIds[i]].oam.affineParam;
@ -1105,14 +1105,14 @@ void SetBankHealthboxSpritePos(u8 bank)
if (!IsDoubleBattle())
{
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
x = 44, y = 30;
else
x = 158, y = 88;
}
else
{
switch (GetBankPosition(bank))
switch (GetBattlerPosition(bank))
{
case B_POSITION_PLAYER_LEFT:
x = 159, y = 76;
@ -1156,7 +1156,7 @@ static void UpdateLvlInHealthbox(u8 healthboxSpriteId, u8 lvl)
windowTileData = AddTextPrinterAndCreateWindowOnHealthbox(text, xPos, 3, 2, &windowId);
spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
if (GetBankSide(gSprites[healthboxSpriteId].data[6]) == SIDE_PLAYER)
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
objVram = (void*)(OBJ_VRAM0);
if (!IsDoubleBattle())
@ -1180,7 +1180,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent)
u8 text[32];
void *objVram;
if (GetBankSide(gSprites[healthboxSpriteId].data[6]) == SIDE_PLAYER && !IsDoubleBattle())
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER && !IsDoubleBattle())
{
spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
if (maxOrCurrent != HP_CURRENT) // singles, max
@ -1214,7 +1214,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent)
memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4));
bank = gSprites[healthboxSpriteId].data[6];
if (IsDoubleBattle() == TRUE || GetBankSide(bank) == SIDE_OPPONENT)
if (IsDoubleBattle() == TRUE || GetBattlerSide(bank) == B_SIDE_OPPONENT)
{
UpdateHpTextInHealthboxInDoubles(healthboxSpriteId, value, maxOrCurrent);
}
@ -1223,7 +1223,7 @@ void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent)
u32 var;
u8 i;
if (GetBankSide(gSprites[healthboxSpriteId].data[6]) == SIDE_PLAYER)
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
if (maxOrCurrent == HP_CURRENT)
var = 29;
@ -1258,7 +1258,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
u8 text[32];
void *objVram;
if (GetBankSide(gSprites[healthboxSpriteId].data[6]) == SIDE_PLAYER)
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
if (gBattleSpritesDataPtr->bankData[gSprites[healthboxSpriteId].data[6]].hpNumbersNoBars) // don't print text if only bars are visible
{
@ -1335,7 +1335,7 @@ static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8
}
else
{
if (GetBankSide(bank) == SIDE_PLAYER) // impossible to reach part, because the bank is from the opponent's side
if (GetBattlerSide(bank) == B_SIDE_PLAYER) // impossible to reach part, because the bank is from the opponent's side
{
CpuCopy32(GetHealthboxElementGfxPtr(HEALTHBOX_GFX_116),
(void*)(OBJ_VRAM0) + ((gSprites[healthboxSpriteId].oam.tileNum + 52) * 32),
@ -1354,7 +1354,7 @@ static void sub_80730D4(u8 healthboxSpriteId, struct Pokemon *mon)
u8 i, var, nature, healthboxSpriteId_2;
memcpy(text, sUnknown_0832C3C4, sizeof(sUnknown_0832C3C4));
barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBankPosition(gSprites[healthboxSpriteId].data[6]) * 384)];
barFontGfx = &gMonSpritesGfxPtr->barFontGfx[0x520 + (GetBattlerPosition(gSprites[healthboxSpriteId].data[6]) * 384)];
var = 5;
nature = GetNature(mon);
StringCopy(text + 6, gNatureNamePointers[nature]);
@ -1415,17 +1415,17 @@ void SwapHpBarsWithHpText(void)
s32 i;
u8 spriteId;
for (i = 0; i < gBattleBanksCount; i++)
for (i = 0; i < gBattlersCount; i++)
{
if (gSprites[gHealthBoxesIds[i]].callback == SpriteCallbackDummy
&& GetBankSide(i) != SIDE_OPPONENT
&& (IsDoubleBattle() || GetBankSide(i) != SIDE_PLAYER))
&& GetBattlerSide(i) != B_SIDE_OPPONENT
&& (IsDoubleBattle() || GetBattlerSide(i) != B_SIDE_PLAYER))
{
bool8 noBars;
gBattleSpritesDataPtr->bankData[i].hpNumbersNoBars ^= 1;
noBars = gBattleSpritesDataPtr->bankData[i].hpNumbersNoBars;
if (GetBankSide(i) == SIDE_PLAYER)
if (GetBattlerSide(i) == B_SIDE_PLAYER)
{
if (!IsDoubleBattle())
continue;
@ -1486,9 +1486,9 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
u8 ballIconSpritesIds[6];
u8 taskId;
if (!arg2 || GetBankPosition(bank) != B_POSITION_OPPONENT_RIGHT)
if (!arg2 || GetBattlerPosition(bank) != B_POSITION_OPPONENT_RIGHT)
{
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
{
isOpponent = FALSE;
bar_X = 136, bar_Y = 96;
@ -1567,7 +1567,7 @@ u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 ar
gSprites[ballIconSpritesIds[i]].data[2] = isOpponent;
}
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
{
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
@ -1712,7 +1712,7 @@ void sub_8073C30(u8 taskId)
{
for (i = 0; i < 6; i++)
{
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
{
gSprites[sp[5 - i]].data[1] = 7 * i;
gSprites[sp[5 - i]].data[3] = 0;
@ -1964,7 +1964,7 @@ static void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon)
spriteTileNum = gSprites[healthboxSpriteId].oam.tileNum * 32;
if (GetBankSide(gSprites[healthboxSpriteId].data[6]) == SIDE_PLAYER)
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
sub_8075198((void*)(0x6010040 + spriteTileNum), windowTileData, 6);
ptr = (void*)(OBJ_VRAM0);
@ -1992,7 +1992,7 @@ static void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus)
return;
bank = gSprites[healthboxSpriteId].data[6];
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
return;
if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES)), FLAG_GET_CAUGHT))
return;
@ -2016,7 +2016,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
bank = gSprites[healthboxSpriteId].data[6];
healthboxSpriteId_2 = gSprites[healthboxSpriteId].data[5];
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
{
status = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_STATUS);
if (!IsDoubleBattle())
@ -2075,7 +2075,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void*)(OBJ_PLTT + pltAdder * 2), 2);
CpuCopy32(statusGfxPtr, (void*)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * 32), 96);
if (IsDoubleBattle() == TRUE || GetBankSide(bank) == SIDE_OPPONENT)
if (IsDoubleBattle() == TRUE || GetBattlerSide(bank) == B_SIDE_OPPONENT)
{
if (!gBattleSpritesDataPtr->bankData[bank].hpNumbersNoBars)
{
@ -2181,9 +2181,9 @@ void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elem
u8 bank = gSprites[healthboxSpriteId].data[6];
if (elementId == HEALTHBOX_ALL && !IsDoubleBattle())
GetBankSide(bank); // pointless function call
GetBattlerSide(bank); // pointless function call
if (GetBankSide(gSprites[healthboxSpriteId].data[6]) == SIDE_PLAYER)
if (GetBattlerSide(gSprites[healthboxSpriteId].data[6]) == B_SIDE_PLAYER)
{
u8 isDoubles;

File diff suppressed because it is too large Load Diff

View File

@ -16,20 +16,20 @@
extern u16 gLastUsedItem;
extern u8 gLastUsedAbility;
extern u8 gActiveBank;
extern u8 gBankAttacker;
extern u8 gBankDefender;
extern u8 gActiveBattler;
extern u8 gBattleAttacker;
extern u8 gBattleDefender;
extern u8 gStringBank;
extern u8 gEffectBank;
extern u8 gAbilitiesPerBank[BATTLE_BANKS_COUNT];
extern u8 gAbilitiesPerBank[MAX_BATTLERS_COUNT];
extern u32 gBattleTypeFlags;
extern u16 gTrainerBattleOpponent_A;
extern u16 gTrainerBattleOpponent_B;
extern u16 gPartnerTrainerId;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT];
extern u8 gBattleBufferA[BATTLE_BANKS_COUNT][0x200];
extern u8 gMoveSelectionCursor[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT];
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gMoveSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gUnknown_0203C7B4;
extern struct StringInfoBattle *gStringInfo;
@ -1430,16 +1430,16 @@ void BufferStringBattle(u16 stringID)
s32 i;
const u8* stringPtr = NULL;
gStringInfo = (struct StringInfoBattle*)(&gBattleBufferA[gActiveBank][4]);
gStringInfo = (struct StringInfoBattle*)(&gBattleBufferA[gActiveBattler][4]);
gLastUsedItem = gStringInfo->lastItem;
gLastUsedAbility = gStringInfo->lastAbility;
gBattleScripting.bank = gStringInfo->scrActive;
gBattleScripting.battler = gStringInfo->scrActive;
*(&gBattleStruct->field_52) = gStringInfo->unk1605E;
*(&gBattleStruct->hpScale) = gStringInfo->hpScale;
gStringBank = gStringInfo->StringBank;
*(&gBattleStruct->stringMoveType) = gStringInfo->moveType;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
gAbilitiesPerBank[i] = gStringInfo->abilities[i];
}
@ -1501,7 +1501,7 @@ void BufferStringBattle(u16 stringID)
}
break;
case STRINGID_INTROSENDOUT: // poke first send-out
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
@ -1546,7 +1546,7 @@ void BufferStringBattle(u16 stringID)
}
break;
case STRINGID_RETURNMON: // sending poke to ball msg
if (GetBankSide(gActiveBank) == SIDE_PLAYER)
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
{
if (*(&gBattleStruct->hpScale) == 0)
stringPtr = gText_PkmnThatsEnough;
@ -1573,7 +1573,7 @@ void BufferStringBattle(u16 stringID)
}
break;
case STRINGID_SWITCHINMON: // switch-in msg
if (GetBankSide(gBattleScripting.bank) == SIDE_PLAYER)
if (GetBattlerSide(gBattleScripting.battler) == B_SIDE_PLAYER)
{
if (*(&gBattleStruct->hpScale) == 0 || gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
stringPtr = gText_GoPkmn2;
@ -1590,7 +1590,7 @@ void BufferStringBattle(u16 stringID)
{
if (gBattleTypeFlags & BATTLE_TYPE_x800000)
{
if (gBattleScripting.bank == 1)
if (gBattleScripting.battler == 1)
stringPtr = gText_Trainer1SentOutPkmn2;
else
stringPtr = gText_Trainer2SentOutPkmn;
@ -1609,7 +1609,7 @@ void BufferStringBattle(u16 stringID)
{
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
{
if (gBattleScripting.bank == 1)
if (gBattleScripting.battler == 1)
stringPtr = gText_Trainer1SentOutPkmn2;
else
stringPtr = gText_Trainer2SentOutPkmn;
@ -1636,7 +1636,7 @@ void BufferStringBattle(u16 stringID)
if (gBattleTextBuff1[0] & B_OUTCOME_LINK_BATTLE_RAN)
{
gBattleTextBuff1[0] &= ~(B_OUTCOME_LINK_BATTLE_RAN);
if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW)
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW)
gBattleTextBuff1[0] ^= (B_OUTCOME_LOST | B_OUTCOME_WON);
if (gBattleTextBuff1[0] == B_OUTCOME_LOST || gBattleTextBuff1[0] == B_OUTCOME_DREW)
@ -1648,7 +1648,7 @@ void BufferStringBattle(u16 stringID)
}
else
{
if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW)
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT && gBattleTextBuff1[0] != B_OUTCOME_DREW)
gBattleTextBuff1[0] ^= (B_OUTCOME_LOST | B_OUTCOME_WON);
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
@ -1754,7 +1754,7 @@ static const u8* TryGetStatusString(u8* src)
}
#define HANDLE_NICKNAME_STRING_CASE(bank, monIndex) \
if (GetBankSide(bank) != SIDE_PLAYER) \
if (GetBattlerSide(bank) != B_SIDE_PLAYER) \
{ \
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) \
toCpy = gText_FoePkmnPrefix; \
@ -1836,25 +1836,25 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = gStringVar3;
break;
case B_TXT_PLAYER_MON1_NAME: // first player poke name
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByPosition(B_POSITION_PLAYER_LEFT)]],
GetMonData(&gPlayerParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)]],
MON_DATA_NICKNAME, text);
StringGetEnd10(text);
toCpy = text;
break;
case B_TXT_OPPONENT_MON1_NAME: // first enemy poke name
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByPosition(B_POSITION_OPPONENT_LEFT)]],
GetMonData(&gEnemyParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)]],
MON_DATA_NICKNAME, text);
StringGetEnd10(text);
toCpy = text;
break;
case B_TXT_PLAYER_MON2_NAME: // second player poke name
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByPosition(B_POSITION_PLAYER_RIGHT)]],
GetMonData(&gPlayerParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)]],
MON_DATA_NICKNAME, text);
StringGetEnd10(text);
toCpy = text;
break;
case B_TXT_OPPONENT_MON2_NAME: // second enemy poke name
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByPosition(B_POSITION_OPPONENT_RIGHT)]],
GetMonData(&gEnemyParty[gBattlePartyID[GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)]],
MON_DATA_NICKNAME, text);
StringGetEnd10(text);
toCpy = text;
@ -1884,32 +1884,32 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = text;
break;
case B_TXT_ATK_NAME_WITH_PREFIX_MON1: // attacker name with prefix, only bank 0/1
HANDLE_NICKNAME_STRING_CASE(gBankAttacker,
gBattlePartyID[GetBankByPosition(GET_BANK_SIDE(gBankAttacker))])
HANDLE_NICKNAME_STRING_CASE(gBattleAttacker,
gBattlePartyID[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleAttacker))])
break;
case B_TXT_ATK_PARTNER_NAME: // attacker partner name
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
GetMonData(&gPlayerParty[gBattlePartyID[GetBankByPosition(GET_BANK_SIDE(gBankAttacker)) + 2]], MON_DATA_NICKNAME, text);
if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER)
GetMonData(&gPlayerParty[gBattlePartyID[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleAttacker)) + 2]], MON_DATA_NICKNAME, text);
else
GetMonData(&gEnemyParty[gBattlePartyID[GetBankByPosition(GET_BANK_SIDE(gBankAttacker)) + 2]], MON_DATA_NICKNAME, text);
GetMonData(&gEnemyParty[gBattlePartyID[GetBattlerAtPosition(GET_BATTLER_SIDE(gBattleAttacker)) + 2]], MON_DATA_NICKNAME, text);
StringGetEnd10(text);
toCpy = text;
break;
case B_TXT_ATK_NAME_WITH_PREFIX: // attacker name with prefix
HANDLE_NICKNAME_STRING_CASE(gBankAttacker, gBattlePartyID[gBankAttacker])
HANDLE_NICKNAME_STRING_CASE(gBattleAttacker, gBattlePartyID[gBattleAttacker])
break;
case B_TXT_DEF_NAME_WITH_PREFIX: // target name with prefix
HANDLE_NICKNAME_STRING_CASE(gBankDefender, gBattlePartyID[gBankDefender])
HANDLE_NICKNAME_STRING_CASE(gBattleDefender, gBattlePartyID[gBattleDefender])
break;
case B_TXT_EFF_NAME_WITH_PREFIX: // effect bank name with prefix
HANDLE_NICKNAME_STRING_CASE(gEffectBank, gBattlePartyID[gEffectBank])
break;
case B_TXT_ACTIVE_NAME_WITH_PREFIX: // active bank name with prefix
HANDLE_NICKNAME_STRING_CASE(gActiveBank, gBattlePartyID[gActiveBank])
HANDLE_NICKNAME_STRING_CASE(gActiveBattler, gBattlePartyID[gActiveBattler])
break;
case B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX: // scripting active bank name with prefix
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.bank, gBattlePartyID[gBattleScripting.bank])
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, gBattlePartyID[gBattleScripting.battler])
break;
case B_TXT_CURRENT_MOVE: // current move name
if (gStringInfo->currentMove > LAST_MOVE_INDEX)
@ -1970,13 +1970,13 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = gAbilityNames[gLastUsedAbility];
break;
case B_TXT_ATK_ABILITY: // attacker ability
toCpy = gAbilityNames[gAbilitiesPerBank[gBankAttacker]];
toCpy = gAbilityNames[gAbilitiesPerBank[gBattleAttacker]];
break;
case B_TXT_DEF_ABILITY: // target ability
toCpy = gAbilityNames[gAbilitiesPerBank[gBankDefender]];
toCpy = gAbilityNames[gAbilitiesPerBank[gBattleDefender]];
break;
case B_TXT_SCR_ACTIVE_ABILITY: // scripting active ability
toCpy = gAbilityNames[gAbilitiesPerBank[gBattleScripting.bank]];
toCpy = gAbilityNames[gAbilitiesPerBank[gBattleScripting.battler]];
break;
case B_TXT_EFF_ABILITY: // effect bank ability
toCpy = gAbilityNames[gAbilitiesPerBank[gEffectBank]];
@ -2048,7 +2048,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = gLinkPlayers[GetBankMultiplayerId(3 ^ gLinkPlayers[multiplayerID].lp_field_18)].name;
break;
case B_TXT_22: // link scripting active name
toCpy = gLinkPlayers[GetBankMultiplayerId(gBattleScripting.bank)].name;
toCpy = gLinkPlayers[GetBankMultiplayerId(gBattleScripting.battler)].name;
break;
case B_TXT_PLAYER_NAME: // player name
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED)
@ -2085,7 +2085,7 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
}
break;
case B_TXT_26: // ?
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.bank, *(&gBattleStruct->field_52))
HANDLE_NICKNAME_STRING_CASE(gBattleScripting.battler, *(&gBattleStruct->field_52))
break;
case B_TXT_PC_CREATOR_NAME: // lanette pc
if (FlagGet(FLAG_SYS_PC_LANETTE))
@ -2094,37 +2094,37 @@ u32 BattleStringExpandPlaceholders(const u8* src, u8* dst)
toCpy = gText_Someones;
break;
case B_TXT_ATK_PREFIX2:
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER)
toCpy = gText_AllyPkmnPrefix2;
else
toCpy = gText_FoePkmnPrefix3;
break;
case B_TXT_DEF_PREFIX2:
if (GetBankSide(gBankDefender) == SIDE_PLAYER)
if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER)
toCpy = gText_AllyPkmnPrefix2;
else
toCpy = gText_FoePkmnPrefix3;
break;
case B_TXT_ATK_PREFIX1:
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER)
toCpy = gText_AllyPkmnPrefix;
else
toCpy = gText_FoePkmnPrefix2;
break;
case B_TXT_DEF_PREFIX1:
if (GetBankSide(gBankDefender) == SIDE_PLAYER)
if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER)
toCpy = gText_AllyPkmnPrefix;
else
toCpy = gText_FoePkmnPrefix2;
break;
case B_TXT_ATK_PREFIX3:
if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
if (GetBattlerSide(gBattleAttacker) == B_SIDE_PLAYER)
toCpy = gText_AllyPkmnPrefix3;
else
toCpy = gText_FoePkmnPrefix4;
break;
case B_TXT_DEF_PREFIX3:
if (GetBankSide(gBankDefender) == SIDE_PLAYER)
if (GetBattlerSide(gBattleDefender) == B_SIDE_PLAYER)
toCpy = gText_AllyPkmnPrefix3;
else
toCpy = gText_FoePkmnPrefix4;
@ -2266,7 +2266,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
srcID += 2;
break;
case B_BUFF_MON_NICK_WITH_PREFIX: // poke nick with prefix
if (GetBankSide(src[srcID + 1]) == SIDE_PLAYER)
if (GetBattlerSide(src[srcID + 1]) == B_SIDE_PLAYER)
{
GetMonData(&gPlayerParty[src[srcID + 2]], MON_DATA_NICKNAME, text);
}
@ -2292,7 +2292,7 @@ static void ExpandBattleTextBuffPlaceholders(const u8 *src, u8 *dst)
srcID += 3;
break;
case B_BUFF_MON_NICK: // poke nick without prefix
if (GetBankSide(src[srcID + 1]) == SIDE_PLAYER)
if (GetBattlerSide(src[srcID + 1]) == B_SIDE_PLAYER)
GetMonData(&gPlayerParty[src[srcID + 2]], MON_DATA_NICKNAME, dst);
else
GetMonData(&gEnemyParty[src[srcID + 2]], MON_DATA_NICKNAME, dst);
@ -2490,10 +2490,10 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1)
void SetPpNumbersPaletteInMoveSelection(void)
{
struct ChooseMoveStruct *chooseMoveStruct = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBank][4]);
struct ChooseMoveStruct *chooseMoveStruct = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
const u16 *palPtr = gUnknown_08D85620;
u8 var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBank]],
chooseMoveStruct->maxPp[gMoveSelectionCursor[gActiveBank]]);
u8 var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]],
chooseMoveStruct->maxPp[gMoveSelectionCursor[gActiveBattler]]);
gPlttBufferUnfaded[92] = palPtr[(var * 2) + 0];
gPlttBufferUnfaded[91] = palPtr[(var * 2) + 1];

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,12 @@
#include "random.h"
#include "battle_scripts.h"
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gUnknown_0203CF00[];
extern const u8 *gBattlescriptCurrInstr;
extern u8 gBattleCommunication[];
extern u8 gActiveBank;
extern u8 gActiveBattler;
extern void sub_81D55D0(void);
extern void sub_81D5694(void);
@ -87,15 +87,15 @@ void AdjustFriendshipOnBattleFaint(u8 bank)
{
u8 opposingBank2;
opposingBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
opposingBank2 = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
opposingBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
opposingBank2 = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
if (gBattleMons[opposingBank2].level > gBattleMons[opposingBank].level)
opposingBank = opposingBank2;
}
else
{
opposingBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
opposingBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
}
if (gBattleMons[opposingBank].level > gBattleMons[bank].level)
@ -113,7 +113,7 @@ void AdjustFriendshipOnBattleFaint(u8 bank)
void sub_80571DC(u8 bank, u8 arg1)
{
if (GetBankSide(bank) != SIDE_OPPONENT)
if (GetBattlerSide(bank) != B_SIDE_OPPONENT)
{
s32 i;
@ -206,9 +206,9 @@ u32 sub_805725C(u8 bank)
if (effect == 2)
{
gActiveBank = bank;
EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBank].status1);
MarkBufferBankForExecution(gActiveBank);
gActiveBattler = bank;
EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
MarkBufferBankForExecution(gActiveBattler);
}
return effect;

View File

@ -16,8 +16,8 @@
#include "graphics.h"
extern bool8 gDoingBattleAnim;
extern u8 gActiveBank;
extern u8 gBankDefender;
extern u8 gActiveBattler;
extern u8 gBattleDefender;
extern u16 gBattlePartyID[];
extern u8 gBankSpriteIds[];
extern u8 gHealthBoxesIds[];
@ -334,12 +334,12 @@ u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow)
u8 taskId;
gDoingBattleAnim = TRUE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBank].ballAnimActive = 1;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive = 1;
taskId = CreateTask(Task_DoPokeballSendOutAnim, 5);
gTasks[taskId].tPan = pan;
gTasks[taskId].tThrowId = kindOfThrow;
gTasks[taskId].tBank = gActiveBank;
gTasks[taskId].tBank = gActiveBattler;
return 0;
}
@ -363,7 +363,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
throwCaseId = gTasks[taskId].tThrowId;
bank = gTasks[taskId].tBank;
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
itemId = GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);
else
itemId = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);
@ -378,7 +378,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
switch (throwCaseId)
{
case POKEBALL_PLAYER_SENDOUT:
gBankDefender = bank;
gBattleDefender = bank;
gSprites[ballSpriteId].pos1.x = 24;
gSprites[ballSpriteId].pos1.y = 68;
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
@ -386,17 +386,17 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
case POKEBALL_OPPONENT_SENDOUT:
gSprites[ballSpriteId].pos1.x = GetBankCoord(bank, BANK_X_POS);
gSprites[ballSpriteId].pos1.y = GetBankCoord(bank, BANK_Y_POS) + 24;
gBankDefender = bank;
gBattleDefender = bank;
gSprites[ballSpriteId].data[0] = 0;
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
break;
default:
gBankDefender = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
gBattleDefender = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
notSendOut = TRUE;
break;
}
gSprites[ballSpriteId].sBank = gBankDefender;
gSprites[ballSpriteId].sBank = gBattleDefender;
if (!notSendOut)
{
DestroyTask(taskId);
@ -405,12 +405,12 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
// this will perform an unused ball throw animation
gSprites[ballSpriteId].data[0] = 0x22;
gSprites[ballSpriteId].data[2] = GetBankCoord(gBankDefender, BANK_X_POS);
gSprites[ballSpriteId].data[4] = GetBankCoord(gBankDefender, BANK_Y_POS) - 16;
gSprites[ballSpriteId].data[2] = GetBankCoord(gBattleDefender, BANK_X_POS);
gSprites[ballSpriteId].data[4] = GetBankCoord(gBattleDefender, BANK_Y_POS) - 16;
gSprites[ballSpriteId].data[5] = -40;
sub_80A68D4(&gSprites[ballSpriteId]);
gSprites[ballSpriteId].oam.affineParam = taskId;
gTasks[taskId].tOpponentBank = gBankDefender;
gTasks[taskId].tOpponentBank = gBattleDefender;
gTasks[taskId].func = TaskDummy;
PlaySE(SE_NAGERU);
}
@ -755,7 +755,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
u16 wantedCryCase;
u8 taskId;
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
{
mon = &gEnemyParty[gBattlePartyID[bank]];
pan = 25;
@ -767,7 +767,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
}
species = GetMonData(mon, MON_DATA_SPECIES);
if ((bank == GetBankByPosition(B_POSITION_PLAYER_LEFT) || bank == GetBankByPosition(B_POSITION_OPPONENT_LEFT))
if ((bank == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || bank == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
&& IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1)
{
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)
wantedCryCase = 0;
else if (bank == GetBankByPosition(B_POSITION_PLAYER_LEFT) || bank == GetBankByPosition(B_POSITION_OPPONENT_LEFT))
else if (bank == GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) || bank == GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT))
wantedCryCase = 1;
else
wantedCryCase = 2;
@ -803,7 +803,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
StartSpriteAffineAnim(&gSprites[gBankSpriteIds[sprite->sBank]], 1);
if (GetBankSide(sprite->sBank) == SIDE_OPPONENT)
if (GetBattlerSide(sprite->sBank) == B_SIDE_OPPONENT)
gSprites[gBankSpriteIds[sprite->sBank]].callback = sub_8039B58;
else
gSprites[gBankSpriteIds[sprite->sBank]].callback = sub_8039E44;
@ -859,12 +859,12 @@ static void HandleBallAnimEnd(struct Sprite *sprite)
FreeSpriteOamMatrix(sprite);
DestroySprite(sprite);
for (doneBanks = 0, i = 0; i < BATTLE_BANKS_COUNT; i++)
for (doneBanks = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (gBattleSpritesDataPtr->healthBoxesData[i].ballAnimActive == 0)
doneBanks++;
}
if (doneBanks == BATTLE_BANKS_COUNT)
if (doneBanks == MAX_BATTLERS_COUNT)
{
for (i = 0; i < POKEBALL_COUNT; i++)
FreeBallGfx(i);
@ -956,7 +956,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
sprite->data[0] = 0;
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
&& sprite->sBank == GetBankByPosition(B_POSITION_PLAYER_RIGHT))
&& sprite->sBank == GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT))
sprite->callback = SpriteCB_ReleaseMon2FromBall;
else
sprite->callback = SpriteCB_ReleaseMonFromBall;
@ -982,7 +982,7 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite)
{
sprite->data[0] = 0;
if (IsDoubleBattle() && gBattleSpritesDataPtr->animationData->field_9_x1
&& sprite->sBank == GetBankByPosition(B_POSITION_OPPONENT_RIGHT))
&& sprite->sBank == GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT))
sprite->callback = SpriteCB_ReleaseMon2FromBall;
else
sprite->callback = SpriteCB_ReleaseMonFromBall;
@ -1190,7 +1190,7 @@ void sub_8076918(u8 bank)
healthboxSprite->pos2.x = 0x73;
healthboxSprite->pos2.y = 0;
healthboxSprite->callback = sub_80769CC;
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
{
healthboxSprite->data[0] = -healthboxSprite->data[0];
healthboxSprite->data[1] = -healthboxSprite->data[1];
@ -1198,7 +1198,7 @@ void sub_8076918(u8 bank)
healthboxSprite->pos2.y = -healthboxSprite->pos2.y;
}
gSprites[healthboxSprite->data[5]].callback(&gSprites[healthboxSprite->data[5]]);
if (GetBankPosition(bank) == B_POSITION_PLAYER_RIGHT)
if (GetBattlerPosition(bank) == B_POSITION_PLAYER_RIGHT)
healthboxSprite->callback = sub_80769A8;
}
@ -1275,7 +1275,7 @@ void FreeBallGfx(u8 ballId)
static u16 GetBankPokeballItemId(u8 bank)
{
if (GetBankSide(bank) == SIDE_PLAYER)
if (GetBattlerSide(bank) == B_SIDE_PLAYER)
return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);
else
return GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_POKEBALL);

View File

@ -14,10 +14,10 @@ struct Unknown_020249B4
struct SpriteTemplate* templates;
};
extern u8 gAbsentBankFlags;
extern u8 gActiveBank;
extern u8 gBankAttacker;
extern u8 gBankDefender;
extern u8 gAbsentBattlerFlags;
extern u8 gActiveBattler;
extern u8 gBattleAttacker;
extern u8 gBattleDefender;
extern u8 gLastUsedAbility;
extern u16 gTrainerBattleOpponent_A;
extern u32 gBattleTypeFlags;
@ -34,9 +34,9 @@ extern const union AnimCmd* const * const gUnknown_0830536C[];
extern const u8 gText_BadEgg[];
extern const u8 gText_EggNickname[];
extern u8 GetBankSide(u8 bank);
extern u8 GetBankByPosition(u8 bank);
extern u8 GetBankPosition(u8 bank);
extern u8 GetBattlerSide(u8 bank);
extern u8 GetBattlerAtPosition(u8 bank);
extern u8 GetBattlerPosition(u8 bank);
u8 CountAliveMonsInBattle(u8 caseId)
{
@ -48,21 +48,21 @@ u8 CountAliveMonsInBattle(u8 caseId)
case BATTLE_ALIVE_EXCEPT_ACTIVE:
for (i = 0; i < 4; i++)
{
if (i != gActiveBank && !(gAbsentBankFlags & gBitTable[i]))
if (i != gActiveBattler && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++;
}
break;
case BATTLE_ALIVE_ATK_SIDE:
for (i = 0; i < 4; i++)
{
if (GetBankSide(i) == GetBankSide(gBankAttacker) && !(gAbsentBankFlags & gBitTable[i]))
if (GetBattlerSide(i) == GetBattlerSide(gBattleAttacker) && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++;
}
break;
case BATTLE_ALIVE_DEF_SIDE:
for (i = 0; i < 4; i++)
{
if (GetBankSide(i) == GetBankSide(gBankDefender) && !(gAbsentBankFlags & gBitTable[i]))
if (GetBattlerSide(i) == GetBattlerSide(gBattleDefender) && !(gAbsentBattlerFlags & gBitTable[i]))
retVal++;
}
break;
@ -75,7 +75,7 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 bank)
{
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
return FALSE;
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
return FALSE;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
return FALSE;
@ -86,11 +86,11 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 bank)
u8 GetDefaultMoveTarget(u8 bank)
{
u8 status = GetBankPosition(bank) & 1;
u8 status = GetBattlerPosition(bank) & 1;
status ^= 1;
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
return GetBankByPosition(status);
return GetBattlerAtPosition(status);
if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ACTIVE) > 1)
{
u8 val;
@ -99,14 +99,14 @@ u8 GetDefaultMoveTarget(u8 bank)
val = status ^ 2;
else
val = status;
return GetBankByPosition(val);
return GetBattlerAtPosition(val);
}
else
{
if ((gAbsentBankFlags & gBitTable[status]))
return GetBankByPosition(status ^ 2);
if ((gAbsentBattlerFlags & gBitTable[status]))
return GetBattlerAtPosition(status ^ 2);
else
return GetBankByPosition(status);
return GetBattlerAtPosition(status);
}
}
@ -1353,7 +1353,7 @@ void CopyPlayerPartyMonToBattleData(u8 bank, u8 partyIndex)
StringCopy10(gBattleMons[bank].nickname, nickname);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[bank].otName);
hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBankSide(bank)];
hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(bank)];
*hpSwitchout = gBattleMons[bank].hp;
for (i = 0; i < 8; i++)

View File

@ -25,10 +25,10 @@
extern struct BattlePokemon gBattleMons[4];
extern struct BattleEnigmaBerry gEnigmaBerries[4];
extern u8 gActiveBank;
extern u8 gActiveBattler;
extern u8 gBankInMenu;
extern u8 gBankDefender;
extern u8 gBankAttacker;
extern u8 gBattleDefender;
extern u8 gBattleAttacker;
extern u8 gStringBank;
extern u16 gTrainerBattleOpponent_A;
extern u32 gBattleTypeFlags;
@ -113,7 +113,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
if (itemId == ITEM_ENIGMA_BERRY)
{
temp = gEnigmaBerries[gActiveBank].itemEffect;
temp = gEnigmaBerries[gActiveBattler].itemEffect;
}
itemEffect = temp;
@ -210,7 +210,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
void sub_806CF24(s32 stat)
{
gBankDefender = gBankInMenu;
gBattleDefender = gBankInMenu;
StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[stat]]);
StringCopy(gBattleTextBuff2, gText_StatRose);
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2);
@ -247,7 +247,7 @@ u8 *sub_806CF78(u16 itemId)
}
else
{
gBankAttacker = gBankInMenu;
gBattleAttacker = gBankInMenu;
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnGettingPumped);
}
}
@ -255,7 +255,7 @@ u8 *sub_806CF78(u16 itemId)
if (itemEffect[3] & 0x80)
{
gBankAttacker = gBankInMenu;
gBattleAttacker = gBankInMenu;
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist);
}
@ -1366,7 +1366,7 @@ void sub_806E994(void)
gBattleTextBuff1[2] = gBattleStruct->field_49;
gBattleTextBuff1[4] = B_BUFF_EOS;
if (!GetBankSide(gBattleStruct->field_49))
if (!GetBattlerSide(gBattleStruct->field_49))
gBattleTextBuff1[3] = pokemon_order_func(gBattlePartyID[gBattleStruct->field_49]);
else
gBattleTextBuff1[3] = gBattlePartyID[gBattleStruct->field_49];

View File

@ -25,11 +25,11 @@ extern u32 gBattleTypeFlags;
extern u16 gTrainerBattleOpponent_A;
extern u16 gTrainerBattleOpponent_B;
extern u16 gPartnerTrainerId;
extern u8 gActiveBank;
extern u8 gBattleBanksCount;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gChosenMovesByBanks[BATTLE_BANKS_COUNT];
extern u8 gActiveBattler;
extern u8 gBattlersCount;
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
extern u16 gChosenMovesByBanks[MAX_BATTLERS_COUNT];
extern u8 gUnknown_03001278;
extern u8 gUnknown_03001279;
@ -52,13 +52,13 @@ struct RecordedBattleSave
{
struct Pokemon playerParty[PARTY_SIZE];
struct Pokemon opponentParty[PARTY_SIZE];
u8 playersName[BATTLE_BANKS_COUNT][PLAYER_NAME_LENGTH];
u8 playersGender[BATTLE_BANKS_COUNT];
u32 playersTrainerId[BATTLE_BANKS_COUNT];
u8 playersLanguage[BATTLE_BANKS_COUNT];
u8 playersName[MAX_BATTLERS_COUNT][PLAYER_NAME_LENGTH];
u8 playersGender[MAX_BATTLERS_COUNT];
u32 playersTrainerId[MAX_BATTLERS_COUNT];
u8 playersLanguage[MAX_BATTLERS_COUNT];
u32 rngSeed;
u32 battleFlags;
u8 playersBank[BATTLE_BANKS_COUNT];
u8 playersBank[MAX_BATTLERS_COUNT];
u16 opponentA;
u16 opponentB;
u16 partnerId;
@ -75,14 +75,14 @@ struct RecordedBattleSave
u16 field_50E[6];
u8 field_51A;
u8 field_51B;
u8 battleRecord[BATTLE_BANKS_COUNT][BANK_RECORD_SIZE];
u8 battleRecord[MAX_BATTLERS_COUNT][BANK_RECORD_SIZE];
u32 checksum;
};
EWRAM_DATA u32 gRecordedBattleRngSeed = 0;
EWRAM_DATA u32 gBattlePalaceMoveSelectionRngValue = 0;
EWRAM_DATA static u8 sBattleRecords[BATTLE_BANKS_COUNT][BANK_RECORD_SIZE] = {0};
EWRAM_DATA static u16 sRecordedBytesNo[BATTLE_BANKS_COUNT] = {0};
EWRAM_DATA static u8 sBattleRecords[MAX_BATTLERS_COUNT][BANK_RECORD_SIZE] = {0};
EWRAM_DATA static u16 sRecordedBytesNo[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u16 sUnknown_0203C79C[4] = {0};
EWRAM_DATA static u16 sUnknown_0203C7A4[4] = {0};
EWRAM_DATA static u8 sUnknown_0203C7AC = 0;
@ -99,7 +99,7 @@ EWRAM_DATA static u32 sRecordedBattle_AI_Scripts = 0;
EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
EWRAM_DATA static u16 sRecordedBattle_PlayerMonMoves[2][4] = {0};
EWRAM_DATA static struct PlayerInfo sRecordedBattle_Players[BATTLE_BANKS_COUNT] = {0};
EWRAM_DATA static struct PlayerInfo sRecordedBattle_Players[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD0 = 0;
EWRAM_DATA static u8 sUnknown_0203CCD1[8] = {0};
EWRAM_DATA static u8 sUnknown_0203CCD9 = 0;
@ -123,7 +123,7 @@ void sub_8184DA4(u8 arg0)
sUnknown_0203C7AC = arg0;
sUnknown_0203CCD0 = 0;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
sRecordedBytesNo[i] = 0;
sUnknown_0203C79C[i] = 0;
@ -164,7 +164,7 @@ void sub_8184E58(void)
gUnknown_0203C7B4 = GetMultiplayerId();
linkPlayersCount = GetLinkPlayerCount();
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
sRecordedBattle_Players[i].trainerId = gLinkPlayers[i].trainerId;
sRecordedBattle_Players[i].gender = gLinkPlayers[i].gender;
@ -248,7 +248,7 @@ u8 sub_81850DC(u8 *arg0)
u8 i, j;
u8 ret = 0;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (sRecordedBytesNo[i] != sUnknown_0203C79C[i])
{
@ -350,7 +350,7 @@ u32 MoveRecordedBattleToSaveData(void)
battleSave->opponentParty[i] = sSavedOpponentParty[i];
}
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
for (j = 0; j < PLAYER_NAME_LENGTH; j++)
{
@ -1339,7 +1339,7 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src)
gEnemyParty[i] = src->opponentParty[i];
}
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
for (var = FALSE, j = 0; j < PLAYER_NAME_LENGTH; j++)
{
@ -1386,7 +1386,7 @@ static void SetRecordedBattleVarsFromSave(struct RecordedBattleSave *src)
gSaveBlock2Ptr->frontierChosenLvl = src->field_4FC;
for (i = 0; i < BATTLE_BANKS_COUNT; i++)
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
for (j = 0; j < BANK_RECORD_SIZE; j++)
{
@ -1462,7 +1462,7 @@ u8 GetActiveBankLinkPlayerGender(void)
for (i = 0; i < MAX_LINK_PLAYERS; i++)
{
if (gLinkPlayers[i].lp_field_18 == gActiveBank)
if (gLinkPlayers[i].lp_field_18 == gActiveBattler)
break;
}
@ -1501,7 +1501,7 @@ void RecordedBattle_CopyBankMoves(void)
{
s32 i;
if (GetBankSide(gActiveBank) == SIDE_OPPONENT)
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
return;
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
return;
@ -1510,7 +1510,7 @@ void RecordedBattle_CopyBankMoves(void)
for (i = 0; i < 4; i++)
{
sRecordedBattle_PlayerMonMoves[gActiveBank / 2][i] = gBattleMons[gActiveBank].moves[i];
sRecordedBattle_PlayerMonMoves[gActiveBattler / 2][i] = gBattleMons[gActiveBattler].moves[i];
}
}
@ -1523,9 +1523,9 @@ void sub_818603C(u8 arg0)
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000))
return;
for (bank = 0; bank < gBattleBanksCount; bank++)
for (bank = 0; bank < gBattlersCount; bank++)
{
if (GetBankSide(bank) != SIDE_OPPONENT) // player's side only
if (GetBattlerSide(bank) != B_SIDE_OPPONENT) // player's side only
{
if (arg0 == 1)
{

View File

@ -22,14 +22,14 @@ extern u16 gBattle_BG2_Y;
extern u16 gBattle_BG3_X;
extern u16 gBattle_BG3_Y;
extern u8 gReservedSpritePaletteCount;
extern u8 gActionSelectionCursor[BATTLE_BANKS_COUNT];
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gBankInMenu;
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gBattleBanksCount;
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBattlersCount;
extern u32 gBattleTypeFlags;
extern u8 gBankSpriteIds[BATTLE_BANKS_COUNT];
extern u8 gBattleMonForms[BATTLE_BANKS_COUNT];
extern u8 gHealthBoxesIds[BATTLE_BANKS_COUNT];
extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT];
extern struct SpriteTemplate gUnknown_0202499C;
extern const union AnimCmd * const * const gMonAnimationsSpriteAnimsPtrTable[];
@ -164,13 +164,13 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
LoadAndCreateEnemyShadowSprites();
opponentBank = GetBankByPosition(B_POSITION_OPPONENT_LEFT);
opponentBank = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES);
SetBankEnemyShadowSpriteCallback(opponentBank, species);
if (IsDoubleBattle())
{
opponentBank = GetBankByPosition(B_POSITION_OPPONENT_RIGHT);
opponentBank = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
species = GetMonData(&gEnemyParty[gBattlePartyID[opponentBank]], MON_DATA_SPECIES);
SetBankEnemyShadowSpriteCallback(opponentBank, species);
}
@ -210,9 +210,9 @@ static void sub_80A95F4(void)
static bool8 LoadBankSpriteGfx(u8 bank)
{
if (bank < gBattleBanksCount)
if (bank < gBattlersCount)
{
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
{
if (!gBattleSpritesDataPtr->bankData[bank].behindSubstitute)
BattleLoadOpponentMonSpriteGfx(&gEnemyParty[gBattlePartyID[bank]], bank);
@ -245,7 +245,7 @@ extern const struct MonCoords gTrainerBackPicCoords[];
static void CreateBankSprite(u8 bank)
{
if (bank < gBattleBanksCount)
if (bank < gBattlersCount)
{
u8 posY;
@ -254,12 +254,12 @@ static void CreateBankSprite(u8 bank)
else
posY = GetBankSpriteDefault_Y(bank);
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
{
if (GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_HP) == 0)
return;
sub_806A068(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankPosition(bank));
sub_806A068(GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBattlerPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankCoord(bank, 2), posY, sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
@ -272,7 +272,7 @@ static void CreateBankSprite(u8 bank)
}
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI && bank == 0)
{
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBankPosition(B_POSITION_PLAYER_LEFT));
sub_806A12C(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
sub_80A82E4(0));
@ -282,7 +282,7 @@ static void CreateBankSprite(u8 bank)
}
else if (gBattleTypeFlags & BATTLE_TYPE_WALLY_TUTORIAL && bank == 0)
{
sub_806A12C(BACK_PIC_WALLY, GetBankPosition(0));
sub_806A12C(BACK_PIC_WALLY, GetBattlerPosition(0));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, 0x50,
(8 - gTrainerBackPicCoords[BACK_PIC_WALLY].coords) * 4 + 80,
sub_80A82E4(0));
@ -295,7 +295,7 @@ static void CreateBankSprite(u8 bank)
if (GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_HP) == 0)
return;
sub_806A068(GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBankPosition(bank));
sub_806A068(GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES), GetBattlerPosition(bank));
gBankSpriteIds[bank] = CreateSprite(&gUnknown_0202499C, GetBankCoord(bank, 2), posY, sub_80A82E4(bank));
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
@ -313,7 +313,7 @@ static void CreateBankSprite(u8 bank)
static void CreateHealthboxSprite(u8 bank)
{
if (bank < gBattleBanksCount)
if (bank < gBattlersCount)
{
u8 healthboxSpriteId;
@ -328,19 +328,19 @@ static void CreateHealthboxSprite(u8 bank)
SetBankHealthboxSpritePos(bank);
SetHealthboxSpriteVisible(healthboxSpriteId);
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gEnemyParty[gBattlePartyID[bank]], HEALTHBOX_ALL);
else if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[gBattlePartyID[bank]], HEALTHBOX_SAFARI_ALL_TEXT);
else
UpdateHealthboxAttribute(gHealthBoxesIds[bank], &gPlayerParty[gBattlePartyID[bank]], HEALTHBOX_ALL);
if (GetBankPosition(bank) == B_POSITION_OPPONENT_RIGHT || GetBankPosition(bank) == B_POSITION_PLAYER_RIGHT)
if (GetBattlerPosition(bank) == B_POSITION_OPPONENT_RIGHT || GetBattlerPosition(bank) == B_POSITION_PLAYER_RIGHT)
DummyBattleInterfaceFunc(gHealthBoxesIds[bank], TRUE);
else
DummyBattleInterfaceFunc(gHealthBoxesIds[bank], FALSE);
if (GetBankSide(bank) != SIDE_PLAYER)
if (GetBattlerSide(bank) != B_SIDE_PLAYER)
{
if (GetMonData(&gEnemyParty[gBattlePartyID[bank]], MON_DATA_HP) == 0)
SetHealthboxSpriteInvisible(healthboxSpriteId);

View File

@ -215,7 +215,7 @@ gBattleResults: @ 3005D10
gLeveledUpInBattle: @ 3005D54
.space 0xC
gBattleBankFunc: @ 3005D60
gBattlerFuncs: @ 3005D60
.space 0x10
gHealthBoxesIds: @ 3005D70

View File

@ -270,25 +270,25 @@ gBattleBufferA: @ 2023064
gBattleBufferB: @ 2023864
.space 0x800
gActiveBank: @ 2024064
gActiveBattler: @ 2024064
.space 0x4
gBattleExecBuffer: @ 2024068
.space 0x4
gBattleBanksCount: @ 202406C
gBattlersCount: @ 202406C
.space 0x2
gBattlePartyID: @ 202406E
.space 0x8
gBankPositions: @ 2024076
gBattlerPositions: @ 2024076
.space 0x4
gActionsByTurnOrder: @ 202407A
.space 0x4
gBanksByTurnOrder: @ 202407E
gBattleTurnOrder: @ 202407E
.space 0x4
gCurrentTurnActionNumber: @ 2024082
@ -333,10 +333,10 @@ gLastUsedItem: @ 2024208
gLastUsedAbility: @ 202420A
.space 0x1
gBankAttacker: @ 202420B
gBattleAttacker: @ 202420B
.space 0x1
gBankDefender: @ 202420C
gBattleDefender: @ 202420C
.space 0x1
gBank1: @ 202420D
@ -348,7 +348,7 @@ gEffectBank: @ 202420E
gStringBank: @ 202420F
.space 0x1
gAbsentBankFlags: @ 2024210
gAbsentBattlerFlags: @ 2024210
.space 0x1
gCritMultiplier: @ 2024211