start working on battle interface

This commit is contained in:
DizzyEggg 2017-10-16 18:12:27 +02:00
parent 0d38d443b5
commit 4b45282dd3
21 changed files with 706 additions and 917 deletions

View File

@ -1801,7 +1801,7 @@ _0805E056:
movs r4, 0
cmp r4, r5
bcs _0805E076
ldr r7, =gBanksBySide
ldr r7, =gBanksByIdentity
ldr r6, =gUnknown_0832C108
_0805E060:
adds r0, r4, r7
@ -1874,14 +1874,14 @@ _0805E0F0:
_0805E100:
cmp r4, 0x4
bne _0805E110
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0]
b _0805E198
.pool
_0805E110:
cmp r4, 0x5
bne _0805E1AC
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x1]
b _0805E198
.pool
@ -1916,28 +1916,28 @@ _0805E150:
_0805E160:
cmp r4, 0x6
bne _0805E170
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0]
b _0805E198
.pool
_0805E170:
cmp r4, 0x7
bne _0805E180
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x1]
b _0805E198
.pool
_0805E180:
cmp r4, 0x8
bne _0805E190
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x2]
b _0805E198
.pool
_0805E190:
cmp r5, 0x9
bne _0805E1AC
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r0, [r0, 0x3]
_0805E198:
lsls r0, 3
@ -2038,7 +2038,7 @@ _0805E252:
_0805E260:
ldrb r0, [r4]
bl SetBankHealthboxSpritePos
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
ldrb r1, [r4]
adds r0, r1, r0
ldrb r0, [r0]

View File

@ -10676,7 +10676,7 @@ _08103D54:
strh r0, [r3, 0x4]
b _08103DB6
_08103D5C:
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
ldr r0, =gAnimationBankTarget
ldrb r0, [r0]
adds r0, r1
@ -27474,7 +27474,7 @@ sub_810C560: @ 810C560
lsls r0, 8
strh r0, [r5, 0x3C]
_0810C594:
ldr r3, =gBanksBySide
ldr r3, =gBanksByIdentity
ldrb r0, [r7]
adds r0, r3
ldrb r1, [r0]
@ -27699,7 +27699,7 @@ _0810C736:
lsls r0, 24
cmp r0, 0
bne _0810C78C
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
ldrb r0, [r6]
adds r0, r1
ldrb r1, [r0]
@ -27843,7 +27843,7 @@ _0810C85A:
lsls r0, 24
cmp r0, 0
bne _0810C8B4
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
ldr r0, =gAnimationBankTarget
ldrb r0, [r0]
adds r0, r1
@ -28771,7 +28771,7 @@ _0810D000:
negs r0, r0
lsrs r4, r0, 16
_0810D012:
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
add r0, r8
ldrb r1, [r0]
adds r0, r7, 0

View File

@ -5171,7 +5171,7 @@ sub_80670A0: @ 80670A0
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0806715A
.pool
_08067130:
@ -5193,7 +5193,7 @@ _08067130:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
_0806715A:
ldr r1, =gBattleBankFunc
ldr r0, =gActiveBank

View File

@ -4480,7 +4480,7 @@ sub_814D63C: @ 814D63C
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0814D6F6
.pool
_0814D6CC:
@ -4502,7 +4502,7 @@ _0814D6CC:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
_0814D6F6:
ldr r1, =gBattleBankFunc
ldr r0, =gActiveBank

View File

@ -5621,7 +5621,7 @@ sub_8062294: @ 8062294
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0806234E
.pool
_08062324:
@ -5643,7 +5643,7 @@ _08062324:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
_0806234E:
ldr r1, =gBattleBankFunc
ldr r0, =gActiveBank

View File

@ -3557,7 +3557,7 @@ sub_8059330: @ 8059330
negs r0, r0
str r0, [sp]
mov r0, r10
bl sub_807294C
bl SetBattleBarStruct
movs r0, 0x21
bl PlaySE
ldr r0, =sub_8059400
@ -8992,7 +8992,7 @@ _0805C44A:
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0805C4F2
.pool
_0805C4B4:
@ -9016,7 +9016,7 @@ _0805C4B4:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
mov r2, r9
ldrb r0, [r2]
adds r0, r4

View File

@ -789,7 +789,7 @@ sub_81BB414: @ 81BB414
negs r0, r0
str r0, [sp]
mov r0, r10
bl sub_807294C
bl SetBattleBarStruct
movs r0, 0x21
bl PlaySE
ldr r0, =sub_81BB4E4
@ -5209,7 +5209,7 @@ sub_81BDC10: @ 81BDC10
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _081BDCCA
.pool
_081BDCA0:
@ -5231,7 +5231,7 @@ _081BDCA0:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
_081BDCCA:
ldr r1, =gBattleBankFunc
ldr r0, =gActiveBank

View File

@ -4910,7 +4910,7 @@ sub_8188FD0: @ 8188FD0
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0818908A
.pool
_08189060:
@ -4932,7 +4932,7 @@ _08189060:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
_0818908A:
ldr r1, =gBattleBankFunc
ldr r0, =gActiveBank

View File

@ -5054,7 +5054,7 @@ sub_818C5E8: @ 818C5E8
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0818C6B2
.pool
_0818C678:
@ -5076,7 +5076,7 @@ _0818C678:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
mov r1, r9
ldrb r0, [r1]
adds r0, r4

View File

@ -3883,7 +3883,7 @@ sub_816A5D4: @ 816A5D4
ldrb r1, [r1]
str r7, [sp]
mov r2, r8
bl sub_807294C
bl SetBattleBarStruct
b _0816A69E
.pool
_0816A664:
@ -3905,7 +3905,7 @@ _0816A664:
ldrb r1, [r1]
str r7, [sp]
movs r3, 0
bl sub_807294C
bl SetBattleBarStruct
mov r1, r9
ldrb r0, [r1]
adds r0, r4

View File

@ -5,803 +5,6 @@
.text
thumb_func_start sub_8072304
sub_8072304: @ 8072304
movs r0, 0x9
bx lr
thumb_func_end sub_8072304
thumb_func_start sub_8072308
sub_8072308: @ 8072308
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
adds r7, r1, 0
lsls r0, 16
lsrs r5, r0, 16
lsls r2, 24
lsrs r2, 24
mov r10, r2
movs r3, 0
movs r2, 0
_08072324:
lsls r0, r3, 24
asrs r0, 24
mov r3, sp
adds r1, r3, r0
strb r2, [r1]
adds r0, 0x1
lsls r0, 24
lsrs r3, r0, 24
asrs r0, 24
cmp r0, 0x3
ble _08072324
movs r3, 0x3
movs r0, 0x1
negs r0, r0
mov r9, r0
mov r8, sp
_08072344:
lsls r0, r5, 16
asrs r6, r0, 16
cmp r6, 0
ble _08072372
lsls r4, r3, 24
asrs r4, 24
mov r1, sp
adds r5, r1, r4
adds r0, r6, 0
movs r1, 0xA
bl __modsi3
strb r0, [r5]
adds r0, r6, 0
movs r1, 0xA
bl __divsi3
lsls r0, 16
lsrs r5, r0, 16
subs r4, 0x1
lsls r4, 24
lsrs r3, r4, 24
b _08072344
_08072372:
lsls r1, r3, 24
asrs r0, r1, 24
cmp r0, r9
ble _08072396
movs r4, 0xFF
movs r3, 0x1
negs r3, r3
_08072380:
asrs r2, r1, 24
mov r5, sp
adds r1, r5, r2
ldrb r0, [r1]
orrs r0, r4
strb r0, [r1]
subs r2, 0x1
lsls r1, r2, 24
asrs r0, r1, 24
cmp r0, r3
bgt _08072380
_08072396:
mov r1, r8
ldrb r0, [r1, 0x3]
cmp r0, 0xFF
bne _080723A2
movs r0, 0
strb r0, [r1, 0x3]
_080723A2:
mov r2, r10
cmp r2, 0
bne _08072432
movs r3, 0
movs r1, 0
movs r6, 0xFC
lsls r6, 8
movs r5, 0x1E
mov r12, r5
_080723B4:
lsls r1, 24
asrs r2, r1, 24
mov r0, sp
adds r5, r0, r2
ldrb r0, [r5]
mov r8, r1
cmp r0, 0xFF
bne _080723EA
lsls r1, r2, 1
adds r1, r7
ldrh r2, [r1]
adds r0, r6, 0
ands r0, r2
mov r2, r12
orrs r0, r2
strh r0, [r1]
lsls r3, 24
asrs r1, r3, 23
adds r1, r7
adds r1, 0x40
ldrh r2, [r1]
adds r0, r6, 0
ands r0, r2
mov r5, r12
orrs r0, r5
strh r0, [r1]
b _0807241A
_080723EA:
lsls r2, 1
adds r2, r7
ldrh r0, [r2]
adds r1, r6, 0
ands r1, r0
ldrb r0, [r5]
adds r0, 0x14
orrs r1, r0
strh r1, [r2]
lsls r4, r3, 24
asrs r3, r4, 24
lsls r2, r3, 1
adds r2, r7
adds r2, 0x40
ldrh r0, [r2]
adds r1, r6, 0
ands r1, r0
mov r5, sp
adds r0, r5, r3
ldrb r0, [r0]
adds r0, 0x34
orrs r1, r0
strh r1, [r2]
adds r3, r4, 0
_0807241A:
movs r0, 0x80
lsls r0, 17
add r0, r8
lsrs r1, r0, 24
movs r2, 0x80
lsls r2, 17
adds r0, r3, r2
lsrs r3, r0, 24
asrs r0, 24
cmp r0, 0x3
ble _080723B4
b _08072496
_08072432:
movs r3, 0
movs r4, 0xFC
lsls r4, 8
movs r6, 0x1E
_0807243A:
lsls r1, r3, 24
asrs r2, r1, 24
mov r3, sp
adds r5, r3, r2
ldrb r0, [r5]
adds r3, r1, 0
cmp r0, 0xFF
bne _08072466
lsls r1, r2, 1
adds r1, r7
ldrh r2, [r1]
adds r0, r4, 0
ands r0, r2
orrs r0, r6
strh r0, [r1]
adds r1, 0x40
ldrh r2, [r1]
adds r0, r4, 0
ands r0, r2
orrs r0, r6
strh r0, [r1]
b _08072488
_08072466:
lsls r2, 1
adds r2, r7
ldrh r0, [r2]
adds r1, r4, 0
ands r1, r0
ldrb r0, [r5]
adds r0, 0x14
orrs r1, r0
strh r1, [r2]
adds r2, 0x40
ldrh r0, [r2]
adds r1, r4, 0
ands r1, r0
ldrb r0, [r5]
adds r0, 0x34
orrs r1, r0
strh r1, [r2]
_08072488:
movs r5, 0x80
lsls r5, 17
adds r0, r3, r5
lsrs r3, r0, 24
asrs r0, 24
cmp r0, 0x3
ble _0807243A
_08072496:
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8072308
thumb_func_start sub_80724A8
sub_80724A8: @ 80724A8
push {r4,r5,lr}
adds r4, r0, 0
adds r0, r1, 0
adds r5, r2, 0
lsls r4, 16
lsrs r4, 16
movs r1, 0x1E
strh r1, [r5, 0x8]
lsls r0, 16
asrs r0, 16
adds r1, r5, 0
movs r2, 0
bl sub_8072308
lsls r4, 16
asrs r4, 16
adds r5, 0xA
adds r0, r4, 0
adds r1, r5, 0
movs r2, 0x1
bl sub_8072308
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_80724A8
thumb_func_start CreateBankHealthboxSprites
CreateBankHealthboxSprites: @ 80724DC
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
lsls r0, 24
lsrs r0, 24
mov r10, r0
movs r0, 0
str r0, [sp]
bl IsDoubleBattle
lsls r0, 24
cmp r0, 0
bne _080725F0
mov r0, r10
bl GetBankSide
lsls r0, 24
cmp r0, 0
bne _08072574
ldr r4, =gUnknown_0832C140
adds r0, r4, 0
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r6, r0, 24
adds r0, r4, 0
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSpriteAtEnd
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gSprites
lsls r1, r6, 4
adds r1, r6
lsls r1, 2
adds r1, r4
ldrb r2, [r1, 0x1]
movs r3, 0x3F
adds r0, r3, 0
ands r0, r2
strb r0, [r1, 0x1]
lsls r2, r7, 4
adds r2, r7
lsls r2, 2
adds r2, r4
ldrb r0, [r2, 0x1]
ands r3, r0
strb r3, [r2, 0x1]
ldrh r3, [r2, 0x4]
lsls r1, r3, 22
lsrs r1, 22
adds r1, 0x40
ldr r4, =0x000003ff
adds r0, r4, 0
ands r1, r0
ldr r0, =0xfffffc00
ands r0, r3
orrs r0, r1
strh r0, [r2, 0x4]
b _080725BA
.pool
_08072574:
ldr r4, =gUnknown_0832C170
adds r0, r4, 0
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r6, r0, 24
adds r0, r4, 0
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSpriteAtEnd
lsls r0, 24
lsrs r7, r0, 24
ldr r0, =gSprites
lsls r2, r7, 4
adds r2, r7
lsls r2, 2
adds r2, r0
ldrh r3, [r2, 0x4]
lsls r1, r3, 22
lsrs r1, 22
adds r1, 0x20
ldr r5, =0x000003ff
adds r0, r5, 0
ands r1, r0
ldr r0, =0xfffffc00
ands r0, r3
orrs r0, r1
strh r0, [r2, 0x4]
movs r0, 0x2
str r0, [sp]
_080725BA:
ldr r2, =gSprites
lsls r0, r6, 4
adds r0, r6
lsls r0, 2
adds r0, r2
strh r7, [r0, 0x6]
lsls r0, r7, 4
adds r0, r7
lsls r0, 2
adds r1, r0, r2
strh r6, [r1, 0x38]
adds r2, 0x1C
adds r0, r2
ldr r1, =sub_8072924
str r1, [r0]
b _08072718
.pool
_080725F0:
mov r0, r10
bl GetBankSide
lsls r0, 24
cmp r0, 0
bne _08072694
mov r0, r10
bl GetBankIdentity
adds r1, r0, 0
lsls r1, 24
lsrs r1, 25
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
ldr r4, =gUnknown_0832C140
adds r0, r4
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r6, r0, 24
mov r0, r10
bl GetBankIdentity
adds r1, r0, 0
lsls r1, 24
lsrs r1, 25
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r4
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSpriteAtEnd
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gSprites
lsls r0, r6, 4
adds r0, r6
lsls r0, 2
adds r0, r4
strh r7, [r0, 0x6]
lsls r2, r7, 4
adds r2, r7
lsls r2, 2
adds r3, r2, r4
strh r6, [r3, 0x38]
ldrh r1, [r3, 0x4]
mov r8, r1
mov r5, r8
lsls r1, r5, 22
lsrs r1, 22
adds r1, 0x20
ldr r5, =0x000003ff
adds r0, r5, 0
ands r1, r0
ldr r0, =0xfffffc00
mov r5, r8
ands r0, r5
orrs r0, r1
strh r0, [r3, 0x4]
adds r4, 0x1C
adds r2, r4
ldr r0, =sub_8072924
str r0, [r2]
movs r0, 0x1
b _08072716
.pool
_08072694:
mov r0, r10
bl GetBankIdentity
adds r1, r0, 0
lsls r1, 24
lsrs r1, 25
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
ldr r4, =gUnknown_0832C170
adds r0, r4
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r6, r0, 24
mov r0, r10
bl GetBankIdentity
adds r1, r0, 0
lsls r1, 24
lsrs r1, 25
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r0, r4
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSpriteAtEnd
lsls r0, 24
lsrs r7, r0, 24
ldr r4, =gSprites
lsls r0, r6, 4
adds r0, r6
lsls r0, 2
adds r0, r4
strh r7, [r0, 0x6]
lsls r2, r7, 4
adds r2, r7
lsls r2, 2
adds r3, r2, r4
strh r6, [r3, 0x38]
ldrh r1, [r3, 0x4]
mov r8, r1
mov r5, r8
lsls r1, r5, 22
lsrs r1, 22
adds r1, 0x20
ldr r5, =0x000003ff
adds r0, r5, 0
ands r1, r0
ldr r0, =0xfffffc00
mov r5, r8
ands r0, r5
orrs r0, r1
strh r0, [r3, 0x4]
adds r4, 0x1C
adds r2, r4
ldr r0, =sub_8072924
str r0, [r2]
movs r0, 0x2
_08072716:
str r0, [sp]
_08072718:
ldr r0, =gBanksBySide
add r0, r10
ldrb r1, [r0]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
ldr r1, =gUnknown_0832C1C0
adds r0, r1
movs r1, 0x8C
movs r2, 0x3C
movs r3, 0
bl CreateSpriteAtEnd
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
lsls r4, r5, 4
adds r4, r5
lsls r4, 2
ldr r1, =gSprites
mov r8, r1
add r4, r8
mov r0, r10
bl GetBankSide
adds r1, r0, 0
lsls r1, 24
lsrs r1, 21
ldr r0, =gUnknown_0832C28C
adds r1, r0
adds r0, r4, 0
bl SetSubspriteTables
adds r2, r4, 0
adds r2, 0x42
ldrb r1, [r2]
movs r0, 0x3F
ands r0, r1
movs r1, 0x80
orrs r0, r1
strb r0, [r2]
ldrb r1, [r4, 0x5]
movs r0, 0xD
negs r0, r0
ands r0, r1
movs r2, 0x4
mov r9, r2
mov r1, r9
orrs r0, r1
strb r0, [r4, 0x5]
movs r0, 0x1
bl sub_80728A4
ldrh r1, [r4, 0x4]
lsls r1, 22
lsrs r1, 17
ldr r2, =0x06010000
adds r1, r2
ldr r2, =0x04000010
bl CpuSet
lsls r0, r6, 4
adds r0, r6
lsls r0, 2
add r0, r8
strh r5, [r0, 0x38]
mov r2, r10
strh r2, [r0, 0x3A]
adds r0, 0x3E
ldrb r1, [r0]
mov r5, r9
orrs r1, r5
strb r1, [r0]
lsls r0, r7, 4
adds r0, r7
lsls r0, 2
add r0, r8
adds r0, 0x3E
ldrb r1, [r0]
orrs r1, r5
strb r1, [r0]
strh r6, [r4, 0x38]
mov r0, sp
ldrh r0, [r0]
strh r0, [r4, 0x3A]
adds r4, 0x3E
ldrb r0, [r4]
orrs r0, r5
strb r0, [r4]
adds r0, r6, 0
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end CreateBankHealthboxSprites
thumb_func_start CreateSafariPlayerHealthboxSprites
CreateSafariPlayerHealthboxSprites: @ 8072804
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
ldr r4, =gUnknown_0832C1A0
adds r0, r4, 0
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSprite
adds r6, r0, 0
lsls r6, 24
lsrs r6, 24
adds r0, r4, 0
movs r1, 0xF0
movs r2, 0xA0
movs r3, 0x1
bl CreateSpriteAtEnd
lsls r0, 24
lsrs r0, 24
ldr r1, =gSprites
mov r9, r1
lsls r4, r6, 4
adds r4, r6
lsls r4, 2
add r4, r9
ldrb r3, [r4, 0x1]
movs r2, 0x3F
adds r1, r2, 0
ands r1, r3
strb r1, [r4, 0x1]
lsls r3, r0, 4
adds r3, r0
lsls r3, 2
mov r7, r9
adds r5, r3, r7
ldrb r1, [r5, 0x1]
ands r2, r1
strb r2, [r5, 0x1]
ldrh r1, [r5, 0x4]
mov r8, r1
mov r7, r8
lsls r2, r7, 22
lsrs r2, 22
adds r2, 0x40
ldr r7, =0x000003ff
adds r1, r7, 0
ands r2, r1
ldr r1, =0xfffffc00
mov r7, r8
ands r1, r7
orrs r1, r2
strh r1, [r5, 0x4]
strh r0, [r4, 0x6]
strh r6, [r5, 0x38]
movs r0, 0x1C
add r9, r0
add r3, r9
ldr r0, =sub_8072924
str r0, [r3]
adds r0, r6, 0
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end CreateSafariPlayerHealthboxSprites
thumb_func_start sub_80728A4
sub_80728A4: @ 80728A4
lsls r0, 24
lsrs r0, 19
ldr r1, =gUnknown_08C11BDC
adds r0, r1
bx lr
.pool
thumb_func_end sub_80728A4
thumb_func_start sub_80728B4
sub_80728B4: @ 80728B4
push {r4,r5,lr}
adds r4, r0, 0
ldrh r0, [r4, 0x38]
lsls r0, 24
lsrs r5, r0, 24
movs r1, 0x3A
ldrsh r0, [r4, r1]
cmp r0, 0x1
beq _080728E4
cmp r0, 0x1
bgt _080728F8
cmp r0, 0
bne _080728F8
ldr r2, =gSprites
lsls r3, r5, 4
adds r1, r3, r5
lsls r1, 2
adds r1, r2
ldrh r0, [r1, 0x20]
adds r0, 0x10
b _08072906
.pool
_080728E4:
ldr r2, =gSprites
lsls r3, r5, 4
adds r1, r3, r5
lsls r1, 2
adds r1, r2
ldrh r0, [r1, 0x20]
adds r0, 0x10
b _08072906
.pool
_080728F8:
ldr r2, =gSprites
lsls r3, r5, 4
adds r1, r3, r5
lsls r1, 2
adds r1, r2
ldrh r0, [r1, 0x20]
adds r0, 0x8
_08072906:
strh r0, [r4, 0x20]
ldrh r0, [r1, 0x22]
strh r0, [r4, 0x22]
adds r0, r3, r5
lsls r0, 2
adds r0, r2
ldrh r1, [r0, 0x24]
strh r1, [r4, 0x24]
ldrh r0, [r0, 0x26]
strh r0, [r4, 0x26]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80728B4
thumb_func_start sub_8072924
sub_8072924: @ 8072924
ldrh r1, [r0, 0x38]
lsls r1, 24
lsrs r1, 24
ldr r3, =gSprites
lsls r2, r1, 4
adds r2, r1
lsls r2, 2
adds r2, r3
ldrh r1, [r2, 0x20]
adds r1, 0x40
strh r1, [r0, 0x20]
ldrh r1, [r2, 0x22]
strh r1, [r0, 0x22]
ldrh r1, [r2, 0x24]
strh r1, [r0, 0x24]
ldrh r1, [r2, 0x26]
strh r1, [r0, 0x26]
bx lr
.pool
thumb_func_end sub_8072924
thumb_func_start sub_807294C
sub_807294C: @ 807294C
push {r4-r7,lr}
ldr r7, [sp, 0x14]
lsls r0, 24
lsrs r0, 24
ldr r6, =gBattleSpritesDataPtr
ldr r4, [r6]
ldr r5, [r4, 0xC]
lsls r4, r0, 2
adds r4, r0
lsls r4, 2
adds r5, r4, r5
strb r1, [r5]
ldr r0, [r6]
ldr r0, [r0, 0xC]
adds r4, r0
str r2, [r4, 0x4]
str r3, [r4, 0x8]
str r7, [r4, 0xC]
ldr r0, =0xffff8000
str r0, [r4, 0x10]
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_807294C
thumb_func_start SetHealthboxSpriteInvisible
SetHealthboxSpriteInvisible: @ 8072984
push {r4,lr}
@ -1448,7 +651,7 @@ _08072E5E:
ldr r0, [sp, 0x28]
bl sub_807512C
movs r0, 0x74
bl sub_80728A4
bl GetHealthboxElementGfxPtr
ldrh r1, [r7, 0x4]
lsls r1, 22
lsrs r1, 17
@ -1647,7 +850,7 @@ _08073084:
cmp r0, 0
bne _080730B8
movs r0, 0x74
bl sub_80728A4
bl GetHealthboxElementGfxPtr
ldr r2, =gSprites
mov r3, r9
lsls r1, r3, 4
@ -1778,7 +981,7 @@ _080731A4:
_080731A8:
movs r0, 0x2B
_080731AA:
bl sub_80728A4
bl GetHealthboxElementGfxPtr
lsls r1, r5, 6
adds r1, r6, r1
ldr r2, =0x04000008
@ -2109,7 +1312,7 @@ _08073468:
movs r2, 0x5
bl UpdateHealthboxAttribute
movs r0, 0x75
bl sub_80728A4
bl GetHealthboxElementGfxPtr
ldrb r2, [r6]
lsls r1, r2, 4
adds r1, r2
@ -3932,7 +3135,7 @@ sub_8074310: @ 8074310
cmp r7, 0
beq _080743C4
movs r0, 0x46
bl sub_80728A4
bl GetHealthboxElementGfxPtr
lsls r1, r4, 4
adds r1, r4
lsls r1, 2
@ -4047,7 +3250,7 @@ _08074484:
bl sub_80746A8
lsls r0, 24
lsrs r0, 24
bl sub_80728A4
bl GetHealthboxElementGfxPtr
adds r6, r0, 0
movs r0, 0x2
b _080745B8
@ -4062,7 +3265,7 @@ _080744AC:
bl sub_80746A8
lsls r0, 24
lsrs r0, 24
bl sub_80728A4
bl GetHealthboxElementGfxPtr
adds r6, r0, 0
movs r0, 0
b _080745B8
@ -4076,7 +3279,7 @@ _080744CA:
bl sub_80746A8
lsls r0, 24
lsrs r0, 24
bl sub_80728A4
bl GetHealthboxElementGfxPtr
adds r6, r0, 0
movs r0, 0x4
b _080745B8
@ -4090,7 +3293,7 @@ _080744E8:
bl sub_80746A8
lsls r0, 24
lsrs r0, 24
bl sub_80728A4
bl GetHealthboxElementGfxPtr
adds r6, r0, 0
movs r0, 0x3
b _080745B8
@ -4104,13 +3307,13 @@ _08074506:
bl sub_80746A8
lsls r0, 24
lsrs r0, 24
bl sub_80728A4
bl GetHealthboxElementGfxPtr
adds r6, r0, 0
movs r0, 0x1
b _080745B8
_08074524:
movs r0, 0x27
bl sub_80728A4
bl GetHealthboxElementGfxPtr
adds r6, r0, 0
movs r4, 0
mov r2, r9
@ -4150,7 +3353,7 @@ _08074542:
cmp r0, 0
bne _08074598
movs r0, 0x1
bl sub_80728A4
bl GetHealthboxElementGfxPtr
ldr r2, =gSprites
mov r3, r10
lsls r1, r3, 4
@ -4233,7 +3436,7 @@ _08074626:
cmp r0, 0
bne _08074672
movs r0, 0
bl sub_80728A4
bl GetHealthboxElementGfxPtr
mov r3, r10
lsls r4, r3, 4
add r4, r10
@ -4248,7 +3451,7 @@ _08074626:
adds r2, r5, 0
bl CpuSet
movs r0, 0x41
bl sub_80728A4
bl GetHealthboxElementGfxPtr
ldrh r1, [r4, 0x4]
lsls r1, 22
lsrs r1, 17
@ -4574,7 +3777,7 @@ _08074914:
mov r0, r9
adds r1, r6, 0
adds r2, r4, 0
bl sub_807294C
bl SetBattleBarStruct
mov r0, r9
adds r1, r6, 0
movs r2, 0
@ -4636,7 +3839,7 @@ _0807495E:
str r0, [sp]
mov r0, r9
adds r1, r6, 0
bl sub_807294C
bl SetBattleBarStruct
mov r0, r9
adds r1, r6, 0
movs r2, 0x1
@ -4710,7 +3913,7 @@ _08074A3C:
mov r0, r9
adds r1, r6, 0
adds r2, r4, 0
bl sub_807294C
bl SetBattleBarStruct
mov r0, r9
adds r1, r6, 0
movs r2, 0
@ -4941,7 +4144,7 @@ _08074BFA:
cmp r5, 0x1
bhi _08074C5C
mov r0, r9
bl sub_80728A4
bl GetHealthboxElementGfxPtr
mov r1, sp
adds r1, r5
adds r1, 0x8
@ -4966,7 +4169,7 @@ _08074BFA:
.pool
_08074C5C:
mov r0, r9
bl sub_80728A4
bl GetHealthboxElementGfxPtr
mov r1, sp
adds r1, r5
adds r1, 0x8
@ -5048,7 +4251,7 @@ _08074D02:
cmp r5, 0x3
bhi _08074D5C
movs r0, 0xC
bl sub_80728A4
bl GetHealthboxElementGfxPtr
mov r1, sp
adds r1, r5
adds r1, 0x8
@ -5079,7 +4282,7 @@ _08074D02:
.pool
_08074D5C:
movs r0, 0xC
bl sub_80728A4
bl GetHealthboxElementGfxPtr
mov r1, sp
adds r1, r5
adds r1, 0x8

View File

@ -1048,7 +1048,7 @@ _080D8004:
bl sub_80DC594
bl sub_80DC5E8
bl sub_80DC7EC
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r4, [r1]
movs r0, 0x1
strb r0, [r1, 0x1]

View File

@ -51,7 +51,7 @@ SetUpBattleVarsAndBirchZigzagoon: @ 803269C
movs r2, 0
ldr r5, =gMoveSelectionCursor
ldr r4, =nullsub_21
ldr r3, =gBanksBySide
ldr r3, =gBanksByIdentity
_080326B8:
lsls r0, r1, 2
adds r0, r7
@ -232,7 +232,7 @@ b_setup_bx: @ 8032824
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToRecordedPlayerBufferRunCommand
str r0, [r2]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
movs r0, 0
strb r0, [r1]
b _0803287E
@ -241,7 +241,7 @@ _08032874:
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToPlayerBufferRunCommand
str r0, [r2]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r4, [r1]
_0803287E:
ldr r3, =SetBankFuncToOpponentBufferRunCommand
@ -313,7 +313,7 @@ _08032930:
_08032934:
str r0, [r1]
mov r10, r1
ldr r4, =gBanksBySide
ldr r4, =gBanksByIdentity
movs r0, 0
mov r9, r0
mov r1, r9
@ -386,7 +386,7 @@ _080329E0:
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToPlayerBufferRunCommand
str r0, [r2]
ldr r4, =gBanksBySide
ldr r4, =gBanksByIdentity
strb r5, [r4]
ldr r6, =SetBankFuncToOpponentBufferRunCommand
str r6, [r2, 0x4]
@ -756,7 +756,7 @@ b_setup_bx_link: @ 8032CC0
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToPlayerBufferRunCommand
str r0, [r2]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r3, [r1]
ldr r0, =SetBankFuncToLinkOpponentBufferRunCommand
str r0, [r2, 0x4]
@ -769,7 +769,7 @@ _08032D1C:
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToPlayerBufferRunCommand
str r0, [r2, 0x4]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r4, [r1, 0x1]
ldr r0, =SetBankFuncToLinkOpponentBufferRunCommand
str r0, [r2]
@ -794,7 +794,7 @@ _08032D48:
ldr r2, =gBattleBankFunc
ldr r4, =SetBankFuncToPlayerBufferRunCommand
str r4, [r2]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
movs r0, 0
strb r0, [r1]
ldr r3, =SetBankFuncToLinkOpponentBufferRunCommand
@ -812,7 +812,7 @@ _08032D98:
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToPlayerBufferRunCommand
str r0, [r2, 0x4]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r3, [r1, 0x1]
ldr r3, =SetBankFuncToLinkOpponentBufferRunCommand
str r3, [r2]
@ -845,7 +845,7 @@ _08032DD0:
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToPlayerBufferRunCommand
str r0, [r2]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
movs r0, 0
strb r0, [r1]
ldr r3, =SetBankFuncToOpponentBufferRunCommand
@ -858,7 +858,7 @@ _08032E1C:
ldr r2, =gBattleBankFunc
ldr r0, =SetBankFuncToLinkPartnerBufferRunCommand
str r0, [r2]
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
strb r3, [r1]
ldr r3, =SetBankFuncToLinkOpponentBufferRunCommand
str r3, [r2, 0x4]
@ -911,7 +911,7 @@ _08032EA4:
mov r10, r0
ldr r1, =gLinkPlayers
mov r12, r1
ldr r7, =gBanksBySide
ldr r7, =gBanksByIdentity
mov r8, r0
ldr r6, =gBattlePartyID
movs r4, 0
@ -1144,7 +1144,7 @@ _08033074:
movs r0, 0x1
add r0, r8
mov r10, r0
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
add r0, r8
mov r9, r0
mov r0, r8

View File

@ -1810,7 +1810,7 @@ _080A6A04:
GetBankSide: @ 80A6A30
lsls r0, 24
lsrs r0, 24
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
adds r0, r1
ldrb r1, [r0]
movs r0, 0x1
@ -1823,7 +1823,7 @@ GetBankSide: @ 80A6A30
GetBankIdentity: @ 80A6A44
lsls r0, 24
lsrs r0, 24
ldr r1, =gBanksBySide
ldr r1, =gBanksByIdentity
adds r0, r1
ldrb r0, [r0]
bx lr
@ -1840,7 +1840,7 @@ GetBankByIdentity: @ 80A6A54
ldrb r2, [r0]
cmp r1, r2
bcs _080A6A7E
ldr r4, =gBanksBySide
ldr r4, =gBanksByIdentity
ldrb r0, [r4]
cmp r0, r3
beq _080A6A7E
@ -1883,7 +1883,7 @@ sub_80A6A90: @ 80A6A90
b _080A6B18
.pool
_080A6ABC:
ldr r0, =gBanksBySide
ldr r0, =gBanksByIdentity
adds r0, r4, r0
ldrb r0, [r0]
cmp r0, 0xFF

View File

@ -4,48 +4,7 @@
.section .rodata
.align 2, 0
gUnknown_0832C138:: @ 832C138
.byte 0x00, 0x40, 0x00, 0xc0, 0x00, 0x04, 0x00, 0x00
.align 2
gUnknown_0832C140:: @ 832C140
spr_template 0xd6ff, 0xd6ff, gUnknown_0832C138, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_0832C158:: @ 832C158
spr_template 0xd700, 0xd6ff, gUnknown_0832C138, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_0832C170:: @ 832C170
spr_template 0xd701, 0xd6ff, gUnknown_0832C138, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_0832C188:: @ 832C188
spr_template 0xd702, 0xd6ff, gUnknown_0832C138, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_0832C1A0:: @ 832C1A0
spr_template 0xd70b, 0xd6ff, gUnknown_0832C138, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_0832C1B8:: @ 832C1B8
.byte 0x00, 0x40, 0x00, 0x40, 0x00, 0x04, 0x00, 0x00
.align 2
gUnknown_0832C1C0:: @ 832C1C0
spr_template 0xd704, 0xd704, gUnknown_0832C1B8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80728B4
.align 2
gUnknown_0832C1D8:: @ 832C1D8
spr_template 0xd705, 0xd704, gUnknown_0832C1B8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80728B4
.align 2
gUnknown_0832C1F0:: @ 832C1F0
spr_template 0xd706, 0xd704, gUnknown_0832C1B8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80728B4
.align 2
gUnknown_0832C208:: @ 832C208
spr_template 0xd707, 0xd704, gUnknown_0832C1B8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80728B4
.align 2
gUnknown_0832C220:: @ 832C220

View File

@ -39,7 +39,7 @@ gBattleInterface_BallDisplayPal:: @ 8C11BBC
.incbin "graphics/battle_interface/ball_display.gbapal"
.align 2
gUnknown_08C11BDC:: @ 8C11BDC
gHealthboxElementsGfxTable:: @ 8C11BDC
.incbin "baserom.gba", 0xc11bdc, 0x840
.align 2

View File

@ -903,11 +903,21 @@ struct BattleHealthboxInfo
u8 field_B;
};
struct BattleBarInfo
{
u8 healthboxSpriteId;
u32 maxValue;
u32 currentValue;
bool32 isDoubleBattle;
s32 field_10;
};
struct BattleSpriteData
{
struct BattleSpriteInfo *bankData;
struct BattleHealthboxInfo *healthBoxesData;
struct BattleAnimationInfo *animationData;
struct BattleBarInfo *battleBars;
};
extern struct BattleSpriteData *gBattleSpritesDataPtr;

View File

@ -39,18 +39,18 @@ struct PlttData
struct OamData
{
/*0x00*/ u32 y:8;
/*0x01*/ u32 affineMode:2;
u32 objMode:2;
u32 mosaic:1;
u32 bpp:1;
u32 shape:2;
/*0x01*/ u32 affineMode:2; // 0x1, 0x2 -> 0x4
u32 objMode:2; // 0x4, 0x8 -> 0xC
u32 mosaic:1; // 0x10
u32 bpp:1; // 0x20
u32 shape:2; // 0x40, 0x80 -> 0xC0
/*0x02*/ u32 x:9;
u32 matrixNum:5; // bits 3/4 are h-flip/v-flip if not in affine mode
u32 size:2;
/*0x04*/ u16 tileNum:10;
u16 priority:2;
/*0x04*/ u16 tileNum:10; // 0x33F
u16 priority:2; // 0x400, 0x800 -> 0xC00
u16 paletteNum:4;
/*0x06*/ u16 affineParam;
};

View File

@ -79,6 +79,7 @@ SECTIONS {
src/blend_palette.o(.text);
asm/daycare.o(.text);
src/egg_hatch.o(.text);
src/battle_interface.o(.text);
asm/battle_interface.o(.text);
asm/smokescreen.o(.text);
asm/pokeball.o(.text);
@ -339,6 +340,7 @@ SECTIONS {
data/daycare.o(.rodata);
src/egg_hatch.o(.rodata);
data/battle_7.o(.rodata);
src/battle_interface.o(.rodata);
data/battle_interface.o(.rodata);
data/pokeball.o(.rodata);
data/trade.o(.rodata);

615
src/battle_interface.c Normal file
View File

@ -0,0 +1,615 @@
#include "global.h"
#include "battle.h"
#include "pokemon.h"
#include "battle_interface.h"
#include "sprite.h"
extern bool8 IsDoubleBattle(void);
extern u8 gBanksByIdentity[BATTLE_BANKS_COUNT];
// this file's functions
void sub_8072924(struct Sprite *sprite);
void sub_80728B4(struct Sprite *sprite);
const u32 *GetHealthboxElementGfxPtr(u8 elementId);
// const rom data
const struct OamData gUnknown_0832C138 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
extern const struct SubspriteTable gUnknown_0832C28C[2];
static const struct SpriteTemplate gUnknown_0832C140[2] =
{
{
.tileTag = 0xD6FF,
.paletteTag = 0xD6FF,
.oam = &gUnknown_0832C138,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
},
{
.tileTag = 0xd700,
.paletteTag = 0xD6FF,
.oam = &gUnknown_0832C138,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
}
};
static const struct SpriteTemplate gUnknown_0832C170[2] =
{
{
.tileTag = 0xd701,
.paletteTag = 0xD6FF,
.oam = &gUnknown_0832C138,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
},
{
.tileTag = 0xd702,
.paletteTag = 0xD6FF,
.oam = &gUnknown_0832C138,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
}
};
static const struct SpriteTemplate gUnknown_0832C1A0 =
{
.tileTag = 0xd70b,
.paletteTag = 0xd6ff,
.oam = &gUnknown_0832C138,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
const struct OamData gUnknown_0832C1B8 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const struct SpriteTemplate gUnknown_0832C1C0[4] =
{
{
.tileTag = 0xd704,
.paletteTag = 0xd704,
.oam = &gUnknown_0832C1B8,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80728B4
},
{
.tileTag = 0xd705,
.paletteTag = 0xd704,
.oam = &gUnknown_0832C1B8,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80728B4
},
{
.tileTag = 0xd706,
.paletteTag = 0xd704,
.oam = &gUnknown_0832C1B8,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80728B4
},
{
.tileTag = 0xd707,
.paletteTag = 0xd704,
.oam = &gUnknown_0832C1B8,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80728B4
}
};
u8 sub_8072304(void)
{
return 9;
}
#ifdef NONMATCHING
void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
{
s8 i, j;
s8 array[4];
for (i = 0; i < 4; i++)
array[i] = 0;
i = 3;
while (1)
{
if (arg0 < 0)
break;
array[i] = arg0 % 10;
arg0 /= 10;
i--;
}
for (j = i; j > -1; j--)
{
array[j] = -1;
}
if (array[3] == -1)
array[3] = 0;
if (arg2 == 0)
{
for (i = 0; i < 4; i++)
{
if (array[i] == -1)
{
arg1[i] &= 0xFC00;
arg1[i] |= 0x1E;
arg1[i + 0x20] &= 0xFC00;
arg1[i + 0x20] |= 0x1E;
}
else
{
arg1[i] &= 0xFC00;
arg1[i] |= array[i] + 0x14;
arg1[i + 0x20] &= 0xFC00;
arg1[i + 0x20] |= array[i] + 0x34;
}
}
}
else
{
for (i = 0; i < 4; i++)
{
if (array[i] == -1)
{
arg1[i] &= 0xFC00;
arg1[i] |= 0x1E;
arg1[i + 0x20] &= 0xFC00;
arg1[i + 0x20] |= 0x1E;
}
else
{
arg1[i] &= 0xFC00;
arg1[i] |= array[i] + 0x14;
arg1[i + 0x20] &= 0xFC00;
arg1[i + 0x20] |= array[i] + 0x34;
}
}
}
}
#else
__attribute__((naked))
void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x4\n\
adds r7, r1, 0\n\
lsls r0, 16\n\
lsrs r5, r0, 16\n\
lsls r2, 24\n\
lsrs r2, 24\n\
mov r10, r2\n\
movs r3, 0\n\
movs r2, 0\n\
_08072324:\n\
lsls r0, r3, 24\n\
asrs r0, 24\n\
mov r3, sp\n\
adds r1, r3, r0\n\
strb r2, [r1]\n\
adds r0, 0x1\n\
lsls r0, 24\n\
lsrs r3, r0, 24\n\
asrs r0, 24\n\
cmp r0, 0x3\n\
ble _08072324\n\
movs r3, 0x3\n\
movs r0, 0x1\n\
negs r0, r0\n\
mov r9, r0\n\
mov r8, sp\n\
_08072344:\n\
lsls r0, r5, 16\n\
asrs r6, r0, 16\n\
cmp r6, 0\n\
ble _08072372\n\
lsls r4, r3, 24\n\
asrs r4, 24\n\
mov r1, sp\n\
adds r5, r1, r4\n\
adds r0, r6, 0\n\
movs r1, 0xA\n\
bl __modsi3\n\
strb r0, [r5]\n\
adds r0, r6, 0\n\
movs r1, 0xA\n\
bl __divsi3\n\
lsls r0, 16\n\
lsrs r5, r0, 16\n\
subs r4, 0x1\n\
lsls r4, 24\n\
lsrs r3, r4, 24\n\
b _08072344\n\
_08072372:\n\
lsls r1, r3, 24\n\
asrs r0, r1, 24\n\
cmp r0, r9\n\
ble _08072396\n\
movs r4, 0xFF\n\
movs r3, 0x1\n\
negs r3, r3\n\
_08072380:\n\
asrs r2, r1, 24\n\
mov r5, sp\n\
adds r1, r5, r2\n\
ldrb r0, [r1]\n\
orrs r0, r4\n\
strb r0, [r1]\n\
subs r2, 0x1\n\
lsls r1, r2, 24\n\
asrs r0, r1, 24\n\
cmp r0, r3\n\
bgt _08072380\n\
_08072396:\n\
mov r1, r8\n\
ldrb r0, [r1, 0x3]\n\
cmp r0, 0xFF\n\
bne _080723A2\n\
movs r0, 0\n\
strb r0, [r1, 0x3]\n\
_080723A2:\n\
mov r2, r10\n\
cmp r2, 0\n\
bne _08072432\n\
movs r3, 0\n\
movs r1, 0\n\
movs r6, 0xFC\n\
lsls r6, 8\n\
movs r5, 0x1E\n\
mov r12, r5\n\
_080723B4:\n\
lsls r1, 24\n\
asrs r2, r1, 24\n\
mov r0, sp\n\
adds r5, r0, r2\n\
ldrb r0, [r5]\n\
mov r8, r1\n\
cmp r0, 0xFF\n\
bne _080723EA\n\
lsls r1, r2, 1\n\
adds r1, r7\n\
ldrh r2, [r1]\n\
adds r0, r6, 0\n\
ands r0, r2\n\
mov r2, r12\n\
orrs r0, r2\n\
strh r0, [r1]\n\
lsls r3, 24\n\
asrs r1, r3, 23\n\
adds r1, r7\n\
adds r1, 0x40\n\
ldrh r2, [r1]\n\
adds r0, r6, 0\n\
ands r0, r2\n\
mov r5, r12\n\
orrs r0, r5\n\
strh r0, [r1]\n\
b _0807241A\n\
_080723EA:\n\
lsls r2, 1\n\
adds r2, r7\n\
ldrh r0, [r2]\n\
adds r1, r6, 0\n\
ands r1, r0\n\
ldrb r0, [r5]\n\
adds r0, 0x14\n\
orrs r1, r0\n\
strh r1, [r2]\n\
lsls r4, r3, 24\n\
asrs r3, r4, 24\n\
lsls r2, r3, 1\n\
adds r2, r7\n\
adds r2, 0x40\n\
ldrh r0, [r2]\n\
adds r1, r6, 0\n\
ands r1, r0\n\
mov r5, sp\n\
adds r0, r5, r3\n\
ldrb r0, [r0]\n\
adds r0, 0x34\n\
orrs r1, r0\n\
strh r1, [r2]\n\
adds r3, r4, 0\n\
_0807241A:\n\
movs r0, 0x80\n\
lsls r0, 17\n\
add r0, r8\n\
lsrs r1, r0, 24\n\
movs r2, 0x80\n\
lsls r2, 17\n\
adds r0, r3, r2\n\
lsrs r3, r0, 24\n\
asrs r0, 24\n\
cmp r0, 0x3\n\
ble _080723B4\n\
b _08072496\n\
_08072432:\n\
movs r3, 0\n\
movs r4, 0xFC\n\
lsls r4, 8\n\
movs r6, 0x1E\n\
_0807243A:\n\
lsls r1, r3, 24\n\
asrs r2, r1, 24\n\
mov r3, sp\n\
adds r5, r3, r2\n\
ldrb r0, [r5]\n\
adds r3, r1, 0\n\
cmp r0, 0xFF\n\
bne _08072466\n\
lsls r1, r2, 1\n\
adds r1, r7\n\
ldrh r2, [r1]\n\
adds r0, r4, 0\n\
ands r0, r2\n\
orrs r0, r6\n\
strh r0, [r1]\n\
adds r1, 0x40\n\
ldrh r2, [r1]\n\
adds r0, r4, 0\n\
ands r0, r2\n\
orrs r0, r6\n\
strh r0, [r1]\n\
b _08072488\n\
_08072466:\n\
lsls r2, 1\n\
adds r2, r7\n\
ldrh r0, [r2]\n\
adds r1, r4, 0\n\
ands r1, r0\n\
ldrb r0, [r5]\n\
adds r0, 0x14\n\
orrs r1, r0\n\
strh r1, [r2]\n\
adds r2, 0x40\n\
ldrh r0, [r2]\n\
adds r1, r4, 0\n\
ands r1, r0\n\
ldrb r0, [r5]\n\
adds r0, 0x34\n\
orrs r1, r0\n\
strh r1, [r2]\n\
_08072488:\n\
movs r5, 0x80\n\
lsls r5, 17\n\
adds r0, r3, r5\n\
lsrs r3, r0, 24\n\
asrs r0, 24\n\
cmp r0, 0x3\n\
ble _0807243A\n\
_08072496:\n\
add sp, 0x4\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.syntax divided");
}
#endif // NONMATCHING
void sub_80724A8(s16 arg0, s16 arg1, u16 *arg2)
{
arg2[4] = 0x1E;
sub_8072308(arg1, arg2, 0);
sub_8072308(arg0, arg2 + 5, 1);
}
u8 CreateBankHealthboxSprites(u8 bank)
{
s16 data6 = 0;
u8 healthboxSpriteId_1, healthboxSpriteId_2;
u8 unkSpriteId;
struct Sprite *unkSpritePtr;
if (!IsDoubleBattle())
{
if (GetBankSide(bank) == SIDE_PLAYER)
{
healthboxSpriteId_1 = CreateSprite(&gUnknown_0832C140[0], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&gUnknown_0832C140[0], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.shape = 0;
gSprites[healthboxSpriteId_2].oam.shape = 0;
gSprites[healthboxSpriteId_2].oam.tileNum += 64;
}
else
{
healthboxSpriteId_1 = CreateSprite(&gUnknown_0832C170[0], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&gUnknown_0832C170[0], 240, 160, 1);
gSprites[healthboxSpriteId_2].oam.tileNum += 32;
data6 = 2;
}
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
gSprites[healthboxSpriteId_2].data5 = healthboxSpriteId_1;
gSprites[healthboxSpriteId_2].callback = sub_8072924;
}
else
{
if (GetBankSide(bank) == SIDE_PLAYER)
{
healthboxSpriteId_1 = CreateSprite(&gUnknown_0832C140[GetBankIdentity(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&gUnknown_0832C140[GetBankIdentity(bank) / 2], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
gSprites[healthboxSpriteId_2].data5 = healthboxSpriteId_1;
gSprites[healthboxSpriteId_2].oam.tileNum += 32;
gSprites[healthboxSpriteId_2].callback = sub_8072924;
data6 = 1;
}
else
{
healthboxSpriteId_1 = CreateSprite(&gUnknown_0832C170[GetBankIdentity(bank) / 2], 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&gUnknown_0832C170[GetBankIdentity(bank) / 2], 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
gSprites[healthboxSpriteId_2].data5 = healthboxSpriteId_1;
gSprites[healthboxSpriteId_2].oam.tileNum += 32;
gSprites[healthboxSpriteId_2].callback = sub_8072924;
data6 = 2;
}
}
unkSpriteId = CreateSpriteAtEnd(&gUnknown_0832C1C0[gBanksByIdentity[bank]], 140, 60, 0);
unkSpritePtr = &gSprites[unkSpriteId];
SetSubspriteTables(unkSpritePtr, &gUnknown_0832C28C[GetBankSide(bank)]);
unkSpritePtr->subspriteMode = 2;
unkSpritePtr->oam.priority = 1;
CpuCopy32(GetHealthboxElementGfxPtr(1), (void*)(OBJ_VRAM0 + unkSpritePtr->oam.tileNum * 32), 64);
gSprites[healthboxSpriteId_1].data5 = unkSpriteId;
gSprites[healthboxSpriteId_1].data6 = bank;
gSprites[healthboxSpriteId_1].invisible = 1;
gSprites[healthboxSpriteId_2].invisible = 1;
unkSpritePtr->data5 = healthboxSpriteId_1;
unkSpritePtr->data6 = data6;
unkSpritePtr->invisible = 1;
return healthboxSpriteId_1;
}
u8 CreateSafariPlayerHealthboxSprites(void)
{
u8 healthboxSpriteId_1, healthboxSpriteId_2;
healthboxSpriteId_1 = CreateSprite(&gUnknown_0832C1A0, 240, 160, 1);
healthboxSpriteId_2 = CreateSpriteAtEnd(&gUnknown_0832C1A0, 240, 160, 1);
gSprites[healthboxSpriteId_1].oam.shape = 0;
gSprites[healthboxSpriteId_2].oam.shape = 0;
gSprites[healthboxSpriteId_2].oam.tileNum += 64;
gSprites[healthboxSpriteId_1].oam.affineParam = healthboxSpriteId_2;
gSprites[healthboxSpriteId_2].data5 = healthboxSpriteId_1;
gSprites[healthboxSpriteId_2].callback = sub_8072924;
return healthboxSpriteId_1;
}
extern const u32 gHealthboxElementsGfxTable[][8];
const u32 *GetHealthboxElementGfxPtr(u8 elementId)
{
return gHealthboxElementsGfxTable[elementId];
}
void sub_80728B4(struct Sprite *sprite)
{
u8 var = sprite->data5;
switch (sprite->data6)
{
case 0:
sprite->pos1.x = gSprites[var].pos1.x + 16;
sprite->pos1.y = gSprites[var].pos1.y;
break;
case 1:
sprite->pos1.x = gSprites[var].pos1.x + 16;
sprite->pos1.y = gSprites[var].pos1.y;
break;
case 2:
default:
sprite->pos1.x = gSprites[var].pos1.x + 8;
sprite->pos1.y = gSprites[var].pos1.y;
break;
}
sprite->pos2.x = gSprites[var].pos2.x;
sprite->pos2.y = gSprites[var].pos2.y;
}
void sub_8072924(struct Sprite *sprite)
{
u8 otherSpriteId = sprite->data5;
sprite->pos1.x = gSprites[otherSpriteId].pos1.x + 64;
sprite->pos1.y = gSprites[otherSpriteId].pos1.y;
sprite->pos2.x = gSprites[otherSpriteId].pos2.x;
sprite->pos2.y = gSprites[otherSpriteId].pos2.y;
}
void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, u32 maxVal, u32 currVal, bool32 isDoubleBattle)
{
gBattleSpritesDataPtr->battleBars[bank].healthboxSpriteId = healthboxSpriteId;
gBattleSpritesDataPtr->battleBars[bank].maxValue = maxVal;
gBattleSpritesDataPtr->battleBars[bank].currentValue = currVal;
gBattleSpritesDataPtr->battleBars[bank].isDoubleBattle = isDoubleBattle;
gBattleSpritesDataPtr->battleBars[bank].field_10 = -32768;
}

View File

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