Merge with master

This commit is contained in:
DizzyEggg 2019-04-16 11:14:50 +02:00
commit 17cf13beef
42 changed files with 2563 additions and 5549 deletions

View File

@ -5,847 +5,6 @@
.text
thumb_func_start sub_802C838
sub_802C838: @ 802C838
push {r4-r6,lr}
movs r5, 0
movs r4, 0
ldr r3, =gUnknown_02022CFC
ldr r0, [r3]
ldr r2, =gUnknown_082FB714
ldr r1, [r0, 0x78]
ldr r0, [r2]
cmp r1, r0
bcc _0802C874
ldr r5, [r2, 0x4]
adds r6, r3, 0
adds r3, r2, 0x4
_0802C852:
adds r3, 0x8
adds r2, 0x8
adds r4, 0x1
cmp r4, 0x4
bhi _0802C874
ldr r0, [r6]
ldr r1, [r0, 0x78]
ldr r0, [r2]
cmp r1, r0
bcc _0802C874
ldr r5, [r3]
b _0802C852
.pool
_0802C874:
lsls r0, r5, 16
lsrs r0, 16
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_802C838
thumb_func_start sub_802C880
sub_802C880: @ 802C880
push {r4,r5,lr}
lsls r0, 16
lsrs r5, r0, 16
lsls r1, 16
lsrs r4, r1, 16
b _0802C892
_0802C88C:
subs r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
_0802C892:
cmp r4, 0
beq _0802C8A4
adds r0, r5, 0
adds r1, r4, 0
bl CheckBagHasSpace
lsls r0, 24
cmp r0, 0
beq _0802C88C
_0802C8A4:
adds r0, r4, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_802C880
thumb_func_start sub_802C8AC
sub_802C8AC: @ 802C8AC
push {lr}
bl GetLinkPlayerCount
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
thumb_func_end sub_802C8AC
thumb_func_start sub_802C8BC
sub_802C8BC: @ 802C8BC
ldr r0, =gUnknown_02022CFC
ldr r0, [r0]
ldrb r0, [r0, 0x6]
bx lr
.pool
thumb_func_end sub_802C8BC
thumb_func_start sub_802C8C8
sub_802C8C8: @ 802C8C8
lsls r0, 24
lsrs r0, 24
ldr r2, =gUnknown_02022CFC
lsls r1, r0, 1
adds r1, r0
lsls r1, 2
ldr r0, =0x000082a8
adds r1, r0
ldr r0, [r2]
adds r0, r1
bx lr
.pool
thumb_func_end sub_802C8C8
thumb_func_start sub_802C8E8
sub_802C8E8: @ 802C8E8
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
ldr r2, =gUnknown_02022CFC
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
ldr r1, [r2]
adds r0, r1
movs r1, 0x83
lsls r1, 8
adds r0, r1
bx lr
.pool
thumb_func_end sub_802C8E8
thumb_func_start sub_802C908
sub_802C908: @ 802C908
push {lr}
lsls r0, 16
lsrs r0, 16
bl sub_802AC00
lsls r0, 16
asrs r0, 16
mvns r0, r0
lsrs r0, 31
pop {r1}
bx r1
thumb_func_end sub_802C908
thumb_func_start sub_802C920
sub_802C920: @ 802C920
push {r4,r5,lr}
movs r5, 0
_0802C924:
movs r0, 0x64
adds r1, r5, 0
muls r1, r0
ldr r0, =gPlayerParty
adds r4, r1, r0
adds r0, r4, 0
movs r1, 0x5
bl GetMonData
cmp r0, 0
beq _0802C95C
adds r0, r4, 0
movs r1, 0x41
bl GetMonData
lsls r0, 16
lsrs r0, 16
bl sub_802C908
cmp r0, 0
beq _0802C95C
ldr r1, =gSpecialVar_Result
movs r0, 0x1
b _0802C966
.pool
_0802C95C:
adds r5, 0x1
cmp r5, 0x5
ble _0802C924
ldr r1, =gSpecialVar_Result
movs r0, 0
_0802C966:
strh r0, [r1]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C920
thumb_func_start sub_802C974
sub_802C974: @ 802C974
push {r4-r6,lr}
adds r6, r0, 0
movs r4, 0
ldr r5, =gUnknown_082FBE08
_0802C97C:
adds r0, r5, 0
bl LoadCompressedSpriteSheet
adds r5, 0x8
adds r4, 0x1
cmp r4, 0x4
bls _0802C97C
movs r4, 0
ldr r5, =gUnknown_082FBE30
_0802C98E:
adds r0, r5, 0
bl LoadSpritePalette
adds r5, 0x8
adds r4, 0x1
cmp r4, 0x1
bls _0802C98E
movs r0, 0x5
bl IndexOfSpritePaletteTag
strb r0, [r6, 0xE]
movs r0, 0x6
bl IndexOfSpritePaletteTag
strb r0, [r6, 0xF]
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C974
thumb_func_start sub_802C9BC
sub_802C9BC: @ 802C9BC
push {lr}
movs r2, 0
movs r1, 0x7
adds r0, 0x3C
_0802C9C4:
strh r2, [r0]
subs r0, 0x2
subs r1, 0x1
cmp r1, 0
bge _0802C9C4
pop {r0}
bx r0
thumb_func_end sub_802C9BC
thumb_func_start sub_802C9D4
sub_802C9D4: @ 802C9D4
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x34
mov r9, r0
adds r7, r1, 0
ldr r0, [sp, 0x54]
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x28]
lsls r3, 16
lsrs r3, 16
str r3, [sp, 0x2C]
lsls r0, 24
lsrs r6, r0, 24
mov r1, sp
ldr r0, =gUnknown_082FBE40
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
movs r0, 0x80
lsls r0, 6
bl Alloc
mov r8, r0
movs r0, 0x80
lsls r0, 4
bl Alloc
mov r10, r0
bl sub_802C8BC
lsls r0, 16
lsrs r0, 16
cmp r6, r0
bne _0802CA2C
movs r0, 0x3
b _0802CA32
.pool
_0802CA2C:
adds r0, r6, 0x4
lsls r0, 24
lsrs r0, 24
_0802CA32:
str r0, [sp, 0x30]
mov r1, r8
cmp r1, 0
beq _0802CAF4
mov r2, r10
cmp r2, 0
beq _0802CAF4
ldrh r2, [r7]
lsls r0, r2, 3
ldr r1, =gMonFrontPicTable
adds r0, r1
ldr r3, [r7, 0x8]
mov r1, r8
bl HandleLoadSpecialPokePic
mov r3, r8
str r3, [sp, 0x18]
adds r4, r6, 0
add r0, sp, 0x18
ldr r5, =0xffff0000
lsls r1, r4, 16
movs r2, 0x80
lsls r2, 4
orrs r1, r2
str r1, [r0, 0x4]
bl LoadSpriteSheet
ldrh r0, [r7]
ldr r1, [r7, 0x4]
ldr r2, [r7, 0x8]
bl GetFrontSpritePalFromSpeciesAndPersonality
str r0, [sp, 0x20]
add r0, sp, 0x20
ldr r1, [r0, 0x4]
ands r1, r5
orrs r1, r4
str r1, [r0, 0x4]
bl LoadCompressedSpritePalette
mov r0, r8
bl Free
mov r0, r10
bl Free
mov r1, sp
mov r0, sp
ldrh r0, [r0]
adds r0, r6
strh r0, [r1]
mov r0, sp
ldrh r0, [r0, 0x2]
adds r0, r6
strh r0, [r1, 0x2]
ldr r4, [sp, 0x28]
lsls r1, r4, 16
asrs r1, 16
ldr r0, [sp, 0x2C]
lsls r2, r0, 16
asrs r2, 16
mov r0, sp
ldr r3, [sp, 0x30]
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x40
beq _0802CAF4
lsls r0, r6, 2
ldr r2, =0x000081a8
add r2, r9
adds r2, r0
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
str r0, [r2]
ldr r0, =0x000081fc
add r0, r9
adds r0, r6
add r1, sp, 0x30
ldrb r1, [r1]
strb r1, [r0]
b _0802CB00
.pool
_0802CAF4:
lsls r0, r6, 2
ldr r1, =0x000081a8
add r1, r9
adds r1, r0
movs r0, 0
str r0, [r1]
_0802CB00:
add sp, 0x34
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_802C9D4
thumb_func_start sub_802CB14
sub_802CB14: @ 802CB14
push {r4-r6,lr}
adds r4, r0, 0
lsls r6, r1, 2
ldr r0, =0x000081bc
adds r5, r4, r0
adds r5, r6
ldr r0, [r5]
bl sub_802C9BC
ldr r2, [r5]
ldr r0, =0x000081a8
adds r4, r0
adds r4, r6
ldr r1, [r4]
ldr r0, =gSprites
subs r1, r0
lsls r0, r1, 4
subs r0, r1
lsls r1, r0, 8
adds r0, r1
lsls r1, r0, 16
adds r0, r1
negs r0, r0
asrs r0, 2
strh r0, [r2, 0x3C]
ldr r1, [r5]
adds r1, 0x3E
ldrb r2, [r1]
movs r0, 0x5
negs r0, r0
ands r0, r2
strb r0, [r1]
ldr r1, [r5]
movs r0, 0x60
strh r0, [r1, 0x22]
ldr r0, [r5]
ldr r1, =sub_802CB7C
str r1, [r0, 0x1C]
movs r1, 0x1
bl StartSpriteAnim
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CB14
thumb_func_start sub_802CB7C
sub_802CB7C: @ 802CB7C
push {lr}
adds r2, r0, 0
movs r1, 0x2E
ldrsh r0, [r2, r1]
cmp r0, 0x1
beq _0802CBA8
cmp r0, 0x1
bgt _0802CB92
cmp r0, 0
beq _0802CB98
b _0802CBE6
_0802CB92:
cmp r0, 0x2
beq _0802CBC8
b _0802CBE6
_0802CB98:
adds r0, r2, 0
adds r0, 0x3F
ldrb r1, [r0]
movs r0, 0x10
ands r0, r1
cmp r0, 0
beq _0802CBE6
b _0802CBD6
_0802CBA8:
ldrh r1, [r2, 0x22]
subs r1, 0x1
strh r1, [r2, 0x22]
ldrh r0, [r2, 0x30]
adds r0, 0x1
strh r0, [r2, 0x30]
lsls r1, 16
asrs r1, 16
cmp r1, 0x48
bgt _0802CBE6
movs r0, 0x48
strh r0, [r2, 0x22]
ldrh r0, [r2, 0x2E]
adds r0, 0x1
strh r0, [r2, 0x2E]
b _0802CBE6
_0802CBC8:
ldrh r0, [r2, 0x30]
adds r0, 0x1
strh r0, [r2, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x2F
ble _0802CBE6
_0802CBD6:
adds r3, r2, 0
adds r3, 0x3E
ldrb r0, [r3]
movs r1, 0x4
orrs r0, r1
strb r0, [r3]
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
_0802CBE6:
pop {r0}
bx r0
.pool
thumb_func_end sub_802CB7C
thumb_func_start sub_802CBF0
sub_802CBF0: @ 802CBF0
push {lr}
lsls r1, 2
ldr r2, =0x000081a8
adds r0, r2
adds r0, r1
ldr r2, [r0]
ldr r1, =sub_802CC40
str r1, [r2, 0x1C]
movs r1, 0
strh r1, [r2, 0x26]
ldr r0, [r0]
bl sub_802C9BC
pop {r0}
bx r0
.pool
thumb_func_end sub_802CBF0
thumb_func_start sub_802CC18
sub_802CC18: @ 802CC18
push {lr}
movs r2, 0
lsls r1, 2
ldr r3, =0x000081a8
adds r0, r3
adds r0, r1
ldr r0, [r0]
ldr r1, [r0, 0x1C]
ldr r0, =sub_802CC40
cmp r1, r0
bne _0802CC30
movs r2, 0x1
_0802CC30:
adds r0, r2, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_802CC18
thumb_func_start sub_802CC40
sub_802CC40: @ 802CC40
push {lr}
adds r2, r0, 0
ldrh r0, [r2, 0x30]
adds r0, 0x1
strh r0, [r2, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
ble _0802CC6C
ldrh r0, [r2, 0x32]
adds r0, 0x1
strh r0, [r2, 0x32]
movs r1, 0x1
ands r0, r1
cmp r0, 0
beq _0802CC64
movs r0, 0x2
b _0802CC66
_0802CC64:
ldr r0, =0x0000fffe
_0802CC66:
strh r0, [r2, 0x26]
movs r0, 0
strh r0, [r2, 0x30]
_0802CC6C:
movs r1, 0x32
ldrsh r0, [r2, r1]
cmp r0, 0xC
ble _0802CC7C
movs r0, 0
strh r0, [r2, 0x26]
ldr r0, =SpriteCallbackDummy
str r0, [r2, 0x1C]
_0802CC7C:
pop {r0}
bx r0
.pool
thumb_func_end sub_802CC40
thumb_func_start sub_802CC88
sub_802CC88: @ 802CC88
push {r4,lr}
adds r4, r0, 0
lsls r1, 2
ldr r0, =0x000081a8
adds r4, r0
adds r4, r1
ldr r0, [r4]
bl sub_802C9BC
ldr r1, [r4]
ldr r0, =sub_802CD08
str r0, [r1, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CC88
thumb_func_start sub_802CCB0
sub_802CCB0: @ 802CCB0
push {r4-r7,lr}
adds r4, r0, 0
bl sub_802C8AC
lsls r0, 16
lsrs r0, 16
cmp r0, 0
beq _0802CCF4
movs r1, 0x5
negs r1, r1
mov r12, r1
ldr r1, =0x000081a8
adds r3, r4, r1
ldr r7, =sub_802CD08
ldr r6, =SpriteCallbackDummy
movs r5, 0xA
adds r4, r0, 0
_0802CCD2:
ldr r2, [r3]
ldr r0, [r2, 0x1C]
cmp r0, r7
bne _0802CCEC
adds r2, 0x3E
ldrb r1, [r2]
mov r0, r12
ands r0, r1
strb r0, [r2]
ldr r0, [r3]
str r6, [r0, 0x1C]
adds r0, 0x43
strb r5, [r0]
_0802CCEC:
adds r3, 0x4
subs r4, 0x1
cmp r4, 0
bne _0802CCD2
_0802CCF4:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CCB0
thumb_func_start sub_802CD08
sub_802CD08: @ 802CD08
push {lr}
adds r3, r0, 0
ldrh r0, [r3, 0x2E]
adds r0, 0x1
strh r0, [r3, 0x2E]
lsls r0, 16
asrs r0, 16
cmp r0, 0x3
ble _0802CD36
movs r0, 0
strh r0, [r3, 0x2E]
adds r3, 0x3E
ldrb r2, [r3]
lsls r0, r2, 29
lsrs r0, 31
movs r1, 0x1
eors r1, r0
lsls r1, 2
movs r0, 0x5
negs r0, r0
ands r0, r2
orrs r0, r1
strb r0, [r3]
_0802CD36:
pop {r0}
bx r0
thumb_func_end sub_802CD08
thumb_func_start sub_802CD3C
sub_802CD3C: @ 802CD3C
push {r4,r5,lr}
adds r4, r0, 0
bl sub_802C8AC
lsls r0, 16
lsrs r3, r0, 16
movs r2, 0
cmp r2, r3
bge _0802CD66
ldr r0, =0x000081fc
adds r5, r4, r0
subs r0, 0x54
adds r4, r0
_0802CD56:
ldm r4!, {r0}
adds r1, r5, r2
ldrb r1, [r1]
adds r0, 0x43
strb r1, [r0]
adds r2, 0x1
cmp r2, r3
blt _0802CD56
_0802CD66:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CD3C
thumb_func_start sub_802CD70
sub_802CD70: @ 802CD70
push {r4,lr}
adds r4, r0, 0
lsls r1, 2
ldr r0, =0x000081a8
adds r4, r0
adds r4, r1
ldr r0, [r4]
bl sub_802C9BC
ldr r1, [r4]
ldr r0, =sub_802CDD4
str r0, [r1, 0x1C]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CD70
thumb_func_start sub_802CD98
sub_802CD98: @ 802CD98
push {r4,r5,lr}
adds r4, r0, 0
bl sub_802C8AC
lsls r0, 16
lsrs r3, r0, 16
movs r2, 0
cmp r2, r3
bge _0802CDCC
ldr r5, =sub_802CDD4
ldr r0, =0x000081a8
adds r1, r4, r0
_0802CDB0:
ldr r0, [r1]
ldr r0, [r0, 0x1C]
cmp r0, r5
bne _0802CDC4
movs r0, 0x1
b _0802CDCE
.pool
_0802CDC4:
adds r1, 0x4
adds r2, 0x1
cmp r2, r3
blt _0802CDB0
_0802CDCC:
movs r0, 0
_0802CDCE:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_802CD98
thumb_func_start sub_802CDD4
sub_802CDD4: @ 802CDD4
push {r4,r5,lr}
adds r5, r0, 0
movs r0, 0x2E
ldrsh r4, [r5, r0]
cmp r4, 0
beq _0802CDE6
cmp r4, 0x1
beq _0802CDF4
b _0802CE3C
_0802CDE6:
movs r0, 0x22
bl PlaySE
strh r4, [r5, 0x30]
ldrh r0, [r5, 0x2E]
adds r0, 0x1
strh r0, [r5, 0x2E]
_0802CDF4:
ldrh r0, [r5, 0x30]
adds r0, 0x4
strh r0, [r5, 0x30]
lsls r0, 16
asrs r0, 16
cmp r0, 0x7F
ble _0802CE06
movs r0, 0
strh r0, [r5, 0x30]
_0802CE06:
ldr r1, =gSineTable
movs r2, 0x30
ldrsh r0, [r5, r2]
lsls r0, 1
adds r0, r1
ldrh r0, [r0]
lsls r0, 16
asrs r0, 19
negs r0, r0
strh r0, [r5, 0x26]
movs r0, 0x30
ldrsh r1, [r5, r0]
cmp r1, 0
bne _0802CE3C
ldrh r0, [r5, 0x32]
adds r0, 0x1
strh r0, [r5, 0x32]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1
bgt _0802CE38
strh r1, [r5, 0x2E]
b _0802CE3C
.pool
_0802CE38:
ldr r0, =SpriteCallbackDummy
str r0, [r5, 0x1C]
_0802CE3C:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CDD4
thumb_func_start sub_802CE48
sub_802CE48: @ 802CE48
push {r4,r5,lr}
adds r5, r0, 0
lsls r3, 24
lsrs r4, r3, 24
ldr r0, =gUnknown_082FC00C
lsls r1, 16
asrs r1, 16
lsls r2, 16
asrs r2, 16
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x40
beq _0802CE88
ldr r0, =gSprites
lsls r1, r2, 4
adds r1, r2
lsls r1, 2
adds r1, r0
adds r3, r1, 0
adds r3, 0x3E
ldrb r0, [r3]
movs r2, 0x4
orrs r0, r2
strb r0, [r3]
lsls r2, r4, 2
ldr r3, =0x000081bc
adds r0, r5, r3
adds r0, r2
str r1, [r0]
_0802CE88:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802CE48
thumb_func_start sub_802CE9C
sub_802CE9C: @ 802CE9C
push {r4-r7,lr}

View File

@ -1,864 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
@ File centered around AllocSubstruct(1)
thumb_func_start sub_81C9268
sub_81C9268: @ 81C9268
push {r4,lr}
movs r4, 0
movs r0, 0x98
lsls r0, 1
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081C928A
movs r4, 0x1
ldr r0, =0x0000089b
bl FlagGet
lsls r0, 24
cmp r0, 0
beq _081C928A
movs r4, 0x2
_081C928A:
adds r0, r4, 0
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_81C9268
thumb_func_start sub_81C9298
sub_81C9298: @ 81C9298
push {r4,lr}
movs r0, 0x1
movs r1, 0x10
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081C92C4
bl sub_81C9268
lsls r0, 24
lsrs r0, 24
movs r1, 0
strh r0, [r4]
strh r1, [r4, 0x2]
strh r1, [r4, 0x4]
strh r1, [r4, 0x6]
adds r0, r4, 0
bl sub_81C939C
movs r0, 0x1
b _081C92C6
_081C92C4:
movs r0, 0
_081C92C6:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C9298
thumb_func_start sub_81C92CC
sub_81C92CC: @ 81C92CC
push {r4,lr}
movs r0, 0x1
movs r1, 0x10
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081C92FA
bl sub_81C9268
lsls r0, 24
lsrs r0, 24
movs r1, 0
strh r0, [r4]
movs r0, 0x2
strh r0, [r4, 0x2]
strh r0, [r4, 0x4]
strh r1, [r4, 0x6]
adds r0, r4, 0
bl sub_81C939C
movs r0, 0x1
b _081C92FC
_081C92FA:
movs r0, 0
_081C92FC:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C92CC
thumb_func_start sub_81C9304
sub_81C9304: @ 81C9304
push {r4,lr}
movs r0, 0x1
movs r1, 0x10
bl AllocSubstruct
adds r4, r0, 0
cmp r4, 0
beq _081C932E
bl sub_81C9268
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
movs r0, 0x3
strh r0, [r4, 0x2]
strh r0, [r4, 0x4]
adds r0, r4, 0
bl sub_81C939C
movs r0, 0x1
b _081C9330
_081C932E:
movs r0, 0
_081C9330:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C9304
thumb_func_start sub_81C9338
sub_81C9338: @ 81C9338
push {lr}
movs r0, 0x1
movs r1, 0x10
bl AllocSubstruct
adds r2, r0, 0
cmp r2, 0
beq _081C9360
movs r0, 0
movs r1, 0x3
strh r1, [r2]
strh r0, [r2, 0x2]
movs r1, 0x5
strh r1, [r2, 0x4]
strh r0, [r2, 0x6]
adds r0, r2, 0
bl sub_81C939C
movs r0, 0x1
b _081C9362
_081C9360:
movs r0, 0
_081C9362:
pop {r1}
bx r1
thumb_func_end sub_81C9338
thumb_func_start sub_81C9368
sub_81C9368: @ 81C9368
push {r4,r5,lr}
movs r0, 0x1
movs r1, 0x10
bl AllocSubstruct
adds r5, r0, 0
cmp r5, 0
beq _081C9394
movs r4, 0
movs r0, 0x4
strh r0, [r5]
bl sub_81C76AC
strh r0, [r5, 0x2]
adds r0, 0x8
strh r0, [r5, 0x4]
strh r4, [r5, 0x6]
adds r0, r5, 0
bl sub_81C939C
movs r0, 0x1
b _081C9396
_081C9394:
movs r0, 0
_081C9396:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81C9368
thumb_func_start sub_81C939C
sub_81C939C: @ 81C939C
push {r4,lr}
adds r4, r0, 0
ldrh r0, [r4]
cmp r0, 0x4
bhi _081C93E0
lsls r0, 2
ldr r1, =_081C93B4
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081C93B4:
.4byte _081C93C8
.4byte _081C93CE
.4byte _081C93CE
.4byte _081C93D4
.4byte _081C93DC
_081C93C8:
movs r0, 0
bl SetPokenavMode
_081C93CE:
bl sub_81C93EC
b _081C93DE
_081C93D4:
ldr r0, =sub_81C963C
b _081C93DE
.pool
_081C93DC:
ldr r0, =sub_81C96FC
_081C93DE:
str r0, [r4, 0xC]
_081C93E0:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C939C
thumb_func_start sub_81C93EC
sub_81C93EC: @ 81C93EC
push {lr}
bl GetPokenavMode
cmp r0, 0x1
beq _081C9408
cmp r0, 0x1
bcc _081C93FE
cmp r0, 0x2
beq _081C9410
_081C93FE:
ldr r0, =sub_81C943C
b _081C9412
.pool
_081C9408:
ldr r0, =sub_81C9520
b _081C9412
.pool
_081C9410:
ldr r0, =c2_pre_battle_1
_081C9412:
pop {r1}
bx r1
.pool
thumb_func_end sub_81C93EC
thumb_func_start sub_81C941C
sub_81C941C: @ 81C941C
push {lr}
movs r0, 0x1
bl GetSubstructPtr
ldr r1, [r0, 0xC]
bl _call_via_r1
pop {r1}
bx r1
thumb_func_end sub_81C941C
thumb_func_start sub_81C9430
sub_81C9430: @ 81C9430
push {lr}
movs r0, 0x1
bl FreePokenavSubstruct
pop {r0}
bx r0
thumb_func_end sub_81C9430
thumb_func_start sub_81C943C
sub_81C943C: @ 81C943C
push {r4,r5,lr}
adds r4, r0, 0
bl sub_81C9814
cmp r0, 0
beq _081C944C
movs r0, 0x1
b _081C951A
_081C944C:
ldr r2, =gMain
ldrh r1, [r2, 0x2E]
movs r0, 0x1
ands r0, r1
adds r5, r2, 0
cmp r0, 0
beq _081C9508
ldr r3, =gUnknown_0861FC59
movs r0, 0x2
ldrsh r1, [r4, r0]
ldrh r2, [r4]
lsls r0, r2, 1
adds r0, r2
lsls r0, 1
adds r1, r0
adds r1, r3
ldrb r0, [r1]
cmp r0, 0x4
bhi _081C9508
lsls r0, 2
ldr r1, =_081C9488
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081C9488:
.4byte _081C949C
.4byte _081C94BC
.4byte _081C94D4
.4byte _081C94E0
.4byte _081C9516
_081C949C:
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldrb r1, [r0, 0x15]
movs r0, 0x8
ands r0, r1
movs r1, 0x1
cmp r0, 0
beq _081C94AE
movs r1, 0x2
_081C94AE:
strh r1, [r4, 0x6]
ldr r1, =0x000186a6
b _081C94EE
.pool
_081C94BC:
movs r1, 0
movs r0, 0x3
strh r0, [r4]
strh r1, [r4, 0x2]
ldrb r0, [r3, 0x12]
strh r0, [r4, 0x4]
ldr r0, =sub_81C963C
str r0, [r4, 0xC]
movs r0, 0x2
b _081C951A
.pool
_081C94D4:
movs r0, 0x6
strh r0, [r4, 0x6]
ldr r1, =0x000186ab
b _081C94EE
.pool
_081C94E0:
bl CanViewRibbonsMenu
cmp r0, 0
beq _081C94FC
movs r0, 0x9
strh r0, [r4, 0x6]
ldr r1, =0x000186ac
_081C94EE:
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x8
b _081C951A
.pool
_081C94FC:
ldr r0, =sub_81C9600
str r0, [r4, 0xC]
movs r0, 0x6
b _081C951A
.pool
_081C9508:
ldrh r1, [r5, 0x2E]
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _081C9516
movs r0, 0
b _081C951A
_081C9516:
movs r0, 0x1
negs r0, r0
_081C951A:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81C943C
thumb_func_start sub_81C9520
sub_81C9520: @ 81C9520
push {r4,lr}
adds r4, r0, 0
bl sub_81C9814
cmp r0, 0
beq _081C9530
movs r0, 0x1
b _081C9580
_081C9530:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _081C9570
ldr r3, =gUnknown_0861FC59
movs r0, 0x2
ldrsh r1, [r4, r0]
ldrh r2, [r4]
lsls r0, r2, 1
adds r0, r2
lsls r0, 1
adds r1, r0
adds r1, r3
ldrb r0, [r1]
cmp r0, 0x2
bne _081C9578
movs r0, 0x6
strh r0, [r4, 0x6]
ldr r1, =0x000186ab
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x8
b _081C9580
.pool
_081C9570:
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _081C957E
_081C9578:
movs r0, 0x20
bl PlaySE
_081C957E:
movs r0, 0
_081C9580:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C9520
thumb_func_start c2_pre_battle_1
c2_pre_battle_1: @ 81C9588
push {r4,lr}
adds r4, r0, 0
bl sub_81C9814
cmp r0, 0
beq _081C9598
movs r0, 0x1
b _081C95F8
_081C9598:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _081C95E8
ldr r3, =gUnknown_0861FC59
movs r0, 0x2
ldrsh r1, [r4, r0]
ldrh r2, [r4]
lsls r0, r2, 1
adds r0, r2
lsls r0, 1
adds r1, r0
adds r1, r3
ldrb r0, [r1]
cmp r0, 0x2
beq _081C95D4
cmp r0, 0x4
beq _081C95F4
movs r0, 0x20
bl PlaySE
movs r0, 0
b _081C95F8
.pool
_081C95D4:
movs r0, 0x6
strh r0, [r4, 0x6]
ldr r1, =0x000186ab
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x8
b _081C95F8
.pool
_081C95E8:
movs r0, 0x2
ands r0, r1
cmp r0, 0
bne _081C95F4
movs r0, 0
b _081C95F8
_081C95F4:
movs r0, 0x1
negs r0, r0
_081C95F8:
pop {r4}
pop {r1}
bx r1
thumb_func_end c2_pre_battle_1
thumb_func_start sub_81C9600
sub_81C9600: @ 81C9600
push {r4,lr}
adds r4, r0, 0
bl sub_81C9814
cmp r0, 0
beq _081C9616
bl sub_81C93EC
str r0, [r4, 0xC]
movs r0, 0x1
b _081C9634
_081C9616:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x3
ands r0, r1
cmp r0, 0
bne _081C962C
movs r0, 0
b _081C9634
.pool
_081C962C:
bl sub_81C93EC
str r0, [r4, 0xC]
movs r0, 0x7
_081C9634:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C9600
thumb_func_start sub_81C963C
sub_81C963C: @ 81C963C
push {r4-r6,lr}
adds r4, r0, 0
bl sub_81C9814
adds r3, r0, 0
cmp r3, 0
beq _081C964E
movs r0, 0x1
b _081C96F6
_081C964E:
ldr r2, =gMain
ldrh r1, [r2, 0x2E]
movs r0, 0x1
ands r0, r1
adds r6, r2, 0
cmp r0, 0
beq _081C96B8
ldr r5, =gUnknown_0861FC59
movs r1, 0x2
ldrsh r0, [r4, r1]
ldrh r2, [r4]
lsls r1, r2, 1
adds r1, r2
lsls r1, 1
adds r0, r1
adds r0, r5
ldrb r0, [r0]
cmp r0, 0x6
beq _081C968E
cmp r0, 0x6
bgt _081C9688
cmp r0, 0x5
beq _081C96A4
b _081C96B8
.pool
_081C9688:
cmp r0, 0x7
beq _081C96E4
b _081C96B8
_081C968E:
movs r0, 0x4
strh r0, [r4]
strh r3, [r4, 0x2]
ldrb r0, [r5, 0x18]
strh r0, [r4, 0x4]
ldr r0, =sub_81C96FC
str r0, [r4, 0xC]
movs r0, 0x4
b _081C96F6
.pool
_081C96A4:
strh r3, [r4, 0x6]
ldr r1, =0x000186a7
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x8
b _081C96F6
.pool
_081C96B8:
ldrh r1, [r6, 0x2E]
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _081C96F4
movs r0, 0x2
ldrsh r2, [r4, r0]
ldr r1, =gUnknown_0861FC54
ldrh r0, [r4]
adds r0, r1
ldrb r0, [r0]
cmp r2, r0
beq _081C96E4
strh r0, [r4, 0x2]
ldr r0, =sub_81C9798
str r0, [r4, 0xC]
movs r0, 0x1
b _081C96F6
.pool
_081C96E4:
movs r0, 0x5
bl PlaySE
adds r0, r4, 0
bl sub_81C97C0
movs r0, 0x3
b _081C96F6
_081C96F4:
movs r0, 0
_081C96F6:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_81C963C
thumb_func_start sub_81C96FC
sub_81C96FC: @ 81C96FC
push {r4,lr}
adds r4, r0, 0
bl sub_81C9814
cmp r0, 0
beq _081C970C
movs r0, 0x1
b _081C9792
_081C970C:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _081C9754
ldr r3, =gUnknown_0861FC59
movs r0, 0x2
ldrsh r1, [r4, r0]
ldrh r2, [r4]
lsls r0, r2, 1
adds r0, r2
lsls r0, 1
adds r1, r0
adds r1, r3
ldrb r0, [r1]
cmp r0, 0xD
beq _081C9780
subs r0, 0x8
bl sub_81C7694
ldr r1, =0x000186a8
adds r0, r4, 0
bl sub_81C97B0
movs r0, 0x3
strh r0, [r4, 0x6]
movs r0, 0x8
b _081C9792
.pool
_081C9754:
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _081C9790
movs r0, 0x2
ldrsh r2, [r4, r0]
ldr r1, =gUnknown_0861FC54
ldrh r0, [r4]
adds r0, r1
ldrb r0, [r0]
cmp r2, r0
beq _081C9780
strh r0, [r4, 0x2]
ldr r0, =sub_81C97A4
str r0, [r4, 0xC]
movs r0, 0x1
b _081C9792
.pool
_081C9780:
movs r0, 0x5
bl PlaySE
adds r0, r4, 0
bl sub_81C97F8
movs r0, 0x5
b _081C9792
_081C9790:
movs r0, 0
_081C9792:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_81C96FC
thumb_func_start sub_81C9798
sub_81C9798: @ 81C9798
push {lr}
bl sub_81C97C0
movs r0, 0x3
pop {r1}
bx r1
thumb_func_end sub_81C9798
thumb_func_start sub_81C97A4
sub_81C97A4: @ 81C97A4
push {lr}
bl sub_81C97F8
movs r0, 0x5
pop {r1}
bx r1
thumb_func_end sub_81C97A4
thumb_func_start sub_81C97B0
sub_81C97B0: @ 81C97B0
str r1, [r0, 0x8]
ldr r1, =sub_81C97BC
str r1, [r0, 0xC]
bx lr
.pool
thumb_func_end sub_81C97B0
thumb_func_start sub_81C97BC
sub_81C97BC: @ 81C97BC
ldr r0, [r0, 0x8]
bx lr
thumb_func_end sub_81C97BC
thumb_func_start sub_81C97C0
sub_81C97C0: @ 81C97C0
push {r4,lr}
adds r4, r0, 0
bl sub_81C9268
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
movs r0, 0x1
strh r0, [r4, 0x2]
ldr r2, =gUnknown_0861FC59
ldrh r1, [r4]
lsls r0, r1, 1
adds r0, r1
lsls r0, 1
adds r0, 0x1
adds r0, r2
ldrb r0, [r0]
strh r0, [r4, 0x4]
ldr r0, =sub_81C943C
str r0, [r4, 0xC]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81C97C0
thumb_func_start sub_81C97F8
sub_81C97F8: @ 81C97F8
movs r1, 0x3
strh r1, [r0]
movs r1, 0x1
strh r1, [r0, 0x2]
ldr r1, =gUnknown_0861FC59
ldrb r1, [r1, 0x13]
strh r1, [r0, 0x4]
ldr r1, =sub_81C963C
str r1, [r0, 0xC]
bx lr
.pool
thumb_func_end sub_81C97F8
thumb_func_start sub_81C9814
sub_81C9814: @ 81C9814
push {r4,r5,lr}
adds r4, r0, 0
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x40
ands r0, r1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0
beq _081C9848
ldrh r0, [r4, 0x2]
subs r0, 0x1
strh r0, [r4, 0x2]
lsls r0, 16
ldrh r3, [r4]
cmp r0, 0
bge _081C986A
ldr r0, =gUnknown_0861FC54
adds r0, r3, r0
ldrb r0, [r0]
strh r0, [r4, 0x2]
b _081C986A
.pool
_081C9848:
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _081C988C
ldrh r0, [r4, 0x2]
adds r0, 0x1
strh r0, [r4, 0x2]
movs r0, 0x2
ldrsh r2, [r4, r0]
ldr r0, =gUnknown_0861FC54
ldrh r1, [r4]
adds r0, r1, r0
adds r3, r1, 0
ldrb r0, [r0]
cmp r2, r0
ble _081C986A
strh r5, [r4, 0x2]
_081C986A:
ldr r2, =gUnknown_0861FC59
movs r0, 0x2
ldrsh r1, [r4, r0]
lsls r0, r3, 1
adds r0, r3
lsls r0, 1
adds r1, r0
adds r1, r2
ldrb r0, [r1]
strh r0, [r4, 0x4]
movs r0, 0x1
b _081C988E
.pool
_081C988C:
movs r0, 0
_081C988E:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81C9814
thumb_func_start sub_81C9894
sub_81C9894: @ 81C9894
push {lr}
movs r0, 0x1
bl GetSubstructPtr
ldrh r0, [r0]
pop {r1}
bx r1
thumb_func_end sub_81C9894
thumb_func_start sub_81C98A4
sub_81C98A4: @ 81C98A4
push {lr}
movs r0, 0x1
bl GetSubstructPtr
movs r1, 0x2
ldrsh r0, [r0, r1]
pop {r1}
bx r1
thumb_func_end sub_81C98A4
thumb_func_start sub_81C98B4
sub_81C98B4: @ 81C98B4
push {lr}
movs r0, 0x1
bl GetSubstructPtr
ldrh r0, [r0, 0x4]
pop {r1}
bx r1
thumb_func_end sub_81C98B4
thumb_func_start sub_81C98C4
sub_81C98C4: @ 81C98C4
push {lr}
movs r0, 0x1
bl GetSubstructPtr
ldrh r0, [r0, 0x6]
pop {r1}
bx r1
thumb_func_end sub_81C98C4
.align 2, 0 @ Don't pad with nop.

File diff suppressed because it is too large Load Diff

View File

@ -1506,7 +1506,7 @@ sub_81CBE50: @ 81CBE50
movs r0, 0x9
bl GetGameStat
adds r1, r0, 0
ldr r0, =0x0001869f @ Note to decompiler: See UNKNOWN_OFFSET
ldr r0, =0x0001869f
cmp r1, r0
ble _081CBE68
adds r1, r0, 0

View File

@ -10331,15 +10331,15 @@ General_SubstituteAppear:
General_PokeblockThrow:
createvisualtask sub_817345C, 2, 0
createvisualtask sub_81732B0, 2
createvisualtask AnimTask_LoadPokeblockGfx, 2
delay 0
waitplaysewithpan SE_W026, SOUND_PAN_ATTACKER, 22
createsprite gBattleAnimSpriteTemplate_85E5338, ANIM_TARGET, 3, -18, 12, 0, 32
createsprite gPokeblockSpriteTemplate, ANIM_TARGET, 3, -18, 12, 0, 32
delay 50
loopsewithpan SE_W039, SOUND_PAN_TARGET, 19, 2
createvisualtask AnimTask_SwayMon, 5, 1, 8, 1536, 2, ANIM_TARGET
waitforvisualfinish
createvisualtask sub_81732E4, 2
createvisualtask AnimTask_FreePokeblockGfx, 2
end
General_ItemKnockoff:
@ -10516,7 +10516,7 @@ General_Hail:
goto Move_HAIL
General_LeechSeedDrain:
createvisualtask sub_817351C, 5
createvisualtask AnimTask_GetBattlersFromArg, 5
delay 0
goto Move_ABSORB
@ -10535,7 +10535,7 @@ General_MonHit:
General_ItemSteal:
loadspritegfx ANIM_TAG_ITEM_BAG
createvisualtask sub_8117F30, 2
createvisualtask sub_8172ED0, 2
createvisualtask AnimTask_TargetToEffectBattler, 2
delay 1
createsprite gItemStealSpriteTemplate, ANIM_ATTACKER, 2, 0, -5, 10, 2, -1
end
@ -10664,8 +10664,8 @@ General_WishHeal:
end
AnimScript_82D85A3:
createvisualtask sub_8172E9C, 2
jumpreteq 1, AnimScript_82D85B4
createvisualtask AnimTask_IsAttackerBehindSubstitute, 2
jumprettrue AnimScript_82D85B4
AnimScript_82D85B2:
waitforvisualfinish
return
@ -10675,8 +10675,8 @@ AnimScript_82D85B4:
goto AnimScript_82D85B2
AnimScript_82D85C3:
createvisualtask sub_8172E9C, 2
jumpreteq 1, AnimScript_82D85D4
createvisualtask AnimTask_IsAttackerBehindSubstitute, 2
jumprettrue AnimScript_82D85D4
AnimScript_82D85D2:
waitforvisualfinish
return

View File

@ -3,17 +3,6 @@
.section .rodata
// pokenav_unk_1.s
gUnknown_0861FC54:: @ 861FC54
.byte 2
.byte 3
.byte 4
.byte 2
.byte 5
gUnknown_0861FC59:: @ 861FC59
.byte 0, 1, 4, 4, 4, 4, 0, 1, 2, 4, 4, 4, 0, 1, 2, 3, 4, 4, 5, 6, 7, 4, 4, 4, 8, 9, 10, 11, 12, 13, 0
// pokenav_unk_2.s
gUnknown_0861FC78:: @ 861FC78
.incbin "graphics/pokenav/bg.gbapal"

View File

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

View File

@ -34,12 +34,6 @@ enum
BERRY_STAGE_SPARKLING = 0xFF,
};
#define NUM_BERRIES 44
extern const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[];
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[];
extern const u8 *const gBerryTreePaletteSlotTablePointers[];
void ClearEnigmaBerries(void);
void SetEnigmaBerry(u8 *src);
bool32 IsEnigmaBerryValid(void);

View File

@ -276,7 +276,7 @@
#define ANIM_TAG_GREEN_SPIKE (ANIM_SPRITES_START + 266)
#define ANIM_TAG_WHITE_CIRCLE_OF_LIGHT (ANIM_SPRITES_START + 267)
#define ANIM_TAG_GLOWY_BLUE_ORB (ANIM_SPRITES_START + 268)
#define ANIM_TAG_RED_BRICK (ANIM_SPRITES_START + 269)
#define ANIM_TAG_POKEBLOCK (ANIM_SPRITES_START + 269)
#define ANIM_TAG_WHITE_FEATHER (ANIM_SPRITES_START + 270)
#define ANIM_TAG_SPARKLE_6 (ANIM_SPRITES_START + 271)
#define ANIM_TAG_SPLASH (ANIM_SPRITES_START + 272)

View File

@ -64,6 +64,10 @@ extern const struct OamData gEventObjectBaseOam_32x32;
extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
extern const u8 gReflectionEffectPaletteMap[];
extern const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[];
extern const struct SpriteFrameImage *const gBerryTreePicTablePointers[];
extern const u8 *const gBerryTreePaletteSlotTablePointers[];
void ResetEventObjects(void);
u8 GetMoveDirectionAnimNum(u8);
u8 GetEventObjectIdByLocalIdAndMap(u8, u8, u8);

View File

@ -18,6 +18,7 @@ extern const u8 EventScript_TryDoRematchBattle[];
extern const u8 SecretBase_EventScript_DollInteract[];
extern const u8 SecretBase_EventScript_CushionInteract[];
extern const u8 BerryTreeScript[];
extern const u8 gTVBravoTrainerText00[];
extern const u8 gTVBravoTrainerText01[];

View File

@ -6096,7 +6096,7 @@ extern const u32 gBattleAnimSpriteGfx_IcicleSpear[];
extern const u32 gBattleAnimSpriteGfx_Hail[];
extern const u32 gBattleAnimSpriteGfx_GlowyRedOrb[];
extern const u32 gBattleAnimSpriteGfx_GreenSpike[];
extern const u32 gBattleAnimSpriteGfx_RedBrick[];
extern const u32 gBattleAnimSpriteGfx_Pokeblock[];
extern const u32 gBattleAnimSpriteGfx_WhiteFeather[];
extern const u32 gBattleAnimSpriteGfx_Sparkle6[];
extern const u32 gBattleAnimSpriteGfx_Splash[];
@ -6382,7 +6382,7 @@ extern const u32 gBattleAnimSpritePal_GlowyGreenOrb[];
extern const u32 gBattleAnimSpritePal_GreenSpike[];
extern const u32 gBattleAnimSpritePal_WhiteCircleOfLight[];
extern const u32 gBattleAnimSpritePal_GlowyBlueOrb[];
extern const u32 gBattleAnimSpritePal_RedBrick[];
extern const u32 gBattleAnimSpritePal_Pokeblock[];
extern const u32 gBattleAnimSpritePal_WhiteFeather[];
extern const u32 gBattleAnimSpritePal_Sparkle6[];
extern const u32 gBattleAnimSpritePal_Splash[];

View File

@ -14,7 +14,7 @@ int GetMaxWidthInMenuTable(const struct MenuAction *str, int arg1);
int sub_81DB3D8(const struct MenuAction *str, const u8* arg1, int arg2);
int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu);
void CopyMonCategoryText(int dexNum, u8 *dest);
u8 *sub_81DB494(u8 *str, int fontId, u8 *str2, int totalStringWidth);
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth);
void PadNameString(u8 *dest, u8 padChar);
void sub_81DB554(u8 *, u8);
void sub_81DB5AC(u8 *);

View File

@ -14,7 +14,8 @@ s32 GetRematchIdxByTrainerIdx(s32 trainerIdx);
void InitMatchCallCounters(void);
bool32 TryStartMatchCall(void);
bool32 IsMatchCallTaskActive(void);
void StartMatchCallFromScript(u8* script);
void StartMatchCallFromScript(u8 *message);
void sub_8197080(u8 *destStr);
bool32 SelectMatchCallMessage(int, u8 *);
#endif //GUARD_MATCH_CALL_H

View File

@ -4,6 +4,7 @@
#include "main.h"
void sub_802A9A8(u16 monId, MainCallback callback);
bool32 sub_802C908(u16 species);
#endif // GUARD_POKEMON_JUMP_H

View File

@ -1,7 +1,7 @@
#ifndef GUARD_POKENAV_H
#define GUARD_POKENAV_H
typedef u32 (*LoopedTask)(s32 state);
typedef u32 (*LoopedTask)(int state);
// Return values of LoopedTask functions.
#define LT_INC_AND_PAUSE 0
@ -11,8 +11,36 @@ typedef u32 (*LoopedTask)(s32 state);
#define LT_FINISH 4
#define LT_SET_STATE(newState) (newState + 5)
enum
{
POKENAV_MODE_NORMAL, // Chosen from Start menu.
POKENAV_MODE_FORCE_CALL_1, // Used for the script's special. Has to choose Match Call and make a call.
POKENAV_MODE_FORCE_CALL_2, // Set after making a call, has to exit Pokenav.
};
#define POKENAV_MENU_IDS_START 100000
enum
{
POKENAV_MENU_0 = POKENAV_MENU_IDS_START,
POKENAV_MENU_1,
POKENAV_MENU_2,
POKENAV_MENU_3,
POKENAV_MENU_4,
POKENAV_MENU_5,
POKENAV_MENU_6,
POKENAV_MENU_7,
POKENAV_MENU_8,
POKENAV_MENU_9,
POKENAV_MENU_A,
POKENAV_MENU_B,
POKENAV_MENU_C,
POKENAV_MENU_D,
POKENAV_MENU_E,
};
// pokenav.c
extern u32 sub_81C99D4(void);
void sub_81C7694(u32);
u16 sub_81C76AC(void);
void CB2_InitPokeNav(void);
u32 CreateLoopedTask(LoopedTask loopedTask, u32 priority);
@ -22,7 +50,69 @@ void FreePokenavSubstruct(u32 index);
void *AllocSubstruct(u32 index, u32 size);
void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes);
bool32 IsLoopedTaskActive(u32 taskId);
void SetPokenavMode(u16 mode);
u32 GetPokenavMode(void);
bool32 CanViewRibbonsMenu(void);
// pokenav_match_call_ui.c
u32 GetSelectedMatchCall(void);
// pokenav_match_call_data.c
bool32 sub_81D17E8(u32 idx);
u8 sub_81D16DC(u32 idx);
bool32 sub_81D1BF8(u32 idx);
bool32 MatchCallFlagGetByIndex(u32 idx);
u32 MatchCall_GetRematchTableIdx(u32 idx);
u32 GetTrainerIdxByRematchIdx(u32 rematchIdx);
int sub_81D1BD0(u32 idx);
void MatchCall_GetMessage(u32 idx, u8 *dest);
const u8 *sub_81D1B40(u32 idx, u32 offset);
void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name);
// pokenav_main_menu.c
bool32 InitPokenavMainMenu(void);
void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size);
void sub_81C7850(u32 a0);
u32 sub_81C786C(void);
// pokenav_unk_1.c
bool32 sub_81C9298(void);
bool32 sub_81C92CC(void);
bool32 sub_81C9304(void);
bool32 sub_81C9338(void);
bool32 sub_81C9368(void);
u32 sub_81C941C(void);
void sub_81C9430(void);
int sub_81C9894(void);
const u8 *sub_81CAF78(int index, u8 *arg1);
// pokenav_unk_2.c
u32 sub_81C99D4(void);
void sub_81CAADC(void);
// pokenav_unk_3.c
struct Pokenav3Struct_Unk1C
{
u8 unk0;
u8 unk1;
u16 unk2;
};
bool32 sub_81CAAE8(void);
u32 sub_81CAB24(void);
void sub_81CAB38(void);
int sub_81CAE28(void);
int sub_81CAE38(void);
int sub_81CAE48(void);
struct Pokenav3Struct_Unk1C *sub_81CAE94(void);
u16 sub_81CAEA4(int);
bool32 sub_81CAEBC(int index);
int sub_81CAF04(int index);
const u8 *sub_81CAFD8(int index, int textType);
u16 sub_81CB01C(void);
u16 sub_81CB02C(int arg0);
void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str);
int sub_81CB0C8(int rematchIndex);
int sub_81CB0E4(int index);
bool32 sub_81CAE08(int);
#endif //GUARD_POKENAV_H

View File

@ -2708,4 +2708,7 @@ extern const u8 gText_Symbols[];
extern const u8 gText_Register2[];
extern const u8 gText_Exit2[];
// Pokenav Match Call
extern const u8 gText_CallCantBeMadeHere[];
#endif // GUARD_STRINGS_H

View File

@ -162,7 +162,6 @@ extern u8 gUnknown_02022C3E;
// Exported ROM declarations
u8 sub_8013F78(void);
bool32 sub_802C908(u16);
void nullsub_89(u8 taskId);
void var_800D_set_xB(void);
void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0);

View File

@ -303,9 +303,9 @@ SECTIONS {
src/pokenav.o(.text);
src/pokenav_main_menu.o(.text);
src/pokenav_match_call_ui.o(.text);
asm/pokenav_unk_1.o(.text);
src/pokenav_unk_1.o(.text);
asm/pokenav_unk_2.o(.text);
asm/pokenav_unk_3.o(.text);
src/pokenav_unk_3.o(.text);
asm/pokenav_unk_4.o(.text);
asm/pokenav_unk_5.o(.text);
asm/pokenav_unk_6.o(.text);
@ -632,6 +632,7 @@ SECTIONS {
src/pokenav.o(.rodata);
src/pokenav_main_menu.o(.rodata);
src/pokenav_match_call_ui.o(.rodata);
src/pokenav_unk_1.o(.rodata);
data/pokenav.o(.rodata);
src/pokenav_match_call_data.o(.rodata);
src/menu_specialized.o(.rodata);

View File

@ -1394,7 +1394,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_GreenSpike, 0x0080, ANIM_TAG_GREEN_SPIKE},
{gBattleAnimSpriteGfx_CircleOfLight, 0x0800, ANIM_TAG_WHITE_CIRCLE_OF_LIGHT},
{gBattleAnimSpriteGfx_GlowyRedOrb, 0x0020, ANIM_TAG_GLOWY_BLUE_ORB},
{gBattleAnimSpriteGfx_RedBrick, 0x0080, ANIM_TAG_RED_BRICK},
{gBattleAnimSpriteGfx_Pokeblock, 0x0080, ANIM_TAG_POKEBLOCK},
{gBattleAnimSpriteGfx_WhiteFeather, 0x0400, ANIM_TAG_WHITE_FEATHER},
{gBattleAnimSpriteGfx_Sparkle6, 0x0080, ANIM_TAG_SPARKLE_6},
{gBattleAnimSpriteGfx_Splash, 0x0800, ANIM_TAG_SPLASH},
@ -1687,7 +1687,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_GreenSpike, ANIM_TAG_GREEN_SPIKE},
{gBattleAnimSpritePal_WhiteCircleOfLight, ANIM_TAG_WHITE_CIRCLE_OF_LIGHT},
{gBattleAnimSpritePal_GlowyBlueOrb, ANIM_TAG_GLOWY_BLUE_ORB},
{gBattleAnimSpritePal_RedBrick, ANIM_TAG_RED_BRICK},
{gBattleAnimSpritePal_Pokeblock, ANIM_TAG_POKEBLOCK},
{gBattleAnimSpritePal_WhiteFeather, ANIM_TAG_WHITE_FEATHER},
{gBattleAnimSpritePal_Sparkle6, ANIM_TAG_SPARKLE_6},
{gBattleAnimSpritePal_Splash, ANIM_TAG_SPLASH},

View File

@ -1734,90 +1734,25 @@ void sub_8103FE8(struct Sprite *sprite)
sprite->callback = sub_8104018;
}
#ifdef NONMATCHING
static void sub_8104018(struct Sprite *sprite)
{
u16 r7;
u16 r5;
u16 id, val;
int i;
if (++sprite->data[1] == 2)
{
sprite->data[1] = 0;
r5 = sprite->data[0];
r7 = gPlttBufferFaded[8 + r5];
for (i = 0; i < 8; i++)
{
gPlttBufferFaded[i + r5 + 8] = gPlttBufferFaded[i + r5 + 9];
}
gPlttBufferFaded[r5 + 15] = r7;
id = sprite->data[0];
val = gPlttBufferFaded[8 + id];
for (i = 8; i < 16; i++)
gPlttBufferFaded[i + id] = gPlttBufferFaded[i + id + 1];
gPlttBufferFaded[id + 15] = val;
if (++sprite->data[2] == 24)
DestroyAnimSprite(sprite);
}
}
#else
NAKED
static void sub_8104018(struct Sprite *sprite)
{
asm(".syntax unified\n\
push {r4-r7,lr}\n\
adds r4, r0, 0\n\
ldrh r0, [r4, 0x30]\n\
adds r0, 0x1\n\
strh r0, [r4, 0x30]\n\
lsls r0, 16\n\
asrs r0, 16\n\
cmp r0, 0x2\n\
bne _0810407C\n\
movs r0, 0\n\
strh r0, [r4, 0x30]\n\
ldrh r5, [r4, 0x2E]\n\
ldr r1, =gPlttBufferFaded\n\
adds r0, r5, 0\n\
adds r0, 0x8\n\
lsls r0, 1\n\
adds r0, r1 \n\
ldrh r7, [r0]\n\
adds r6, r1, 0\n\
adds r1, r5, 0\n\
adds r1, 0x9\n\
lsls r0, r5, 1\n\
adds r0, r6\n\
adds r2, r0, 0\n\
adds r2, 0x10\n\
movs r3, 0x7\n\
lsls r1, 1\n\
adds r1, r6\n\
_08104050:\n\
ldrh r0, [r1]\n\
strh r0, [r2]\n\
adds r1, 0x2\n\
adds r2, 0x2\n\
subs r3, 0x1\n\
cmp r3, 0\n\
bge _08104050\n\
adds r0, r5, 0\n\
adds r0, 0xF\n\
lsls r0, 1\n\
adds r0, r6\n\
strh r7, [r0]\n\
ldrh r0, [r4, 0x32]\n\
adds r0, 0x1\n\
strh r0, [r4, 0x32]\n\
lsls r0, 16\n\
asrs r0, 16\n\
cmp r0, 0x18\n\
bne _0810407C\n\
adds r0, r4, 0\n\
bl DestroyAnimSprite\n\
_0810407C:\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided\n");
}
#endif
void sub_8104088(struct Sprite *sprite)
{

View File

@ -16,9 +16,10 @@
#include "task.h"
#include "trig.h"
#include "util.h"
#include "constants/rgb.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/rgb.h"
// iwram
int gUnknown_030062DC;
@ -103,39 +104,52 @@ static const struct BallCaptureSuccessStarData sBallCaptureSuccessStarData[] =
},
};
const struct CompressedSpriteSheet gBallOpenParticleSpritesheets[] =
#define TAG_PARTICLES_POKEBALL 55020
#define TAG_PARTICLES_GREATBALL 55021
#define TAG_PARTICLES_SAFARIBALL 55022
#define TAG_PARTICLES_ULTRABALL 55023
#define TAG_PARTICLES_MASTERBALL 55024
#define TAG_PARTICLES_NETBALL 55025
#define TAG_PARTICLES_DIVEBALL 55026
#define TAG_PARTICLES_NESTBALL 55027
#define TAG_PARTICLES_REPEATBALL 55028
#define TAG_PARTICLES_TIMERBALL 55029
#define TAG_PARTICLES_LUXURYBALL 55030
#define TAG_PARTICLES_PREMIERBALL 55031
const struct CompressedSpriteSheet gBallParticleSpritesheets[] =
{
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6EC},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6ED},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6EE},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6EF},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F0},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F1},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F2},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F3},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F4},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F5},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F6},
{gBattleAnimSpriteGfx_Particles, 0x100, 0xD6F7},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_POKEBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_GREATBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_SAFARIBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_ULTRABALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_MASTERBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_NETBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_DIVEBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_NESTBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_REPEATBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_TIMERBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_LUXURYBALL},
{gBattleAnimSpriteGfx_Particles, 0x100, TAG_PARTICLES_PREMIERBALL},
};
const struct CompressedSpritePalette gBallOpenParticlePalettes[] =
const struct CompressedSpritePalette gBallParticlePalettes[] =
{
{gBattleAnimSpritePal_CircleImpact, 0xD6EC},
{gBattleAnimSpritePal_CircleImpact, 0xD6ED},
{gBattleAnimSpritePal_CircleImpact, 0xD6EE},
{gBattleAnimSpritePal_CircleImpact, 0xD6EF},
{gBattleAnimSpritePal_CircleImpact, 0xD6F0},
{gBattleAnimSpritePal_CircleImpact, 0xD6F1},
{gBattleAnimSpritePal_CircleImpact, 0xD6F2},
{gBattleAnimSpritePal_CircleImpact, 0xD6F3},
{gBattleAnimSpritePal_CircleImpact, 0xD6F4},
{gBattleAnimSpritePal_CircleImpact, 0xD6F5},
{gBattleAnimSpritePal_CircleImpact, 0xD6F6},
{gBattleAnimSpritePal_CircleImpact, 0xD6F7},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_POKEBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_GREATBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_SAFARIBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_ULTRABALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_MASTERBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_NETBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_DIVEBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_NESTBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_REPEATBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_TIMERBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_LUXURYBALL},
{gBattleAnimSpritePal_CircleImpact, TAG_PARTICLES_PREMIERBALL},
};
const union AnimCmd gUnknown_085E5154[] =
const union AnimCmd gAnim_RegularBall[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_FRAME(1, 1),
@ -146,64 +160,64 @@ const union AnimCmd gUnknown_085E5154[] =
ANIMCMD_JUMP(0),
};
const union AnimCmd gUnknown_085E5170[] =
const union AnimCmd gAnim_MasterBall[] =
{
ANIMCMD_FRAME(3, 1),
ANIMCMD_END,
};
const union AnimCmd gUnknown_085E5178[] =
const union AnimCmd gAnim_NetDiveBall[] =
{
ANIMCMD_FRAME(4, 1),
ANIMCMD_END,
};
const union AnimCmd gUnknown_085E5180[] =
const union AnimCmd gAnim_NestBall[] =
{
ANIMCMD_FRAME(5, 1),
ANIMCMD_END,
};
const union AnimCmd gUnknown_085E5188[] =
const union AnimCmd gAnim_LuxuryPremierBall[] =
{
ANIMCMD_FRAME(6, 4),
ANIMCMD_FRAME(7, 4),
ANIMCMD_JUMP(0),
};
const union AnimCmd gUnknown_085E5194[] =
const union AnimCmd gAnim_UltraRepeatTimerBall[] =
{
ANIMCMD_FRAME(7, 4),
ANIMCMD_END,
};
const union AnimCmd *const gUnknown_085E519C[] =
const union AnimCmd *const gAnims_BallParticles[] =
{
gUnknown_085E5154,
gUnknown_085E5170,
gUnknown_085E5178,
gUnknown_085E5180,
gUnknown_085E5188,
gUnknown_085E5194,
gAnim_RegularBall,
gAnim_MasterBall,
gAnim_NetDiveBall,
gAnim_NestBall,
gAnim_LuxuryPremierBall,
gAnim_UltraRepeatTimerBall,
};
const u8 gBallOpenParticleAnimNums[] =
const u8 gBallParticleAnimNums[] =
{
0,
0,
0,
5,
1,
2,
2,
3,
5,
5,
4,
4,
[BALL_POKE] = 0,
[BALL_GREAT] = 0,
[BALL_SAFARI] = 0,
[BALL_ULTRA] = 5,
[BALL_MASTER] = 1,
[BALL_NET] = 2,
[BALL_DIVE] = 2,
[BALL_NEST] = 3,
[BALL_REPEAT] = 5,
[BALL_TIMER] = 5,
[BALL_LUXURY] = 4,
[BALL_PREMIER] = 4,
};
const TaskFunc gBallOpenParticleAnimationFuncs[] =
const TaskFunc gBallParticleAnimationFuncs[] =
{
PokeBallOpenParticleAnimation,
GreatBallOpenParticleAnimation,
@ -219,132 +233,134 @@ const TaskFunc gBallOpenParticleAnimationFuncs[] =
PremierBallOpenParticleAnimation,
};
const struct SpriteTemplate gUnknown_085E51F0[] =
const struct SpriteTemplate gBallParticlesSpriteTemplates[] =
{
{
.tileTag = 55020,
.paletteTag = 55020,
.tileTag = TAG_PARTICLES_POKEBALL,
.paletteTag = TAG_PARTICLES_POKEBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55021,
.paletteTag = 55021,
.tileTag = TAG_PARTICLES_GREATBALL,
.paletteTag = TAG_PARTICLES_GREATBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55022,
.paletteTag = 55022,
.tileTag = TAG_PARTICLES_SAFARIBALL,
.paletteTag = TAG_PARTICLES_SAFARIBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55023,
.paletteTag = 55023,
.tileTag = TAG_PARTICLES_ULTRABALL,
.paletteTag = TAG_PARTICLES_ULTRABALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55024,
.paletteTag = 55024,
.tileTag = TAG_PARTICLES_MASTERBALL,
.paletteTag = TAG_PARTICLES_MASTERBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55025,
.paletteTag = 55025,
.tileTag = TAG_PARTICLES_NETBALL,
.paletteTag = TAG_PARTICLES_NETBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55026,
.paletteTag = 55026,
.tileTag = TAG_PARTICLES_DIVEBALL,
.paletteTag = TAG_PARTICLES_DIVEBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55027,
.paletteTag = 55027,
.tileTag = TAG_PARTICLES_NESTBALL,
.paletteTag = TAG_PARTICLES_NESTBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55028,
.paletteTag = 55028,
.tileTag = TAG_PARTICLES_REPEATBALL,
.paletteTag = TAG_PARTICLES_REPEATBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55029,
.paletteTag = 55029,
.tileTag = TAG_PARTICLES_TIMERBALL,
.paletteTag = TAG_PARTICLES_TIMERBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55030,
.paletteTag = 55030,
.tileTag = TAG_PARTICLES_LUXURYBALL,
.paletteTag = TAG_PARTICLES_LUXURYBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
.tileTag = 55031,
.paletteTag = 55031,
.tileTag = TAG_PARTICLES_PREMIERBALL,
.paletteTag = TAG_PARTICLES_PREMIERBALL,
.oam = &gUnknown_08524904,
.anims = gUnknown_085E519C,
.anims = gAnims_BallParticles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
};
const u16 gUnknown_085E5310[] =
const u16 gBallOpenFadeColors[] =
{
RGB(31, 22, 30),
RGB(16, 23, 30),
RGB(23, 30, 20),
RGB(31, 31, 15),
RGB(23, 20, 28),
RGB(21, 31, 25),
RGB(12, 25, 30),
RGB(30, 27, 10),
RGB(31, 24, 16),
RGB(29, 30, 30),
RGB(31, 17, 10),
RGB(31, 9, 10),
[BALL_POKE] = RGB(31, 22, 30),
[BALL_GREAT] = RGB(16, 23, 30),
[BALL_SAFARI] = RGB(23, 30, 20),
[BALL_ULTRA] = RGB(31, 31, 15),
[BALL_MASTER] = RGB(23, 20, 28),
[BALL_NET] = RGB(21, 31, 25),
[BALL_DIVE] = RGB(12, 25, 30),
[BALL_NEST] = RGB(30, 27, 10),
[BALL_REPEAT] = RGB(31, 24, 16),
[BALL_TIMER] = RGB(29, 30, 30),
[BALL_LUXURY] = RGB(31, 17, 10),
[BALL_PREMIER] = RGB(31, 9, 10),
// Garbage data
RGB(0, 0, 0),
RGB(1, 16, 0),
RGB(3, 0, 1),
@ -355,10 +371,10 @@ const u16 gUnknown_085E5310[] =
RGB(4, 0, 0),
};
const struct SpriteTemplate gBattleAnimSpriteTemplate_85E5338 =
const struct SpriteTemplate gPokeblockSpriteTemplate =
{
.tileTag = ANIM_TAG_RED_BRICK,
.paletteTag = ANIM_TAG_RED_BRICK,
.tileTag = ANIM_TAG_POKEBLOCK,
.paletteTag = ANIM_TAG_POKEBLOCK,
.oam = &gUnknown_0852490C,
.anims = gDummySpriteAnimTable,
.images = NULL,
@ -675,9 +691,9 @@ void sub_8170D24(u8 taskId)
void AnimTask_IsBallBlockedByTrainer(u8 taskId)
{
if (gBattleSpritesDataPtr->animationData->ballThrowCaseId == BALL_TRAINER_BLOCK)
gBattleAnimArgs[7] = -1;
gBattleAnimArgs[ARG_RET_ID] = -1;
else
gBattleAnimArgs[7] = 0;
gBattleAnimArgs[ARG_RET_ID] = 0;
DestroyAnimVisualTask(taskId);
}
@ -687,30 +703,30 @@ u8 ItemIdToBallId(u16 ballItem)
switch (ballItem)
{
case ITEM_MASTER_BALL:
return 4;
return BALL_MASTER;
case ITEM_ULTRA_BALL:
return 3;
return BALL_ULTRA;
case ITEM_GREAT_BALL:
return 1;
return BALL_GREAT;
case ITEM_SAFARI_BALL:
return 2;
return BALL_SAFARI;
case ITEM_NET_BALL:
return 5;
return BALL_NET;
case ITEM_DIVE_BALL:
return 6;
return BALL_DIVE;
case ITEM_NEST_BALL:
return 7;
return BALL_NEST;
case ITEM_REPEAT_BALL:
return 8;
return BALL_REPEAT;
case ITEM_TIMER_BALL:
return 9;
return BALL_TIMER;
case ITEM_LUXURY_BALL:
return 10;
return BALL_LUXURY;
case ITEM_PREMIER_BALL:
return 11;
return BALL_PREMIER;
case ITEM_POKE_BALL:
default:
return 0;
return BALL_POKE;
}
}
@ -804,7 +820,6 @@ static void sub_8171134(struct Sprite *sprite)
{
int i;
u8 ballId;
int ballId2; // extra var needed to match
if (TranslateAnimHorizontalArc(sprite))
{
@ -825,15 +840,15 @@ static void sub_8171134(struct Sprite *sprite)
sprite->data[5] = 0;
sprite->callback = sub_81711E8;
ballId = ItemIdToBallId(gLastUsedItem);
ballId2 = ballId;
if (ballId2 > 11)
return;
if (ballId2 < 0)
return;
AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballId);
LaunchBallFadeMonTask(0, gBattleAnimTarget, 14, ballId);
ballId = ItemIdToBallId(gLastUsedItem);
switch (ballId)
{
case 0 ... POKEBALL_COUNT - 1:
AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballId);
LaunchBallFadeMonTask(0, gBattleAnimTarget, 14, ballId);
break;
}
}
}
}
@ -1259,7 +1274,7 @@ static void sub_81719EC(struct Sprite *sprite)
sub_8171D60(4);
for (i = 0; i < 3; i++)
{
u8 spriteId = CreateSprite(&gUnknown_085E51F0[4], sprite->pos1.x, sprite->pos1.y, subpriority);
u8 spriteId = CreateSprite(&gBallParticlesSpriteTemplates[4], sprite->pos1.x, sprite->pos1.y, subpriority);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = 24;
@ -1268,7 +1283,7 @@ static void sub_81719EC(struct Sprite *sprite)
gSprites[spriteId].data[5] = sBallCaptureSuccessStarData[i].unk2;
InitAnimArcTranslation(&gSprites[spriteId]);
gSprites[spriteId].callback = sub_8171AAC;
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[4]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[4]);
}
}
}
@ -1280,28 +1295,23 @@ static void sub_8171AAC(struct Sprite *sprite)
DestroySprite(sprite);
}
// fakematching. I think the return type of ItemIdToBallId()
// is wrong because of the weird required casting.
static void sub_8171AE4(struct Sprite *sprite)
{
u8 ballId;
int ballId2; // extra var needed to match
StartSpriteAnim(sprite, 1);
StartSpriteAffineAnim(sprite, 0);
sprite->callback = sub_8171BAC;
ballId = ItemIdToBallId(gLastUsedItem);
ballId2 = ballId;
if (ballId2 > 11)
goto LABEL;
if (ballId2 < 0)
goto LABEL;
switch (ballId)
{
case 0 ... POKEBALL_COUNT - 1:
AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballId);
LaunchBallFadeMonTask(1, gBattleAnimTarget, 14, ballId);
break;
}
AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 28, ballId);
LaunchBallFadeMonTask(1, gBattleAnimTarget, 14, ballId);
LABEL:
gSprites[gBattlerSpriteIds[gBattleAnimTarget]].invisible = 0;
StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]], 1);
AnimateSprite(&gSprites[gBattlerSpriteIds[gBattleAnimTarget]]);
@ -1374,10 +1384,10 @@ static void sub_8171D60(u8 ballId)
{
u8 taskId;
if (GetSpriteTileStartByTag(gBallOpenParticleSpritesheets[ballId].tag) == 0xFFFF)
if (GetSpriteTileStartByTag(gBallParticleSpritesheets[ballId].tag) == 0xFFFF)
{
LoadCompressedSpriteSheetUsingHeap(&gBallOpenParticleSpritesheets[ballId]);
LoadCompressedSpritePaletteUsingHeap(&gBallOpenParticlePalettes[ballId]);
LoadCompressedSpriteSheetUsingHeap(&gBallParticleSpritesheets[ballId]);
LoadCompressedSpritePaletteUsingHeap(&gBallParticlePalettes[ballId]);
}
}
@ -1386,7 +1396,7 @@ u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId)
u8 taskId;
sub_8171D60(ballId);
taskId = CreateTask(gBallOpenParticleAnimationFuncs[ballId], 5);
taskId = CreateTask(gBallParticleAnimationFuncs[ballId], 5);
gTasks[taskId].data[1] = x;
gTasks[taskId].data[2] = y;
gTasks[taskId].data[3] = priority;
@ -1419,11 +1429,11 @@ static void PokeBallOpenParticleAnimation(u8 taskId)
priority = gTasks[taskId].data[3];
subpriority = gTasks[taskId].data[4];
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = PokeBallOpenParticleAnimation_Step1;
gSprites[spriteId].oam.priority = priority;
@ -1478,11 +1488,11 @@ static void TimerBallOpenParticleAnimation(u8 taskId)
for (i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = FanOutBallOpenParticles_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 32;
@ -1512,11 +1522,11 @@ static void DiveBallOpenParticleAnimation(u8 taskId)
for (i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = FanOutBallOpenParticles_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 32;
@ -1547,11 +1557,11 @@ static void SafariBallOpenParticleAnimation(u8 taskId)
for (i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = FanOutBallOpenParticles_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 32;
@ -1582,11 +1592,11 @@ static void UltraBallOpenParticleAnimation(u8 taskId)
for (i = 0; i < 10; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = FanOutBallOpenParticles_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 25;
@ -1623,11 +1633,11 @@ static void GreatBallOpenParticleAnimation(u8 taskId)
for (i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = FanOutBallOpenParticles_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 32;
@ -1671,13 +1681,13 @@ static void RepeatBallOpenParticleAnimation(u8 taskId)
priority = gTasks[taskId].data[3];
subpriority = gTasks[taskId].data[4];
for (i = 0; i < 12; i++)
for (i = 0; i < POKEBALL_COUNT; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = RepeatBallOpenParticleAnimation_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 21;
@ -1717,11 +1727,11 @@ static void MasterBallOpenParticleAnimation(u8 taskId)
{
for (i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = FanOutBallOpenParticles_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 32;
@ -1761,11 +1771,11 @@ static void PremierBallOpenParticleAnimation(u8 taskId)
for (i = 0; i < 8; i++)
{
spriteId = CreateSprite(&gUnknown_085E51F0[ballId], x, y, subpriority);
spriteId = CreateSprite(&gBallParticlesSpriteTemplates[ballId], x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
sub_8171E20();
StartSpriteAnim(&gSprites[spriteId], gBallOpenParticleAnimNums[ballId]);
StartSpriteAnim(&gSprites[spriteId], gBallParticleAnimNums[ballId]);
gSprites[spriteId].callback = PremierBallOpenParticleAnimation_Step1;
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].data[0] = i * 32;
@ -1792,12 +1802,10 @@ static void PremierBallOpenParticleAnimation_Step1(struct Sprite *sprite)
static void DestroyBallOpenAnimationParticle(struct Sprite *sprite)
{
int i, j;
int temp;
if (!gMain.inBattle)
{
temp = sprite->data[7]; // temp var needed to match
if (temp == 1)
if (sprite->data[7] == 1)
DestroySpriteAndFreeResources(sprite);
else
DestroySprite(sprite);
@ -1807,18 +1815,18 @@ static void DestroyBallOpenAnimationParticle(struct Sprite *sprite)
gBattleSpritesDataPtr->animationData->field_A--;
if (gBattleSpritesDataPtr->animationData->field_A == 0)
{
for (i = 0; i < 12; i++)
for (i = 0; i < POKEBALL_COUNT; i++)
{
if (FuncIsActiveTask(gBallOpenParticleAnimationFuncs[i]) == TRUE)
if (FuncIsActiveTask(gBallParticleAnimationFuncs[i]) == TRUE)
break;
}
if (i == 12)
if (i == POKEBALL_COUNT)
{
for (j = 0; j < 12; j++)
for (j = 0; j < POKEBALL_COUNT; j++)
{
FreeSpriteTilesByTag(gBallOpenParticleSpritesheets[j].tag);
FreeSpritePaletteByTag(gBallOpenParticlePalettes[j].tag);
FreeSpriteTilesByTag(gBallParticleSpritesheets[j].tag);
FreeSpritePaletteByTag(gBallParticlePalettes[j].tag);
}
}
@ -1843,12 +1851,12 @@ u8 LaunchBallFadeMonTask(u8 unfadeLater, u8 battler, u32 selectedPalettes, u8 ba
if (!unfadeLater)
{
BlendPalette(battler * 16 + 0x100, 16, 0, gUnknown_085E5310[ballId]);
BlendPalette(battler * 16 + 0x100, 16, 0, gBallOpenFadeColors[ballId]);
gTasks[taskId].data[1] = 1;
}
else
{
BlendPalette(battler * 16 + 0x100, 16, 16, gUnknown_085E5310[ballId]);
BlendPalette(battler * 16 + 0x100, 16, 16, gBallOpenFadeColors[ballId]);
gTasks[taskId].data[0] = 16;
gTasks[taskId].data[1] = -1;
gTasks[taskId].func = sub_8172B40;
@ -1864,7 +1872,7 @@ static void sub_8172AB0(u8 taskId)
if (gTasks[taskId].data[2] <= 16)
{
BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gUnknown_085E5310[ballId]);
BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gBallOpenFadeColors[ballId]);
gTasks[taskId].data[0] += gTasks[taskId].data[1];
gTasks[taskId].data[2]++;
}
@ -1892,7 +1900,7 @@ static void sub_8172B90(u8 taskId)
if (gTasks[taskId].data[2] <= 16)
{
BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gUnknown_085E5310[ballId]);
BlendPalette(gTasks[taskId].data[3] * 16 + 0x100, 16, gTasks[taskId].data[0], gBallOpenFadeColors[ballId]);
gTasks[taskId].data[0] += gTasks[taskId].data[1];
gTasks[taskId].data[2]++;
}
@ -1906,9 +1914,8 @@ void sub_8172BF0(u8 taskId)
{
u8 spriteId;
u32 x;
u32 done;
u32 done = FALSE;
done = FALSE;
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
switch (gTasks[taskId].data[10])
{
@ -1942,8 +1949,7 @@ void sub_8172BF0(u8 taskId)
if (gSprites[spriteId].pos2.x <= 0)
{
gSprites[spriteId].pos2.x = 0;
// done = FALSE; // fakematching--can't get the tail merge correct
goto DONE;
done = TRUE;
}
}
else
@ -1956,10 +1962,8 @@ void sub_8172BF0(u8 taskId)
}
if (done)
{
DONE:
DestroyAnimVisualTask(taskId);
}
break;
}
}
@ -1998,13 +2002,13 @@ void sub_8172D98(u8 taskId)
}
}
void sub_8172E9C(u8 taskId)
void AnimTask_IsAttackerBehindSubstitute(u8 taskId)
{
gBattleAnimArgs[7] = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].behindSubstitute;
gBattleAnimArgs[ARG_RET_ID] = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].behindSubstitute;
DestroyAnimVisualTask(taskId);
}
void sub_8172ED0(u8 taskId)
void AnimTask_TargetToEffectBattler(u8 taskId)
{
gBattleAnimTarget = gEffectBattler;
DestroyAnimVisualTask(taskId);
@ -2030,10 +2034,10 @@ void sub_8172EF0(u8 battler, struct Pokemon *mon)
if (isShiny)
{
if (GetSpriteTileStartByTag(0x27F9) == 0xFFFF)
if (GetSpriteTileStartByTag(ANIM_TAG_GOLD_STARS) == 0xFFFF)
{
LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[233]);
LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[233]);
LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[ANIM_TAG_GOLD_STARS - ANIM_SPRITES_START]);
LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[ANIM_TAG_GOLD_STARS - ANIM_SPRITES_START]);
}
taskId1 = CreateTask(sub_8172FEC, 10);
@ -2103,7 +2107,7 @@ static void sub_8172FEC(u8 taskId)
if (gTasks[taskId].data[11] == 0)
{
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
pan = 192;
pan = -64;
else
pan = 63;
@ -2169,20 +2173,20 @@ static void sub_8173250(struct Sprite *sprite)
}
}
void sub_81732B0(u8 taskId)
void AnimTask_LoadPokeblockGfx(u8 taskId)
{
u8 paletteIndex;
LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[269]);
LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[269]);
paletteIndex = IndexOfSpritePaletteTag(0x281D); // unused
LoadCompressedSpriteSheetUsingHeap(&gBattleAnimPicTable[ANIM_TAG_POKEBLOCK - ANIM_SPRITES_START]);
LoadCompressedSpritePaletteUsingHeap(&gBattleAnimPaletteTable[ANIM_TAG_POKEBLOCK - ANIM_SPRITES_START]);
paletteIndex = IndexOfSpritePaletteTag(ANIM_TAG_POKEBLOCK); // unused
DestroyAnimVisualTask(taskId);
}
void sub_81732E4(u8 taskId)
void AnimTask_FreePokeblockGfx(u8 taskId)
{
FreeSpriteTilesByTag(0x281D);
FreeSpritePaletteByTag(0x281D);
FreeSpriteTilesByTag(ANIM_TAG_POKEBLOCK);
FreeSpritePaletteByTag(ANIM_TAG_POKEBLOCK);
DestroyAnimVisualTask(taskId);
}
@ -2245,21 +2249,21 @@ void sub_817345C(u8 taskId)
void AnimTask_GetTrappedMoveAnimId(u8 taskId)
{
if (gBattleSpritesDataPtr->animationData->animArg == 83)
gBattleAnimArgs[0] = 1;
else if (gBattleSpritesDataPtr->animationData->animArg == 250)
gBattleAnimArgs[0] = 2;
else if (gBattleSpritesDataPtr->animationData->animArg == 128)
gBattleAnimArgs[0] = 3;
else if (gBattleSpritesDataPtr->animationData->animArg == 328)
gBattleAnimArgs[0] = 4;
if (gBattleSpritesDataPtr->animationData->animArg == MOVE_FIRE_SPIN)
gBattleAnimArgs[0] = TRAP_ANIM_FIRE_SPIN;
else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_WHIRLPOOL)
gBattleAnimArgs[0] = TRAP_ANIM_WHIRLPOOL;
else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_CLAMP)
gBattleAnimArgs[0] = TRAP_ANIM_CLAMP;
else if (gBattleSpritesDataPtr->animationData->animArg == MOVE_SAND_TOMB)
gBattleAnimArgs[0] = TRAP_ANIM_SAND_TOMB;
else
gBattleAnimArgs[0] = 0;
gBattleAnimArgs[0] = TRAP_ANIM_BIND;
DestroyAnimVisualTask(taskId);
}
void sub_817351C(u8 taskId)
void AnimTask_GetBattlersFromArg(u8 taskId)
{
gBattleAnimAttacker = gBattleSpritesDataPtr->animationData->animArg;
gBattleAnimTarget = gBattleSpritesDataPtr->animationData->animArg >> 8;

View File

@ -1,6 +1,8 @@
#include "global.h"
#include "berry.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
#include "field_control_avatar.h"
#include "fieldmap.h"
#include "item.h"
@ -11,11 +13,6 @@
#include "text.h"
#include "constants/event_object_movement_constants.h"
#include "constants/items.h"
#include "event_object_movement.h"
extern const u8 BerryTreeScript[];
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry);
static bool32 BerryTreeGrow(struct BerryTree *tree);
@ -117,6 +114,7 @@ static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power o
const struct Berry gBerries[] =
{
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("CHERI"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -133,6 +131,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("CHESTO"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -149,6 +149,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PECHA"),
.firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -165,6 +167,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("RAWST"),
.firmness = BERRY_FIRMNESS_HARD,
@ -181,6 +185,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("ASPEAR"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -197,6 +203,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 25,
},
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LEPPA"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -213,6 +221,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("ORAN"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -229,6 +239,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PERSIM"),
.firmness = BERRY_FIRMNESS_HARD,
@ -245,6 +257,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LUM"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -261,6 +275,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("SITRUS"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -277,6 +293,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("FIGY"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -293,6 +311,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("WIKI"),
.firmness = BERRY_FIRMNESS_HARD,
@ -309,6 +329,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("MAGO"),
.firmness = BERRY_FIRMNESS_HARD,
@ -325,6 +347,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("AGUAV"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -341,6 +365,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 25,
},
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("IAPAPA"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -357,6 +383,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 25,
},
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("RAZZ"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -373,6 +401,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("BLUK"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -389,6 +419,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("NANAB"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -405,6 +437,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("WEPEAR"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -421,6 +455,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PINAP"),
.firmness = BERRY_FIRMNESS_HARD,
@ -437,6 +473,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("POMEG"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -453,6 +491,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("KELPSY"),
.firmness = BERRY_FIRMNESS_HARD,
@ -469,6 +509,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("QUALOT"),
.firmness = BERRY_FIRMNESS_HARD,
@ -485,6 +527,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("HONDEW"),
.firmness = BERRY_FIRMNESS_HARD,
@ -501,6 +545,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 20,
},
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("GREPA"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -517,6 +563,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 20,
},
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("TAMATO"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -533,6 +581,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 30,
},
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("CORNN"),
.firmness = BERRY_FIRMNESS_HARD,
@ -549,6 +599,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 30,
},
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("MAGOST"),
.firmness = BERRY_FIRMNESS_HARD,
@ -565,6 +617,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 30,
},
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("RABUTA"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -581,6 +635,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 30,
},
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("NOMEL"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -597,6 +653,8 @@ const struct Berry gBerries[] =
.sour = 20,
.smoothness = 30,
},
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("SPELON"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -613,6 +671,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 70,
},
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PAMTRE"),
.firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -629,6 +689,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 70,
},
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("WATMEL"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -645,6 +707,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 70,
},
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("DURIN"),
.firmness = BERRY_FIRMNESS_HARD,
@ -661,6 +725,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 70,
},
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("BELUE"),
.firmness = BERRY_FIRMNESS_VERY_SOFT,
@ -677,6 +743,8 @@ const struct Berry gBerries[] =
.sour = 40,
.smoothness = 70,
},
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LIECHI"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -693,6 +761,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 80,
},
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("GANLON"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -709,6 +779,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 80,
},
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("SALAC"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -725,6 +797,8 @@ const struct Berry gBerries[] =
.sour = 40,
.smoothness = 80,
},
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("PETAYA"),
.firmness = BERRY_FIRMNESS_VERY_HARD,
@ -741,6 +815,8 @@ const struct Berry gBerries[] =
.sour = 0,
.smoothness = 80,
},
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("APICOT"),
.firmness = BERRY_FIRMNESS_HARD,
@ -757,6 +833,8 @@ const struct Berry gBerries[] =
.sour = 40,
.smoothness = 80,
},
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("LANSAT"),
.firmness = BERRY_FIRMNESS_SOFT,
@ -773,6 +851,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 30,
},
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("STARF"),
.firmness = BERRY_FIRMNESS_SUPER_HARD,
@ -789,6 +869,8 @@ const struct Berry gBerries[] =
.sour = 10,
.smoothness = 30,
},
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] =
{
.name = _("ENIGMA"),
.firmness = BERRY_FIRMNESS_UNKNOWN,

View File

@ -121,7 +121,7 @@ static void sub_80F5F30(u8);
static void sub_80F5F74(u8);
static void sub_80F7144(void);
static void sub_80F68F0(u8);
s16 sub_80F6B78(const u8 *, u8);
s32 sub_80F6B78(const u8 *, u8);
static void sub_80F6E9C(s16, u16, u16, u16);
static void sub_80F6058(u8);
static void sub_80F7A80(u8, u8);
@ -919,39 +919,76 @@ static void sub_80F6AE8(void)
}
}
// s16 sub_80F6B78(const u8 *text, u8 spriteId)
// {
// int i;
// int origWidth, strWidth;
// const u8 *r8;
// u8 sp10[0x10];
// struct WindowTemplate windowTemplate;
// int spC;
// u8 *windowTileData;
// u8 windowId;
// Functionally equivalent, the same except compiler generated variables from
// src are placed on different stack positions.
// memset(windowTemplate, 0, sizeof(*windowTemplate));
// windowTemplate.width = 30;
// windowTemplate.height = 2;
// windowId = AddWindow(&windowTemplate);
// FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
// origWidth = GetStringWidth(1, text, 0) + 9;
// strWidth = origWidth;
// if (strWidth < 0)
// strWidth += 7;
#ifdef NONMATCHING
s32 sub_80F6B78(const u8 *text, u8 spriteId)
{
u8 *windowTilesPtr;
u16 windowId;
int origWidth;
struct WindowTemplate windowTemplate;
int strWidth;
u8 *spriteTilePtrs[4];
u8 *dst;
int i;
struct Sprite *sprite;
const u8 *src; // The culprit.
// strWidth >>= 3;
// if (strWidth > 30)
// strWidth = 30;
memset(&windowTemplate, 0, sizeof(windowTemplate));
windowTemplate.width = 30;
windowTemplate.height = 2;
windowId = AddWindow(&windowTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
// AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, gUnknown_0858D8E8, -1, text);
// windowTileData = (u8 *)GetWindowAttribute(windowId, WINDOW_TILE_DATA);
// r8 = gUnknown_0858D6D0;
// // ....
// }
origWidth = GetStringWidth(1, text, 0);
strWidth = (origWidth + 9) / 8;
if (strWidth > 30)
strWidth = 30;
AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, gUnknown_0858D8E8, -1, text);
windowTilesPtr = (u8 *)(GetWindowAttribute(windowId, WINDOW_TILE_DATA));
src = (u8 *)(gUnknown_0858D6D0);
sprite = &gSprites[spriteId];
spriteTilePtrs[0] = (u8 *)(sprite->oam.tileNum * 32 + VRAM + 0x10000);
for (i = 1; i < 4; i++)
spriteTilePtrs[i] = (void*)(gSprites[sprite->data[i - 1]].oam.tileNum * 32 + VRAM + 0x10000);
for (i = 0; i < 4; i++)
CpuFill32(0, spriteTilePtrs[i], 0x400);
dst = spriteTilePtrs[0];
CpuCopy32(src, dst, 0x20);
CpuCopy32(src + 128, dst + 0x100, 0x20);
CpuCopy32(src + 128, dst + 0x200, 0x20);
CpuCopy32(src + 64, dst + 0x300, 0x20);
for (i = 0; i < strWidth; i++)
{
dst = &spriteTilePtrs[(i + 1) / 8][((i + 1) % 8) * 32];
CpuCopy32(src + 192, dst, 0x20);
CpuCopy32(windowTilesPtr, dst + 0x100, 0x20);
CpuCopy32(windowTilesPtr + 960, dst + 0x200, 0x20);
CpuCopy32(src + 224, dst + 0x300, 0x20);
windowTilesPtr += 0x20;
}
dst = &spriteTilePtrs[(i + 1) / 8][((i + 1) % 8) * 32];
CpuCopy32(src + 32, dst, 0x20);
CpuCopy32(src + 160, dst + 0x100, 0x20);
CpuCopy32(src + 160, dst + 0x200, 0x20);
CpuCopy32(src + 96, dst + 0x300, 0x20);
RemoveWindow(windowId);
return (240 - (strWidth + 2) * 8) / 2;
}
#else
NAKED
s16 sub_80F6B78(const u8 *text, u8 spriteId)
s32 sub_80F6B78(const u8 *text, u8 spriteId)
{
asm_unified("\n\
push {r4-r7,lr}\n\
@ -1224,6 +1261,7 @@ _080F6D3E:\n\
bx r1\n\
.pool");
}
#endif // NONMATCHING
static void sub_80F6DC0(void)
{
@ -2358,38 +2396,32 @@ _080F7C96:\n\
bx r0");
}
#ifdef NONMATCHING
void sub_80F7CA8(u8 taskId)
{
register int r4 asm("r4");
int r9;
u8 r6;
s16 r7;
s16 r12;
int i;
u8 var0;
u16 tileNum;
bool32 r4 = FALSE;
bool32 endTask = FALSE;
u8 r6 = gTasks[taskId].data[0];
s16 r7 = gTasks[taskId].data[1];
s16 r12 = gTasks[taskId].data[2];
r4 = 0;
r9 = 0;
r6 = gTasks[taskId].data[0];
r7 = gTasks[taskId].data[1];
r12 = gTasks[taskId].data[2];
if (r12)
{
if (gUnknown_0203A034->unk0->unkC[r6] <= 0)
r4 = 1;
r4 = TRUE;
}
else
{
if (gUnknown_0203A034->unk0->unkC[r6] > 87)
r4 = 1;
r4 = TRUE;
}
if (gUnknown_0203A034->unk0->unkC[r6] == r7)
r9 = 1;
endTask = TRUE;
if (!r9)
if (!endTask)
{
if (r4)
gUnknown_0203A034->unk0->unkC[r6] = r7;
@ -2399,220 +2431,32 @@ void sub_80F7CA8(u8 taskId)
gUnknown_0203A034->unk0->unkC[r6] = gUnknown_0203A034->unk0->unkC[r6] + 1;
}
if (!r4 && !r9)
if (!r4 && !endTask)
{
for (i = 0; i < 11; i++)
{
if (gUnknown_0203A034->unk0->unkC[r6] >= (i + 1) * 8)
{
var0 = 8;
}
else if (gUnknown_0203A034->unk0->unkC[r6] >= i * 8)
{
int var2 = gUnknown_0203A034->unk0->unkC[r6];
int var1 = var2;
if (var1 < 0)
var1 += 7;
var0 = var2 - ((var1 >> 3) << 3);
}
var0 = gUnknown_0203A034->unk0->unkC[r6] % 8;
else
{
var0 = 0;
}
if (var0 < 4)
tileNum = 0x504C;
tileNum = 0x504C + var0;
else
tileNum = 0x5057;
tileNum = 0x5057 + var0;
FillBgTilemapBufferRect_Palette0(2, tileNum + var0, i + 7, r6 * 3 + 6, 1, 1);
FillBgTilemapBufferRect_Palette0(2, tileNum, i + 7, r6 * 3 + 6, 1, 1);
}
}
if (r9)
if (endTask)
{
gUnknown_0203A034->unk0->unk14--;
DestroyTask(taskId);
}
}
#else
NAKED
void sub_80F7CA8(u8 taskId)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r9\n\
mov r6, r8\n\
push {r6,r7}\n\
sub sp, 0x8\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
movs r4, 0\n\
mov r9, r4\n\
ldr r1, =gTasks\n\
lsls r0, 2\n\
add r0, r8\n\
lsls r0, 3\n\
adds r0, r1\n\
ldrb r6, [r0, 0x8]\n\
ldrh r7, [r0, 0xA]\n\
ldrh r1, [r0, 0xC]\n\
mov r12, r1\n\
movs r2, 0xC\n\
ldrsh r0, [r0, r2]\n\
cmp r0, 0\n\
beq _080F7CF8\n\
ldr r2, =gUnknown_0203A034\n\
ldr r0, [r2]\n\
ldr r0, [r0]\n\
lsls r1, r6, 1\n\
adds r0, 0xC\n\
adds r0, r1\n\
movs r3, 0\n\
ldrsh r0, [r0, r3]\n\
adds r5, r1, 0\n\
cmp r0, 0\n\
bgt _080F7D10\n\
b _080F7D0E\n\
.pool\n\
_080F7CF8:\n\
ldr r2, =gUnknown_0203A034\n\
ldr r0, [r2]\n\
ldr r0, [r0]\n\
lsls r1, r6, 1\n\
adds r0, 0xC\n\
adds r0, r1\n\
movs r3, 0\n\
ldrsh r0, [r0, r3]\n\
adds r5, r1, 0\n\
cmp r0, 0x57\n\
ble _080F7D10\n\
_080F7D0E:\n\
movs r4, 0x1\n\
_080F7D10:\n\
ldr r0, [r2]\n\
ldr r0, [r0]\n\
adds r0, 0xC\n\
adds r2, r0, r5\n\
ldrh r3, [r2]\n\
movs r0, 0\n\
ldrsh r1, [r2, r0]\n\
lsls r0, r7, 16\n\
asrs r0, 16\n\
cmp r1, r0\n\
bne _080F7D2A\n\
movs r1, 0x1\n\
mov r9, r1\n\
_080F7D2A:\n\
mov r0, r9\n\
cmp r0, 0\n\
bne _080F7D4A\n\
cmp r4, 0\n\
beq _080F7D3C\n\
strh r7, [r2]\n\
b _080F7D4A\n\
.pool\n\
_080F7D3C:\n\
mov r1, r12\n\
cmp r1, 0\n\
beq _080F7D46\n\
subs r0, r3, 0x1\n\
b _080F7D48\n\
_080F7D46:\n\
adds r0, r3, 0x1\n\
_080F7D48:\n\
strh r0, [r2]\n\
_080F7D4A:\n\
cmp r4, 0\n\
bne _080F7DC4\n\
mov r2, r9\n\
cmp r2, 0\n\
bne _080F7DCA\n\
movs r2, 0\n\
_080F7D56:\n\
ldr r0, =gUnknown_0203A034\n\
ldr r0, [r0]\n\
ldr r0, [r0]\n\
adds r0, 0xC\n\
adds r0, r5\n\
movs r1, 0\n\
ldrsh r3, [r0, r1]\n\
adds r0, r2, 0x1\n\
lsls r1, r0, 3\n\
adds r4, r0, 0\n\
cmp r3, r1\n\
blt _080F7D78\n\
movs r0, 0x8\n\
b _080F7D94\n\
.pool\n\
_080F7D78:\n\
lsls r0, r2, 3\n\
cmp r3, r0\n\
blt _080F7D92\n\
adds r0, r3, 0\n\
cmp r3, 0\n\
bge _080F7D86\n\
adds r0, r3, 0x7\n\
_080F7D86:\n\
asrs r0, 3\n\
lsls r0, 3\n\
subs r0, r3, r0\n\
lsls r0, 24\n\
lsrs r0, 24\n\
b _080F7D94\n\
_080F7D92:\n\
movs r0, 0\n\
_080F7D94:\n\
cmp r0, 0x3\n\
bhi _080F7DA0\n\
ldr r3, =0x0000504c\n\
b _080F7DA2\n\
.pool\n\
_080F7DA0:\n\
ldr r3, =0x00005057\n\
_080F7DA2:\n\
adds r1, r0, r3\n\
adds r2, 0x7\n\
lsls r2, 24\n\
lsrs r2, 24\n\
adds r3, r5, r6\n\
adds r3, 0x6\n\
lsls r3, 24\n\
movs r0, 0x1\n\
str r0, [sp]\n\
str r0, [sp, 0x4]\n\
movs r0, 0x2\n\
lsrs r3, 24\n\
bl FillBgTilemapBufferRect_Palette0\n\
adds r2, r4, 0\n\
cmp r2, 0xA\n\
ble _080F7D56\n\
_080F7DC4:\n\
mov r0, r9\n\
cmp r0, 0\n\
beq _080F7DDC\n\
_080F7DCA:\n\
ldr r0, =gUnknown_0203A034\n\
ldr r0, [r0]\n\
ldr r1, [r0]\n\
ldrb r0, [r1, 0x14]\n\
subs r0, 0x1\n\
strb r0, [r1, 0x14]\n\
mov r0, r8\n\
bl DestroyTask\n\
_080F7DDC:\n\
add sp, 0x8\n\
pop {r3,r4}\n\
mov r8, r3\n\
mov r9, r4\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif // NONMATCHING
static void sub_80F7DF4(void)
{
@ -2913,10 +2757,9 @@ static void sub_80F85A0(u8 taskId)
SetTaskFuncWithFollowupFunc(taskId, sub_80FC894, sub_80F85BC);
}
#ifdef NONMATCHING
static void sub_80F85BC(u8 taskId)
{
u32 i;
u8 i;
u8 sp0[4];
u8 sp4[4];
@ -2926,9 +2769,10 @@ static void sub_80F85BC(u8 taskId)
for (i = 0; i < gNumLinkContestPlayers; i++)
sp0[i] = gTasks[taskId].data[i + 1];
for (i = 0; i < gNumLinkContestPlayers; i++)
for (i = 0; i < gNumLinkContestPlayers;)
{
if (sp0[0] != sp0[i + 1])
i++;
if (i >= gNumLinkContestPlayers || sp0[0] != sp0[i])
break;
}
@ -2944,128 +2788,6 @@ static void sub_80F85BC(u8 taskId)
sub_80DB09C(gSpecialVar_ContestCategory);
SetTaskFuncWithFollowupFunc(taskId, sub_80FCF40, sub_80F86B8);
}
#else
NAKED
static void sub_80F85BC(u8 taskId)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r9\n\
mov r6, r8\n\
push {r6,r7}\n\
sub sp, 0x8\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
movs r0, 0\n\
str r0, [sp]\n\
str r0, [sp, 0x4]\n\
movs r3, 0\n\
ldr r5, =gNumLinkContestPlayers\n\
mov r12, r5\n\
ldr r0, =gSpecialVar_0x8004\n\
mov r9, r0\n\
add r1, sp, 0x4\n\
mov r8, r1\n\
ldrb r0, [r5]\n\
cmp r3, r0\n\
bcs _080F8606\n\
lsls r0, r6, 2\n\
adds r0, r6\n\
lsls r4, r0, 3\n\
ldr r7, =gTasks + 0x8\n\
_080F85EC:\n\
mov r1, sp\n\
adds r2, r1, r3\n\
adds r1, r3, 0x1\n\
lsls r0, r1, 1\n\
adds r0, r4\n\
adds r0, r7\n\
ldrh r0, [r0]\n\
strb r0, [r2]\n\
lsls r1, 24\n\
lsrs r3, r1, 24\n\
ldrb r0, [r5]\n\
cmp r3, r0\n\
bcc _080F85EC\n\
_080F8606:\n\
movs r3, 0\n\
mov r1, r12\n\
ldrb r0, [r1]\n\
cmp r3, r0\n\
bcs _080F862A\n\
adds r4, r0, 0\n\
mov r2, sp\n\
_080F8614:\n\
adds r0, r3, 0x1\n\
lsls r0, 24\n\
lsrs r3, r0, 24\n\
cmp r3, r4\n\
bcs _080F862A\n\
mov r0, sp\n\
adds r1, r0, r3\n\
ldrb r0, [r2]\n\
ldrb r1, [r1]\n\
cmp r0, r1\n\
beq _080F8614\n\
_080F862A:\n\
mov r1, r12\n\
ldrb r1, [r1]\n\
cmp r3, r1\n\
bne _080F8644\n\
movs r0, 0\n\
b _080F8646\n\
.pool\n\
_080F8644:\n\
movs r0, 0x1\n\
_080F8646:\n\
mov r1, r9\n\
strh r0, [r1]\n\
movs r3, 0\n\
mov r4, r12\n\
ldrb r0, [r4]\n\
cmp r3, r0\n\
bcs _080F8678\n\
mov r5, r8\n\
lsls r0, r6, 2\n\
adds r0, r6\n\
lsls r2, r0, 3\n\
ldr r7, =gTasks + 0x8\n\
_080F865E:\n\
adds r1, r5, r3\n\
adds r0, r3, 0x5\n\
lsls r0, 1\n\
adds r0, r2\n\
adds r0, r7\n\
ldrh r0, [r0]\n\
strb r0, [r1]\n\
adds r0, r3, 0x1\n\
lsls r0, 24\n\
lsrs r3, r0, 24\n\
ldrb r1, [r4]\n\
cmp r3, r1\n\
bcc _080F865E\n\
_080F8678:\n\
mov r0, r8\n\
bl sub_80F86E0\n\
ldr r1, =gUnknown_02039F2B\n\
strb r0, [r1]\n\
ldr r0, =gSpecialVar_ContestCategory\n\
ldrb r0, [r0]\n\
bl sub_80DB09C\n\
ldr r1, =sub_80FCF40\n\
ldr r2, =sub_80F86B8\n\
adds r0, r6, 0\n\
bl SetTaskFuncWithFollowupFunc\n\
add sp, 0x8\n\
pop {r3,r4}\n\
mov r8, r3\n\
mov r9, r4\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif // NONMATCHING
static void sub_80F86B8(u8 taskId)
{

View File

@ -423,142 +423,143 @@ const u8 gDeadBerryTreeEventObjectGraphicsIdTable[] = {EVENT_OBJ_GFX_BERRY_TREE_
const u8 gBerryTreeEventObjectGraphicsIdTable[] = {EVENT_OBJ_GFX_BERRY_TREE_EARLY_STAGES, EVENT_OBJ_GFX_BERRY_TREE_EARLY_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES, EVENT_OBJ_GFX_BERRY_TREE_LATE_STAGES};
const struct SpriteFrameImage *const gBerryTreePicTablePointers[] = {
gEventObjectPicTable_CheriBerryTree,
gEventObjectPicTable_ChestoBerryTree,
gEventObjectPicTable_PechaBerryTree,
gEventObjectPicTable_RawstBerryTree,
gEventObjectPicTable_AspearBerryTree,
gEventObjectPicTable_LeppaBerryTree,
gEventObjectPicTable_OranBerryTree,
gEventObjectPicTable_PersimBerryTree,
gEventObjectPicTable_LumBerryTree,
gEventObjectPicTable_SitrusBerryTree,
gEventObjectPicTable_FigyBerryTree,
gEventObjectPicTable_WikiBerryTree,
gEventObjectPicTable_MagoBerryTree,
gEventObjectPicTable_AguavBerryTree,
gEventObjectPicTable_IapapaBerryTree,
gEventObjectPicTable_RazzBerryTree,
gEventObjectPicTable_RazzBerryTree,
gEventObjectPicTable_MagoBerryTree,
gEventObjectPicTable_WepearBerryTree,
gEventObjectPicTable_IapapaBerryTree,
gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_KelpsyBerryTree,
gEventObjectPicTable_WepearBerryTree,
gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_GrepaBerryTree,
gEventObjectPicTable_TamatoBerryTree,
gEventObjectPicTable_CornnBerryTree,
gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_RabutaBerryTree,
gEventObjectPicTable_NomelBerryTree,
gEventObjectPicTable_SpelonBerryTree,
gEventObjectPicTable_PamtreBerryTree,
gEventObjectPicTable_RabutaBerryTree,
gEventObjectPicTable_DurinBerryTree,
gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_LiechiBerryTree,
gEventObjectPicTable_HondewBerryTree,
gEventObjectPicTable_AguavBerryTree,
gEventObjectPicTable_PomegBerryTree,
gEventObjectPicTable_GrepaBerryTree,
gEventObjectPicTable_LansatBerryTree,
gEventObjectPicTable_CornnBerryTree,
gEventObjectPicTable_DurinBerryTree,
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CheriBerryTree,
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_ChestoBerryTree,
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PechaBerryTree,
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RawstBerryTree,
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AspearBerryTree,
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LeppaBerryTree,
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_OranBerryTree,
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PersimBerryTree,
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LumBerryTree,
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_SitrusBerryTree,
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_FigyBerryTree,
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WikiBerryTree,
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_MagoBerryTree,
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AguavBerryTree,
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_IapapaBerryTree,
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RazzBerryTree,
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RazzBerryTree,
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_MagoBerryTree,
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WepearBerryTree,
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_IapapaBerryTree,
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_KelpsyBerryTree,
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_WepearBerryTree,
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_GrepaBerryTree,
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_TamatoBerryTree,
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CornnBerryTree,
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RabutaBerryTree,
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_NomelBerryTree,
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_SpelonBerryTree,
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PamtreBerryTree,
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_RabutaBerryTree,
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_DurinBerryTree,
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LiechiBerryTree,
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_HondewBerryTree,
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_AguavBerryTree,
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_PomegBerryTree,
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_GrepaBerryTree,
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_LansatBerryTree,
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_CornnBerryTree,
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gEventObjectPicTable_DurinBerryTree,
};
const u8 *const gBerryTreePaletteSlotTablePointers[] = {
gBerryTreePaletteSlotTable_Cheri,
gBerryTreePaletteSlotTable_Chesto,
gBerryTreePaletteSlotTable_Pecha,
gBerryTreePaletteSlotTable_Rawst,
gBerryTreePaletteSlotTable_Aspear,
gBerryTreePaletteSlotTable_Leppa,
gBerryTreePaletteSlotTable_Oran,
gBerryTreePaletteSlotTable_Persim,
gBerryTreePaletteSlotTable_Lum,
gBerryTreePaletteSlotTable_Sitrus,
gBerryTreePaletteSlotTable_Figy,
gBerryTreePaletteSlotTable_Wiki,
gBerryTreePaletteSlotTable_Mago,
gBerryTreePaletteSlotTable_Aguav,
gBerryTreePaletteSlotTable_Iapapa,
gBerryTreePaletteSlotTable_Razz,
gBerryTreePaletteSlotTable_Razz,
gBerryTreePaletteSlotTable_Mago,
gBerryTreePaletteSlotTable_Wepear,
gBerryTreePaletteSlotTable_Iapapa,
gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Kelpsy,
gBerryTreePaletteSlotTable_Wepear,
gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Grepa,
gBerryTreePaletteSlotTable_Tamato,
gBerryTreePaletteSlotTable_Cornn,
gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Rabuta,
gBerryTreePaletteSlotTable_Nomel,
gBerryTreePaletteSlotTable_Spelon,
gBerryTreePaletteSlotTable_Pamtre,
gBerryTreePaletteSlotTable_Rabuta,
gBerryTreePaletteSlotTable_Durin,
gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Liechi,
gBerryTreePaletteSlotTable_Hondew,
gBerryTreePaletteSlotTable_Aguav,
gBerryTreePaletteSlotTable_Pomeg,
gBerryTreePaletteSlotTable_Grepa,
gBerryTreePaletteSlotTable_Lansat,
gBerryTreePaletteSlotTable_Cornn,
gBerryTreePaletteSlotTable_Durin,
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cheri,
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Chesto,
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pecha,
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rawst,
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aspear,
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Leppa,
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Oran,
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Persim,
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Lum,
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Sitrus,
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Figy,
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wiki,
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Mago,
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aguav,
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Iapapa,
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Razz,
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Razz,
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Mago,
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wepear,
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Iapapa,
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Kelpsy,
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Wepear,
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Grepa,
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Tamato,
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cornn,
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rabuta,
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Nomel,
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Spelon,
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pamtre,
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Rabuta,
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Durin,
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Liechi,
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Hondew,
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Aguav,
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Pomeg,
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Grepa,
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Lansat,
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Cornn,
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreePaletteSlotTable_Durin,
};
const u8 *const gBerryTreeEventObjectGraphicsIdTablePointers[] = {
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
gBerryTreeEventObjectGraphicsIdTable,
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
// 3 unused berries.
[ITEM_0B0 - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_0B1 - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
[ITEM_0B2 - FIRST_BERRY_INDEX] = gBerryTreeEventObjectGraphicsIdTable,
};

View File

@ -25,6 +25,7 @@
#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/items.h"
// this file was known as evobjmv.c in Game Freak's original source
@ -2005,10 +2006,9 @@ static void get_berry_tree_graphics(struct EventObject *eventObject, struct Spri
sprite->invisible = FALSE;
berryId = GetBerryTypeByBerryTreeId(eventObject->trainerRange_berryTreeId) - 1;
berryStage--;
if (berryId >= NUM_BERRIES)
{
if (berryId > ITEM_TO_BERRY(LAST_BERRY_INDEX))
berryId = 0;
}
EventObjectSetGraphicsId(eventObject, gBerryTreeEventObjectGraphicsIdTablePointers[berryId][berryStage]);
sprite->images = gBerryTreePicTablePointers[berryId];
sprite->oam.paletteNum = gBerryTreePaletteSlotTablePointers[berryId][berryStage];

View File

@ -1034,8 +1034,8 @@ const u32 gBattleAnimSpritePal_Splash[] = INCBIN_U32("graphics/battle_anims/spri
const u32 gBattleAnimSpriteGfx_SweatBead[] = INCBIN_U32("graphics/battle_anims/sprites/sweat_bead.4bpp.lz");
const u32 gBattleAnimSpriteGfx_RedBrick[] = INCBIN_U32("graphics/battle_anims/sprites/red_brick.4bpp.lz");
const u32 gBattleAnimSpritePal_RedBrick[] = INCBIN_U32("graphics/battle_anims/sprites/red_brick.gbapal.lz");
const u32 gBattleAnimSpriteGfx_Pokeblock[] = INCBIN_U32("graphics/battle_anims/sprites/pokeblock.4bpp.lz");
const u32 gBattleAnimSpritePal_Pokeblock[] = INCBIN_U32("graphics/battle_anims/sprites/pokeblock.gbapal.lz");
const u32 gBattleAnimSpriteGfx_Gem1[] = INCBIN_U32("graphics/battle_anims/sprites/gem_1.4bpp.lz");
const u32 gBattleAnimSpriteGfx_Gem2[] = INCBIN_U32("graphics/battle_anims/sprites/gem_2.4bpp.lz");

508
src/ice.c
View File

@ -47,7 +47,7 @@ void AnimIceBallParticle(struct Sprite *);
void AnimTask_Haze2(u8);
void AnimTask_OverlayFogTiles(u8);
void AnimTask_Hail2(u8);
bool8 GenerateHailParticle(u8, u8, u8, u8);
bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c);
const union AnimCmd gUnknown_08595A48[] =
{
@ -522,37 +522,33 @@ const struct SpriteTemplate gUnknown_08595DFC =
.callback = InitIceBallParticle,
};
// probably unused
#ifdef NONMATCHING
static void sub_810B6C4(struct Sprite *sprite)
{
s16 targetX, targetY, attackerX, attackerY;
s16 i;
sprite->oam.tileNum += 7;
targetX = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
targetY = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
attackerY = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
targetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
targetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
attackerY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[1] = gBattleAnimArgs[0] + attackerX;
sprite->data[2] = gBattleAnimArgs[2] + targetX;
sprite->data[3] = gBattleAnimArgs[1] + attackerY;
sprite->data[4] = gBattleAnimArgs[3] + targetY;
sub_80A64EC(sprite);
while ((targetX >= -32 && targetX <= 272) && (targetY >= -32 && targetY <= 192))
{
targetX += sprite->data[1];
targetY += sprite->data[2];
}
for (;(targetX >= -32 && targetX <= 272) && (targetY >= -32 && targetY <= 192);
targetX += sprite->data[1], targetY += sprite->data[2])
;
sprite->data[1] = -sprite->data[1];
sprite->data[2] = -sprite->data[2];
while ((attackerX >= -32 && attackerX <= 272) && (attackerY >= -32 && attackerY <= 192))
{
attackerX += sprite->data[1];
attackerY += sprite->data[2];
}
for (;(attackerX >= -32 && attackerX <= 272) && (attackerY >= -32 && attackerY <= 192);
attackerX += sprite->data[1], attackerY += sprite->data[2])
;
sprite->pos1.x = attackerX;
sprite->pos1.y = attackerY;
sprite->data[0] = gBattleAnimArgs[4];
@ -565,195 +561,6 @@ static void sub_810B6C4(struct Sprite *sprite)
sprite->data[4] = gBattleAnimArgs[6];
sprite->callback = sub_810B848;
}
#else
NAKED
static void sub_810B6C4(struct Sprite *sprite)
{
asm_unified("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 r5, r0, 0\n\
ldrh r2, [r5, 0x4]\n\
lsls r1, r2, 22\n\
lsrs r1, 22\n\
adds r1, 0x7\n\
ldr r3, =0x000003ff\n\
adds r0, r3, 0\n\
ands r1, r0\n\
ldr r0, =0xfffffc00\n\
ands r0, r2\n\
orrs r0, r1\n\
strh r0, [r5, 0x4]\n\
ldr r4, =gBattleAnimTarget\n\
ldrb r0, [r4]\n\
movs r1, 0x2\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r9, r0\n\
ldrb r0, [r4]\n\
movs r1, 0x3\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
ldr r4, =gBattleAnimAttacker\n\
ldrb r0, [r4]\n\
movs r1, 0x2\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r3, r0, 24\n\
ldrb r0, [r4]\n\
movs r1, 0x3\n\
str r3, [sp]\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
ldr r1, =gBattleAnimArgs\n\
ldrh r0, [r1, 0x8]\n\
strh r0, [r5, 0x2E]\n\
ldrh r0, [r1]\n\
ldr r3, [sp]\n\
adds r0, r3\n\
strh r0, [r5, 0x30]\n\
ldrh r0, [r1, 0x4]\n\
mov r4, r9\n\
adds r0, r4, r0\n\
strh r0, [r5, 0x32]\n\
ldrh r0, [r1, 0x2]\n\
adds r0, r6\n\
strh r0, [r5, 0x34]\n\
ldrh r0, [r1, 0x6]\n\
mov r7, r8\n\
adds r0, r7, r0\n\
strh r0, [r5, 0x36]\n\
adds r0, r5, 0\n\
bl sub_80A64EC\n\
adds r4, 0x20\n\
movs r0, 0x98\n\
lsls r0, 1\n\
mov r12, r0\n\
ldr r3, [sp]\n\
cmp r4, r12\n\
bhi _0810B79E\n\
adds r0, r7, 0\n\
adds r0, 0x20\n\
ldrh r1, [r5, 0x30]\n\
ldrh r2, [r5, 0x32]\n\
cmp r0, 0xE0\n\
bhi _0810B79E\n\
adds r4, r1, 0\n\
mov r10, r12\n\
_0810B76A:\n\
mov r7, r9\n\
lsls r1, r7, 16\n\
asrs r1, 16\n\
adds r1, r4\n\
lsls r1, 16\n\
mov r7, r8\n\
lsls r0, r7, 16\n\
asrs r0, 16\n\
adds r0, r2\n\
lsls r0, 16\n\
lsrs r0, 16\n\
mov r8, r0\n\
lsrs r0, r1, 16\n\
mov r9, r0\n\
movs r7, 0x80\n\
lsls r7, 14\n\
adds r1, r7\n\
lsrs r1, 16\n\
cmp r1, r10\n\
bhi _0810B79E\n\
mov r1, r8\n\
lsls r0, r1, 16\n\
adds r0, r7\n\
lsrs r0, 16\n\
cmp r0, 0xE0\n\
bls _0810B76A\n\
_0810B79E:\n\
ldrh r0, [r5, 0x30]\n\
negs r7, r0\n\
strh r7, [r5, 0x30]\n\
ldrh r0, [r5, 0x32]\n\
negs r4, r0\n\
strh r4, [r5, 0x32]\n\
lsls r0, r3, 16\n\
movs r1, 0x80\n\
lsls r1, 14\n\
adds r0, r1\n\
lsrs r0, 16\n\
movs r2, 0x98\n\
lsls r2, 1\n\
mov r12, r2\n\
ldr r1, =gBattleAnimArgs\n\
mov r10, r1\n\
cmp r0, r12\n\
bhi _0810B80A\n\
lsls r1, r6, 16\n\
movs r2, 0x80\n\
lsls r2, 14\n\
adds r0, r1, r2\n\
b _0810B802\n\
.pool\n\
_0810B7E0:\n\
lsls r1, r3, 16\n\
asrs r1, 16\n\
adds r1, r7\n\
lsls r1, 16\n\
asrs r0, r2, 16\n\
adds r0, r4\n\
lsls r0, 16\n\
lsrs r6, r0, 16\n\
lsrs r3, r1, 16\n\
movs r0, 0x80\n\
lsls r0, 14\n\
adds r1, r0\n\
lsrs r1, 16\n\
cmp r1, r12\n\
bhi _0810B80A\n\
lsls r1, r6, 16\n\
adds r0, r1, r0\n\
_0810B802:\n\
lsrs r0, 16\n\
adds r2, r1, 0\n\
cmp r0, 0xE0\n\
bls _0810B7E0\n\
_0810B80A:\n\
strh r3, [r5, 0x20]\n\
strh r6, [r5, 0x22]\n\
mov r1, r10\n\
ldrh r0, [r1, 0x8]\n\
strh r0, [r5, 0x2E]\n\
strh r3, [r5, 0x30]\n\
mov r2, r9\n\
strh r2, [r5, 0x32]\n\
strh r6, [r5, 0x34]\n\
mov r3, r8\n\
strh r3, [r5, 0x36]\n\
adds r0, r5, 0\n\
bl sub_80A64EC\n\
mov r7, r10\n\
ldrh r0, [r7, 0xA]\n\
strh r0, [r5, 0x34]\n\
ldrh r0, [r7, 0xC]\n\
strh r0, [r5, 0x36]\n\
ldr r0, =sub_810B848\n\
str r0, [r5, 0x1C]\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\
.pool\n");
}
#endif
void sub_810B848(struct Sprite *sprite)
{
@ -797,14 +604,14 @@ void AnimIcePunchSwirlingParticle(struct Sprite *sprite)
void AnimIceBeamParticle(struct Sprite *sprite)
{
InitSpritePosToAnimAttacker(sprite, TRUE);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
sprite->data[2] -= gBattleAnimArgs[2];
else
sprite->data[2] += gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
sprite->data[0] = gBattleAnimArgs[4];
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->callback = StartAnimLinearTranslation;
@ -863,8 +670,8 @@ void AnimSwirlingSnowball_Step1(struct Sprite *sprite)
if (!gBattleAnimArgs[5])
{
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
}
else
{
@ -983,8 +790,8 @@ void AnimMoveParticleBeyondTarget(struct Sprite *sprite)
if (!gBattleAnimArgs[7])
{
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3);
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
}
else
{
@ -1274,8 +1081,8 @@ void AnimTask_Haze2(u8 taskId)
// arg 5: ??? unknown (seems to vibrate target mon somehow)
void AnimThrowMistBall(struct Sprite *sprite)
{
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = TranslateAnimSpriteToTargetMonLocation;
}
@ -1380,7 +1187,7 @@ void InitPoisonGasCloudAnim(struct Sprite *sprite)
{
sprite->data[0] = gBattleAnimArgs[0];
if (GetBattlerSpriteCoord(gBattleAnimAttacker, 2) < GetBattlerSpriteCoord(gBattleAnimTarget, 2))
if (GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) < GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2))
sprite->data[7] = 0x8000;
if (!(gBattlerPositions[gBattleAnimTarget] & 1))
@ -1394,22 +1201,22 @@ void InitPoisonGasCloudAnim(struct Sprite *sprite)
sprite->data[6] = 1;
}
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3);
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
if (gBattleAnimArgs[7])
{
sprite->data[1] = sprite->pos1.x + gBattleAnimArgs[1];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[3];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[3];
sprite->data[3] = sprite->pos1.y + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[4];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[4];
sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8;
}
else
{
sprite->data[1] = sprite->pos1.x + gBattleAnimArgs[1];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 0) + gBattleAnimArgs[3];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X) + gBattleAnimArgs[3];
sprite->data[3] = sprite->pos1.y + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + gBattleAnimArgs[4];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + gBattleAnimArgs[4];
sprite->data[7] |= GetBattlerSpriteBGPriority(gBattleAnimTarget) << 8;
}
@ -1441,7 +1248,7 @@ void MovePoisonGasCloud(struct Sprite *sprite)
if (sprite->data[0] <= 0)
{
sprite->data[0] = 80;
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
sprite->data[1] = sprite->pos1.x;
sprite->data[2] = sprite->pos1.x;
sprite->pos1.y += sprite->pos2.y;
@ -1575,238 +1382,63 @@ void AnimTask_Hail2(u8 taskId)
}
}
#ifdef NONMATCHING
bool8 GenerateHailParticle(u8 a, u8 b, u8 taskId, u8 c)
bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c)
{
bool8 possibleBool = FALSE;
// s8 unk = gUnknown_08595CB4[a].unk3;
const struct HailStruct *hailData = &gUnknown_08595CB4[a];
s8 unk = hailData->unk3;
u8 battler;
u8 id;
s16 battlerX, battlerY;
u8 spriteId;
// struct Sprite *sprite;
s16 spriteX;
bool8 possibleBool = FALSE;
s8 unk = gUnknown_08595CB4[hailStructId].unk3;
if (unk != 2)
{
battler = GetBattlerAtPosition(hailData->unk2);
if (IsBattlerSpriteVisible(battler))
id = GetBattlerAtPosition(gUnknown_08595CB4[hailStructId].unk2);
if (IsBattlerSpriteVisible(id))
{
possibleBool = TRUE;
battlerX = GetBattlerSpriteCoord(battler, 2);
battlerY = GetBattlerSpriteCoord(battler, 3);
battlerX = GetBattlerSpriteCoord(id, BATTLER_COORD_X_2);
battlerY = GetBattlerSpriteCoord(id, BATTLER_COORD_Y_PIC_OFFSET);
switch (unk)
{
case 0:
battlerX -= GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 6;
battlerY -= GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 6;
break;
case 1:
battlerX += GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_WIDTH) / 6;
battlerY += GetBattlerSpriteCoordAttr(battler, BATTLER_COORD_ATTR_HEIGHT) / 6;
break;
case 0:
battlerX -= GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_WIDTH) / 6;
battlerY -= GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_HEIGHT) / 6;
break;
case 1:
battlerX += GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_WIDTH) / 6;
battlerY += GetBattlerSpriteCoordAttr(id, BATTLER_COORD_ATTR_HEIGHT) / 6;
break;
}
}
else
{
battlerX = (gUnknown_08595CB4[hailStructId].unk0);
battlerY = (gUnknown_08595CB4[hailStructId].unk1);
}
}
else
{
battlerX = (hailData->unk0);
battlerY = (hailData->unk1);
battlerX = (gUnknown_08595CB4[hailStructId].unk0);
battlerY = (gUnknown_08595CB4[hailStructId].unk1);
}
spriteX = battlerX - ((battlerY + 8) / 2);
spriteId = CreateSprite(&gUnknown_08595D2C, spriteX, -8, 18);
if (spriteId == MAX_SPRITES)
id = CreateSprite(&gUnknown_08595D2C, spriteX, -8, 18);
if (id == MAX_SPRITES)
{
return FALSE;
// sprite = &gSprites[spriteId];
StartSpriteAffineAnim(&gSprites[spriteId], b);
gSprites[spriteId].data[0] = possibleBool;
gSprites[spriteId].data[3] = battlerX;
gSprites[spriteId].data[4] = battlerY;
gSprites[spriteId].data[5] = b;
gSprites[spriteId].data[6] = taskId;
gSprites[spriteId].data[7] = c;
return TRUE;
}
else
{
StartSpriteAffineAnim(&gSprites[id], affineAnimNum);
gSprites[id].data[0] = possibleBool;
gSprites[id].data[3] = battlerX;
gSprites[id].data[4] = battlerY;
gSprites[id].data[5] = affineAnimNum;
gSprites[id].data[6] = taskId;
gSprites[id].data[7] = c;
return TRUE;
}
}
#else
NAKED
bool8 GenerateHailParticle(u8 a, u8 b, u8 taskId, u8 c)
{
asm_unified("push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x8\n\
lsls r0, 24\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r9, r1\n\
lsls r2, 24\n\
lsrs r2, 24\n\
str r2, [sp]\n\
lsls r3, 24\n\
lsrs r3, 24\n\
mov r10, r3\n\
movs r1, 0\n\
str r1, [sp, 0x4]\n\
ldr r1, =gUnknown_08595CB4\n\
lsrs r0, 22\n\
adds r4, r0, r1\n\
ldrb r0, [r4, 0x3]\n\
lsls r0, 24\n\
asrs r0, 28\n\
mov r8, r0\n\
cmp r0, 0x2\n\
beq _0810CAD0\n\
ldrh r0, [r4, 0x2]\n\
lsls r0, 20\n\
lsrs r0, 24\n\
bl GetBattlerAtPosition\n\
lsls r0, 24\n\
lsrs r5, r0, 24\n\
adds r0, r5, 0\n\
bl IsBattlerSpriteVisible\n\
lsls r0, 24\n\
cmp r0, 0\n\
beq _0810CAD0\n\
movs r0, 0x1\n\
str r0, [sp, 0x4]\n\
adds r0, r5, 0\n\
movs r1, 0x2\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
adds r0, r5, 0\n\
movs r1, 0x3\n\
bl GetBattlerSpriteCoord\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
mov r1, r8\n\
cmp r1, 0\n\
beq _0810CA60\n\
cmp r1, 0x1\n\
beq _0810CA96\n\
b _0810CAE2\n\
.pool\n\
_0810CA60:\n\
adds r0, r5, 0\n\
movs r1, 0x1\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
bl __divsi3\n\
lsls r1, r7, 16\n\
asrs r1, 16\n\
subs r1, r0\n\
lsls r1, 16\n\
lsrs r7, r1, 16\n\
adds r0, r5, 0\n\
movs r1, 0\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
bl __divsi3\n\
lsls r1, r6, 16\n\
asrs r1, 16\n\
subs r1, r0\n\
b _0810CACA\n\
_0810CA96:\n\
adds r0, r5, 0\n\
movs r1, 0x1\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
bl __divsi3\n\
lsls r1, r7, 16\n\
asrs r1, 16\n\
adds r1, r0\n\
lsls r1, 16\n\
lsrs r7, r1, 16\n\
adds r0, r5, 0\n\
movs r1, 0\n\
bl GetBattlerSpriteCoordAttr\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r1, 0x6\n\
bl __divsi3\n\
lsls r1, r6, 16\n\
asrs r1, 16\n\
adds r1, r0\n\
_0810CACA:\n\
lsls r1, 16\n\
lsrs r6, r1, 16\n\
b _0810CAE2\n\
_0810CAD0:\n\
ldrh r0, [r4]\n\
lsls r0, 22\n\
asrs r0, 6\n\
lsrs r7, r0, 16\n\
ldr r0, [r4]\n\
lsls r0, 12\n\
asrs r0, 22\n\
lsls r0, 16\n\
lsrs r6, r0, 16\n\
_0810CAE2:\n\
lsls r0, r6, 16\n\
asrs r0, 16\n\
adds r0, 0x8\n\
lsrs r1, r0, 31\n\
adds r0, r1\n\
asrs r0, 1\n\
lsls r1, r7, 16\n\
asrs r1, 16\n\
subs r1, r0\n\
ldr r0, =gUnknown_08595D2C\n\
lsls r1, 16\n\
asrs r1, 16\n\
movs r2, 0x8\n\
negs r2, r2\n\
movs r3, 0x12\n\
bl CreateSprite\n\
lsls r0, 24\n\
lsrs r5, r0, 24\n\
cmp r5, 0x40\n\
beq _0810CB44\n\
lsls r4, r5, 4\n\
adds r4, r5\n\
lsls r4, 2\n\
ldr r0, =gSprites\n\
adds r4, r0\n\
adds r0, r4, 0\n\
mov r1, r9\n\
bl StartSpriteAffineAnim\n\
mov r0, sp\n\
ldrh r0, [r0, 0x4]\n\
strh r0, [r4, 0x2E]\n\
strh r7, [r4, 0x34]\n\
strh r6, [r4, 0x36]\n\
mov r1, r9\n\
strh r1, [r4, 0x38]\n\
mov r0, sp\n\
ldrh r0, [r0]\n\
strh r0, [r4, 0x3A]\n\
mov r1, r10\n\
strh r1, [r4, 0x3C]\n\
movs r0, 0x1\n\
b _0810CB46\n\
.pool\n\
_0810CB44:\n\
movs r0, 0\n\
_0810CB46:\n\
add sp, 0x8\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n");
}
#endif
void AnimHailBegin(struct Sprite *sprite)
{
@ -1874,8 +1506,8 @@ void InitIceBallAnim(struct Sprite *sprite)
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, 2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, 3) + gBattleAnimArgs[3];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
sprite->data[5] = gBattleAnimArgs[5];
InitAnimArcTranslation(sprite);

View File

@ -93,7 +93,7 @@ void CopyMonCategoryText(int dexNum, u8 *dest)
StringCopy(str + 1, gText_Pokemon);
}
u8 *sub_81DB494(u8 *str, int fontId, u8 *str2, int totalStringWidth)
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth)
{
u8 *buffer;
int width;

View File

@ -8,6 +8,7 @@
#include "event_object_movement.h"
#include "field_player_avatar.h"
#include "main.h"
#include "match_call.h"
#include "menu.h"
#include "new_game.h"
#include "overworld.h"
@ -74,7 +75,6 @@ struct BattleFrontierStreakInfo
EWRAM_DATA struct MatchCallState gMatchCallState = {0};
EWRAM_DATA struct BattleFrontierStreakInfo gBattleFrontierStreakInfo = {0};
bool32 SelectMatchCallMessage(int, u8 *);
static u32 GetCurrentTotalMinutes(struct Time *);
static u32 GetNumRegisteredNPCs(void);
static u32 GetActiveMatchCallTrainerId(u32);
@ -1098,13 +1098,13 @@ bool32 TryStartMatchCall(void)
return FALSE;
}
void StartMatchCallFromScript(void)
void StartMatchCallFromScript(u8 *message)
{
gMatchCallState.triggeredFromScript = 1;
StartMatchCall();
}
bool8 IsMatchCallTaskActive(void)
bool32 IsMatchCallTaskActive(void)
{
return FuncIsActiveTask(ExecuteMatchCall);
}

View File

@ -45,11 +45,11 @@
#include "player_pc.h"
#include "pokemon.h"
#include "pokemon_icon.h"
#include "pokemon_jump.h"
#include "pokemon_storage_system.h"
#include "pokemon_summary_screen.h"
#include "region_map.h"
#include "reshow_battle_screen.h"
#include "union_room.h"
#include "scanline_effect.h"
#include "script.h"
#include "sound.h"
@ -61,6 +61,7 @@
#include "text.h"
#include "text_window.h"
#include "trade.h"
#include "union_room.h"
#include "window.h"
#include "constants/battle.h"
#include "constants/battle_frontier.h"

View File

@ -205,7 +205,7 @@ void blockset_load_palette_to_gpu(u8);
void sub_80C01CC(struct Sprite *sprite);
void sub_80C020C(u32, u32, u32, u32);
void sub_80C0354(u16, u8, u8);
void sub_80C0460(u16, u8, u8);
void sub_80C0460(u16 weight, u8 left, u8 top);
void sub_80C09B0(u16);
u8 sub_80C0B44(u8, u16, u8, u8);
void sub_80C0D30(u8, u16);
@ -3926,9 +3926,6 @@ void sub_80C020C(u32 num, u32 value, u32 c, u32 d)
sub_80BE8DC(text3, GetStringCenterAlignXOffset(1, text3, 0xF0), 0x5F);
}
#define CHAR_PRIME (0xB4)
#define CHAR_DOUBLE_PRIME (0xB2)
void sub_80C0354(u16 height, u8 left, u8 top)
{
u8 buffer[16];
@ -3954,10 +3951,10 @@ void sub_80C0354(u16 height, u8 left, u8 top)
buffer[i++] = feet / 10 + CHAR_0;
buffer[i++] = (feet % 10) + CHAR_0;
}
buffer[i++] = CHAR_PRIME;
buffer[i++] = CHAR_SGL_QUOT_RIGHT;
buffer[i++] = (inches / 10) + CHAR_0;
buffer[i++] = (inches % 10) + CHAR_0;
buffer[i++] = CHAR_DOUBLE_PRIME;
buffer[i++] = CHAR_DBL_QUOT_RIGHT;
buffer[i++] = EOS;
sub_80BE8DC(buffer, left, top);
}
@ -3968,12 +3965,11 @@ void sub_80C0354(u16 height, u8 left, u8 top)
void sub_80C0460(u16 weight, u8 left, u8 top)
{
u8 buffer[16];
u32 lbs;
u8 i = 0;
bool8 output;
u8 i = 0;
u32 lbs = (weight * 100000) / 4536;
lbs = (weight * 100000) / 4536;
if (lbs % 10 >= 5)
if (lbs % 10u >= 5)
lbs += 10;
output = FALSE;
@ -3988,9 +3984,9 @@ void sub_80C0460(u16 weight, u8 left, u8 top)
i++;
}
lbs = (lbs % 100000);
lbs %= 100000;
buffer[i] = (lbs / 10000) + CHAR_0;
if (buffer[i] == CHAR_0 && output == FALSE)
if (buffer[i] == CHAR_0 && !output)
{
buffer[i++] = 0x77;
}
@ -4000,9 +3996,9 @@ void sub_80C0460(u16 weight, u8 left, u8 top)
i++;
}
lbs = (lbs % 10000);
lbs %= 10000;
buffer[i] = (lbs / 1000) + CHAR_0;
if (buffer[i] == CHAR_0 && output == FALSE)
if (buffer[i] == CHAR_0 && !output)
{
buffer[i++] = 0x77;
}
@ -4010,9 +4006,10 @@ void sub_80C0460(u16 weight, u8 left, u8 top)
{
i++;
}
lbs = (lbs % 1000);
lbs %= 1000;
buffer[i++] = (lbs / 100) + CHAR_0;
lbs = (lbs % 100);
lbs %= 100;
buffer[i++] = CHAR_PERIOD;
buffer[i++] = (lbs / 10) + CHAR_0;
buffer[i++] = CHAR_SPACE;
@ -4042,7 +4039,7 @@ void sub_80C0460(u16 weight, u8 left, u8 top)
lsls r2, 24\n\
lsrs r2, 24\n\
str r2, [sp, 0x10]\n\
ldr r5, =0x000186a0 @ Note to decompiler: See UNKNOWN_OFFSET\n\
ldr r5, =0x000186a0\n\
muls r0, r5\n\
ldr r1, =0x000011b8\n\
bl __divsi3\n\
@ -4076,7 +4073,7 @@ _080C04C0:\n\
mov r8, r1\n\
movs r6, 0x1\n\
_080C04C6:\n\
ldr r1, =0x000186a0 @ Note to decompiler: See UNKNOWN_OFFSET\n\
ldr r1, =0x000186a0\n\
adds r0, r7, 0\n\
bl __umodsi3\n\
adds r7, r0, 0\n\

View File

@ -1,5 +1,8 @@
#include "global.h"
#include "alloc.h"
#include "data.h"
#include "decompress.h"
#include "event_data.h"
#include "item.h"
#include "link.h"
#include "link_rfu.h"
@ -12,6 +15,7 @@
#include "sprite.h"
#include "string_util.h"
#include "task.h"
#include "trig.h"
#include "pokemon.h"
#include "pokemon_jump.h"
#include "constants/rgb.h"
@ -121,11 +125,25 @@ struct Unk802B078
int unk8;
};
struct PokemonJump2
{
u8 filler0[0xE];
u8 unkE;
u8 unkF;
u8 filler10[0x8198];
struct Sprite *unk81A8[MAX_RFU_PLAYERS];
struct Sprite *unk81BC[MAX_RFU_PLAYERS];
struct Sprite *unk81D0[8];
u8 filler81F0[0xC];
u8 unk81FC[MAX_RFU_PLAYERS];
};
static void sub_802AA60(struct PokemonJump1 *);
void sub_802AA94(struct PokemonJump1 *);
void sub_802AB20(void);
static void sub_802AB98(void);
s16 sub_802AC00(u16);
static s16 sub_802AC00(u16 species);
static void sub_802AC2C(struct PokemonJump1_MonInfo *monInfo, struct Pokemon *mon);
static void sub_802AC6C(void);
static void sub_802ACA0(u8 taskId);
@ -191,8 +209,12 @@ static bool32 sub_802C7BC(void);
static u16 sub_802C7E0(void);
static void sub_802C808(u16, u16 *, u16 *);
static u16 sub_802C818(void);
u16 sub_802C838(void);
u16 sub_802C880(u16, u16);
static u16 sub_802C838(void);
static u16 sub_802C880(u16 item, u16 quantity);
static void sub_802CB7C(struct Sprite *sprite);
static void sub_802CC40(struct Sprite *sprite);
static void sub_802CD08(struct Sprite *sprite);
static void sub_802CDD4(struct Sprite *sprite);
void sub_802DC9C(u32);
void sub_802D074(void *);
void sub_802D0AC(void);
@ -229,6 +251,7 @@ int sub_802E354(int, u16, u16);
void sub_802E3A8(void);
extern struct PokemonJump1 *gUnknown_02022CFC;
extern struct PokemonJump2 *gUnknown_02022D00;
const struct PokemonJumpMons gPkmnJumpSpecies[] =
{
@ -363,10 +386,17 @@ bool32 (* const gUnknown_082FB618[])(void) =
extern const u16 gUnknown_082FB63C[];
extern const u16 gUnknown_082FB64C[4];
extern const u16 gUnknown_082FB654[];
extern s8 gUnknown_082FB65C[][48];
extern int gUnknown_082FB6EC[];
extern int gUnknown_082FB714[];
extern u16 gUnknown_082FB704[8];
extern const s8 gUnknown_082FB65C[][48];
extern const int gUnknown_082FB6EC[];
extern const int gUnknown_082FB714[];
extern const u16 gUnknown_082FB704[8];
extern const struct CompressedSpriteSheet gUnknown_082FBE08[5];
extern const struct SpritePalette gUnknown_082FBE30[2];
extern const struct SpriteTemplate gUnknown_082FBE40;
extern const struct SpriteTemplate gUnknown_082FC00C;
extern const s16 gUnknown_082FBE58[];
extern const s16 gUnknown_082FBEA8[8];
extern const struct SpriteTemplate gUnknown_082FBEB8[4];
void sub_802A9A8(u16 partyIndex, MainCallback callback)
{
@ -451,11 +481,9 @@ void sub_802AA94(struct PokemonJump1 *arg0)
}
}
#ifdef NONMATCHING
void sub_802AB20(void)
{
int i;
s16 index;
int i, index;
for (i = 0; i < MAX_RFU_PLAYERS; i++)
{
@ -465,61 +493,6 @@ void sub_802AB20(void)
gUnknown_02022CFC->unk83AC = &gUnknown_02022CFC->unk82E4[gUnknown_02022CFC->unk6];
}
#else
NAKED
void sub_802AB20(void)
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r8\n\
push {r7}\n\
ldr r7, =gUnknown_02022CFC\n\
movs r6, 0\n\
movs r5, 0\n\
ldr r0, =gPkmnJumpSpecies\n\
mov r8, r0\n\
movs r4, 0x4\n\
_0802AB32:\n\
ldr r0, [r7]\n\
adds r0, r5\n\
ldr r1, =0x000082a8\n\
adds r0, r1\n\
ldrh r0, [r0]\n\
bl sub_802AC00\n\
lsls r0, 16\n\
ldr r1, [r7]\n\
adds r1, r6\n\
asrs r0, 14\n\
add r0, r8\n\
ldrh r0, [r0, 0x2]\n\
ldr r2, =0x000082f0\n\
adds r1, r2\n\
strh r0, [r1]\n\
adds r6, 0x28\n\
adds r5, 0xC\n\
subs r4, 0x1\n\
cmp r4, 0\n\
bge _0802AB32\n\
ldr r0, =gUnknown_02022CFC\n\
ldr r1, [r0]\n\
ldr r0, =0x000083ac\n\
adds r3, r1, r0\n\
ldrb r2, [r1, 0x6]\n\
lsls r0, r2, 2\n\
adds r0, r2\n\
lsls r0, 3\n\
ldr r2, =0x000082e4\n\
adds r0, r2\n\
adds r1, r0\n\
str r1, [r3]\n\
pop {r3}\n\
mov r8, r3\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif // NONMATCHING
static void sub_802AB98(void)
{
@ -537,7 +510,7 @@ static void sub_802AB98(void)
}
}
s16 sub_802AC00(u16 species)
static s16 sub_802AC00(u16 species)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(gPkmnJumpSpecies); i++)
@ -2079,3 +2052,355 @@ static u16 sub_802C818(void)
u16 index = Random() % ARRAY_COUNT(gUnknown_082FB704);
return gUnknown_082FB704[index];
}
NAKED
static u16 sub_802C838(void)
{
asm_unified("\n\
push {r4-r6,lr}\n\
movs r5, 0\n\
movs r4, 0\n\
ldr r3, =gUnknown_02022CFC\n\
ldr r0, [r3]\n\
ldr r2, =gUnknown_082FB714\n\
ldr r1, [r0, 0x78]\n\
ldr r0, [r2]\n\
cmp r1, r0\n\
bcc _0802C874\n\
ldr r5, [r2, 0x4]\n\
adds r6, r3, 0\n\
adds r3, r2, 0x4\n\
_0802C852:\n\
adds r3, 0x8\n\
adds r2, 0x8\n\
adds r4, 0x1\n\
cmp r4, 0x4\n\
bhi _0802C874\n\
ldr r0, [r6]\n\
ldr r1, [r0, 0x78]\n\
ldr r0, [r2]\n\
cmp r1, r0\n\
bcc _0802C874\n\
ldr r5, [r3]\n\
b _0802C852\n\
.pool\n\
_0802C874:\n\
lsls r0, r5, 16\n\
lsrs r0, 16\n\
pop {r4-r6}\n\
pop {r1}\n\
bx r1");
}
static u16 sub_802C880(u16 item, u16 quantity)
{
while (quantity && !CheckBagHasSpace(item, quantity))
quantity--;
return quantity;
}
u16 sub_802C8AC(void)
{
return GetLinkPlayerCount();
}
u16 sub_802C8BC(void)
{
return gUnknown_02022CFC->unk6;
}
struct PokemonJump1_MonInfo *sub_802C8C8(u8 multiplayerId)
{
return &gUnknown_02022CFC->unk82A8[multiplayerId];
}
u8 *sub_802C8E8(u8 multiplayerId)
{
return gUnknown_02022CFC->unk82E4[multiplayerId].unk1C;
}
bool32 sub_802C908(u16 species)
{
return sub_802AC00(species) > -1;
}
void sub_802C920(void)
{
int i;
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_HAS_SPECIES))
{
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
if (sub_802C908(species))
{
gSpecialVar_Result = 1;
return;
}
}
}
gSpecialVar_Result = 0;
}
void sub_802C974(struct PokemonJump2 *arg0)
{
int i;
for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE08); i++)
LoadCompressedSpriteSheet(&gUnknown_082FBE08[i]);
for (i = 0; i < ARRAY_COUNT(gUnknown_082FBE30); i++)
LoadSpritePalette(&gUnknown_082FBE30[i]);
arg0->unkE = IndexOfSpritePaletteTag(5);
arg0->unkF = IndexOfSpritePaletteTag(6);
}
static void sub_802C9BC(struct Sprite *sprite)
{
int i;
for (i = 0; i < 8; i++)
sprite->data[i] = 0;
}
void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon, u16 x, u16 y, u8 multiplayerId)
{
struct SpriteTemplate spriteTemplate;
struct SpriteSheet spriteSheet;
struct CompressedSpritePalette spritePalette;
u8 *buffer;
u8 *unusedBuffer;
u8 subpriority;
u8 spriteId;
spriteTemplate = gUnknown_082FBE40;
buffer = Alloc(0x2000);
unusedBuffer = Alloc(0x800);
if (multiplayerId == sub_802C8BC())
subpriority = 3;
else
subpriority = multiplayerId + 4;
if (buffer && unusedBuffer)
{
HandleLoadSpecialPokePic(
&gMonFrontPicTable[jumpMon->species],
buffer,
jumpMon->species,
jumpMon->personality);
spriteSheet.data = buffer;
spriteSheet.tag = multiplayerId;
spriteSheet.size = 0x800;
LoadSpriteSheet(&spriteSheet);
spritePalette.data = GetFrontSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality);
spritePalette.tag = multiplayerId;
LoadCompressedSpritePalette(&spritePalette);
Free(buffer);
Free(unusedBuffer);
spriteTemplate.tileTag += multiplayerId;
spriteTemplate.paletteTag += multiplayerId;
spriteId = CreateSprite(&spriteTemplate, x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
arg0->unk81A8[multiplayerId] = &gSprites[spriteId];
arg0->unk81FC[multiplayerId] = subpriority;
return;
}
}
arg0->unk81A8[multiplayerId] = NULL;
}
void sub_802CB14(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_802C9BC(arg0->unk81BC[multiplayerId]);
arg0->unk81BC[multiplayerId]->data[7] = arg0->unk81A8[multiplayerId] - gSprites;
arg0->unk81BC[multiplayerId]->invisible = 0;
arg0->unk81BC[multiplayerId]->pos1.y = 96;
arg0->unk81BC[multiplayerId]->callback = sub_802CB7C;
StartSpriteAnim(arg0->unk81BC[multiplayerId], 1);
}
static void sub_802CB7C(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
if (sprite->animEnded)
{
sprite->invisible = 1;
sprite->callback = SpriteCallbackDummy;
}
break;
case 1:
sprite->pos1.y--;
sprite->data[1]++;
if (sprite->pos1.y <= 72)
{
sprite->pos1.y = 72;
sprite->data[0]++;
}
break;
case 2:
if (++sprite->data[1] >= 48)
{
sprite->invisible = 1;
sprite->callback = SpriteCallbackDummy;
}
break;
}
}
void sub_802CBF0(struct PokemonJump2 *arg0, int multiplayerId)
{
arg0->unk81A8[multiplayerId]->callback = sub_802CC40;
arg0->unk81A8[multiplayerId]->pos2.y = 0;
sub_802C9BC(arg0->unk81A8[multiplayerId]);
}
bool32 sub_802CC18(struct PokemonJump2 *arg0, int multiplayerId)
{
return arg0->unk81A8[multiplayerId]->callback == sub_802CC40;
}
static void sub_802CC40(struct Sprite *sprite)
{
if (++sprite->data[1] > 1)
{
if (++sprite->data[2] & 1)
sprite->pos2.y = 2;
else
sprite->pos2.y = -2;
sprite->data[1] = 0;
}
if (sprite->data[2] > 12)
{
sprite->pos2.y = 0;
sprite->callback = SpriteCallbackDummy;
}
}
void sub_802CC88(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_802C9BC(arg0->unk81A8[multiplayerId]);
arg0->unk81A8[multiplayerId]->callback = sub_802CD08;
}
void sub_802CCB0(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_802C8AC();
for (i = 0; i < numPlayers; i++)
{
if (arg0->unk81A8[i]->callback == sub_802CD08)
{
arg0->unk81A8[i]->invisible = 0;
arg0->unk81A8[i]->callback = SpriteCallbackDummy;
arg0->unk81A8[i]->subpriority = 10;
}
}
}
static void sub_802CD08(struct Sprite *sprite)
{
if (++sprite->data[0] > 3)
{
sprite->data[0] = 0;
sprite->invisible ^= 1;
}
}
void sub_802CD3C(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_802C8AC();
for (i = 0; i < numPlayers; i++)
arg0->unk81A8[i]->subpriority = arg0->unk81FC[i];
}
void sub_802CD70(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_802C9BC(arg0->unk81A8[multiplayerId]);
arg0->unk81A8[multiplayerId]->callback = sub_802CDD4;
}
bool32 sub_802CD98(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_802C8AC();
for (i = 0; i < numPlayers; i++)
{
if (arg0->unk81A8[i]->callback == sub_802CDD4)
return TRUE;
}
return FALSE;
}
static void sub_802CDD4(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
PlaySE(SE_JITE_PYOKO);
sprite->data[1] = 0;
sprite->data[0]++;
// fall through
case 1:
sprite->data[1] += 4;
if (sprite->data[1] > 0x7F)
sprite->data[1] = 0;
sprite->pos2.y = -(gSineTable[sprite->data[1]] >> 3);
if (sprite->data[1] == 0)
{
if (++sprite->data[2] < 2)
sprite->data[0] = 0;
else
sprite->callback = SpriteCallbackDummy;
}
break;
}
}
void sub_802CE48(struct PokemonJump2 *arg0, s16 x, s16 y, u8 multiplayerId)
{
u8 spriteId = CreateSprite(&gUnknown_082FC00C, x, y, 1);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].invisible = 1;
arg0->unk81BC[multiplayerId] = &gSprites[spriteId];
}
}
// void sub_802CE9C(struct PokemonJump2 *arg0)
// {
// int i;
// int count;
// u8 spriteId;
// count = 0;
// for (i = 0; i < 4; i++)
// {
// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2);
// arg0->unk81D0[count] = &gSprites[spriteId];
// count++;
// }
// for (i = 0; i < 4; i++)
// {
// spriteId = CreateSprite(&gUnknown_082FBEB8[i], gUnknown_082FBEA8[count], gUnknown_082FBE58[i * 10], 2);
// arg0->unk81D0[count] = &gSprites[spriteId];
// arg0->unk81D0[count]->hFlip = 1;
// count++;
// }
// }

View File

@ -8,32 +8,12 @@
#include "pokemon_storage_system.h"
#include "pokenav.h"
enum
{
MODE_NORMAL, // Chosen from Start menu.
MODE_FORCE_CALL_1, // Used for the script's special. Has to choose Match Call and make a call.
MODE_FORCE_CALL_2, // Set after making a call, has to exit Pokenav.
};
enum
{
NAVMENU_CB_UNK_0,
NAVMENU_CB_UNK_1,
NAVMENU_CB_UNK_2,
NAVMENU_CB_UNK_3,
NAVMENU_CB_UNK_4,
NAVMENU_CB_UNK_5,
NAVMENU_CB_UNK_6
};
#define LOOPED_TASK_DECODE_STATE(action) (action - 5)
#define LOOPED_TASK_ID(primary, secondary) (((secondary) << 16) |(primary))
#define LOOPED_TASK_PRIMARY_ID(taskId) (taskId & 0xFFFF)
#define LOOPED_TASK_SECONDARY_ID(taskId) (taskId >> 16)
#define UNKNOWN_OFFSET 100000
#define SUBSTRUCT_COUNT 19
struct PokenavResources
@ -46,76 +26,74 @@ struct PokenavResources
void *field10[SUBSTRUCT_COUNT];
};
extern u32 sub_81C9430(void);
extern u32 sub_81C9298(void);
extern u32 sub_81C941C(void);
struct UnknownPokenavCallbackStruct
{
bool32 (*unk0)(void);
u32 (*unk4)(void);
u32 (*unk8)(void);
u32 (*unkC)(void);
u32 (*unk10)(void);
void (*unk14)(void);
u32 (*unk18)(void);
};
extern u32 sub_81C9924(void);
extern u32 sub_81C99C0(void);
extern u32 sub_81C9990(void);
extern u32 sub_81C9940(void);
extern u32 sub_81C9338(void);
extern u32 sub_81C9368(void);
extern u32 sub_81C92CC(void);
extern u32 sub_81C9304(void);
extern u32 sub_81CC4D4(void);
extern u32 sub_81CC554(void);
extern u32 sub_81CC5F4(void);
extern u32 sub_81CC62C(void);
extern u32 sub_81CC65C(void);
extern u32 sub_81CC524(void);
extern void sub_81CC524(void);
extern u32 sub_81CC670(void);
extern u32 sub_81CCFD8(void);
extern u32 sub_81CD070(void);
extern u32 sub_81CDDD4(void);
extern u32 sub_81CDE2C(void);
extern u32 sub_81CDE64(void);
extern u32 sub_81CD1C0(void);
extern void sub_81CD1C0(void);
extern u32 sub_81CECA0(void);
extern u32 sub_81CEF3C(void);
extern u32 sub_81CEFDC(void);
extern u32 sub_81CF330(void);
extern u32 sub_81CF3A0(void);
extern u32 sub_81CF3D0(void);
extern u32 sub_81CEFF0(void);
extern void sub_81CEFF0(void);
extern u32 sub_81CF3F8(void);
extern u32 sub_81CD024(void);
extern u32 sub_81CEF98(void);
extern u32 sub_81CF368(void);
extern u32 sub_81CAAE8(void);
extern u32 sub_81CAB24(void);
extern u32 sub_81CB260(void);
extern u32 sub_81CB29C(void);
extern u32 sub_81CB2CC(void);
extern u32 sub_81CAB38(void);
extern u32 sub_81CB2E0(void);
extern u32 sub_81CF9BC(void);
extern u32 sub_81CFA34(void);
extern u32 sub_81CFDD0(void);
extern u32 sub_81CFE40(void);
extern u32 sub_81CFE70(void);
extern u32 sub_81CFA48(void);
extern void sub_81CFA48(void);
extern u32 sub_81CFE98(void);
extern u32 sub_81D0450(void);
extern u32 sub_81D04A0(void);
extern u32 sub_81D0978(void);
extern u32 sub_81D09B0(void);
extern u32 sub_81D09E0(void);
extern u32 sub_81D04B8(void);
extern void sub_81D04B8(void);
extern u32 sub_81D09F4(void);
extern u32 sub_81CFA04(void);
extern u32 sub_81CFE08(void);
bool32 SetActivePokenavMenu(u32 a0);
bool32 InitPokenavMainMenu(void);
static bool32 SetActivePokenavMenu(u32 menuId);
static bool32 AnyMonHasRibbon(void);
u32 sub_81C75E0(void);
u32 sub_81C75D4(void);
u32 PokenavMainMenuLoopedTaskIsActive(void);
u32 sub_81C786C(void);
bool32 WaitForPokenavShutdownFade(void);
void sub_81C7834(void *func1, void *func2);
static void InitPokenavResources(struct PokenavResources *a0);
void sub_81C7850(u32 a0);
void Task_RunLoopedTask_LinkMode(u8 a0);
void Task_RunLoopedTask(u8 taskId);
void sub_81C742C(u8 taskId);
@ -126,143 +104,142 @@ static void VBlankCB_Pokenav(void);
static void CB2_Pokenav(void);
void sub_81C72BC(void);
// Const rom data.
u32 (*const PokenavMenuCallbacks[15][7])(void) =
const struct UnknownPokenavCallbackStruct PokenavMenuCallbacks[15] =
{
{
sub_81C9298,
sub_81C941C,
sub_81C9924,
sub_81C9990,
sub_81C99C0,
sub_81C9430,
sub_81C99D4,
.unk0 = sub_81C9298,
.unk4 = sub_81C941C,
.unk8 = sub_81C9924,
.unkC = sub_81C9990,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
},
{
sub_81C9298,
sub_81C941C,
sub_81C9940,
sub_81C9990,
sub_81C99C0,
sub_81C9430,
sub_81C99D4,
.unk0 = sub_81C9298,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = sub_81C9990,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
},
{
sub_81C9338,
sub_81C941C,
sub_81C9940,
sub_81C9990,
sub_81C99C0,
sub_81C9430,
sub_81C99D4,
.unk0 = sub_81C9338,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = sub_81C9990,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
},
{
sub_81C9368,
sub_81C941C,
sub_81C9940,
sub_81C9990,
sub_81C99C0,
sub_81C9430,
sub_81C99D4,
.unk0 = sub_81C9368,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = sub_81C9990,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
},
{
sub_81C92CC,
sub_81C941C,
sub_81C9940,
sub_81C9990,
sub_81C99C0,
sub_81C9430,
sub_81C99D4,
.unk0 = sub_81C92CC,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = sub_81C9990,
.unk10 =sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
},
{
sub_81C9304,
sub_81C941C,
sub_81C9940,
sub_81C9990,
sub_81C99C0,
sub_81C9430,
sub_81C99D4,
.unk0 = sub_81C9304,
.unk4 = sub_81C941C,
.unk8 = sub_81C9940,
.unkC = sub_81C9990,
.unk10 = sub_81C99C0,
.unk14 = sub_81C9430,
.unk18 = sub_81C99D4,
},
{
sub_81CC4D4,
sub_81CC554,
sub_81CC5F4,
sub_81CC62C,
sub_81CC65C,
sub_81CC524,
sub_81CC670,
.unk0 = sub_81CC4D4,
.unk4 = sub_81CC554,
.unk8 = sub_81CC5F4,
.unkC = sub_81CC62C,
.unk10 = sub_81CC65C,
.unk14 = sub_81CC524,
.unk18 = sub_81CC670,
},
{
sub_81CCFD8,
sub_81CD070,
sub_81CDDD4,
sub_81CDE2C,
sub_81CDE64,
sub_81CD1C0,
sub_81CECA0,
.unk0 = sub_81CCFD8,
.unk4 = sub_81CD070,
.unk8 = sub_81CDDD4,
.unkC = sub_81CDE2C,
.unk10 = sub_81CDE64,
.unk14 = sub_81CD1C0,
.unk18 = sub_81CECA0,
},
{
sub_81CEF3C,
sub_81CEFDC,
sub_81CF330,
sub_81CF3A0,
sub_81CF3D0,
sub_81CEFF0,
sub_81CF3F8,
.unk0 = sub_81CEF3C,
.unk4 = sub_81CEFDC,
.unk8 = sub_81CF330,
.unkC = sub_81CF3A0,
.unk10 = sub_81CF3D0,
.unk14 = sub_81CEFF0,
.unk18 = sub_81CF3F8,
},
{
sub_81CD024,
sub_81CD070,
sub_81CDDD4,
sub_81CDE2C,
sub_81CDE64,
sub_81CD1C0,
sub_81CECA0,
.unk0 = sub_81CD024,
.unk4 = sub_81CD070,
.unk8 = sub_81CDDD4,
.unkC = sub_81CDE2C,
.unk10 = sub_81CDE64,
.unk14 = sub_81CD1C0,
.unk18 = sub_81CECA0,
},
{
sub_81CEF98,
sub_81CEFDC,
sub_81CF368,
sub_81CF3A0,
sub_81CF3D0,
sub_81CEFF0,
sub_81CF3F8,
.unk0 = sub_81CEF98,
.unk4 = sub_81CEFDC,
.unk8 = sub_81CF368,
.unkC = sub_81CF3A0,
.unk10 = sub_81CF3D0,
.unk14 = sub_81CEFF0,
.unk18 = sub_81CF3F8,
},
{
sub_81CAAE8,
sub_81CAB24,
sub_81CB260,
sub_81CB29C,
sub_81CB2CC,
sub_81CAB38,
sub_81CB2E0,
.unk0 = sub_81CAAE8,
.unk4 = sub_81CAB24,
.unk8 = sub_81CB260,
.unkC = sub_81CB29C,
.unk10 = sub_81CB2CC,
.unk14 = sub_81CAB38,
.unk18 = sub_81CB2E0,
},
{
sub_81CF9BC,
sub_81CFA34,
sub_81CFDD0,
sub_81CFE40,
sub_81CFE70,
sub_81CFA48,
sub_81CFE98,
.unk0 = sub_81CF9BC,
.unk4 = sub_81CFA34,
.unk8 = sub_81CFDD0,
.unkC = sub_81CFE40,
.unk10 = sub_81CFE70,
.unk14 = sub_81CFA48,
.unk18 = sub_81CFE98,
},
{
sub_81D0450,
sub_81D04A0,
sub_81D0978,
sub_81D09B0,
sub_81D09E0,
sub_81D04B8,
sub_81D09F4,
.unk0 = sub_81D0450,
.unk4 = sub_81D04A0,
.unk8 = sub_81D0978,
.unkC = sub_81D09B0,
.unk10 = sub_81D09E0,
.unk14 = sub_81D04B8,
.unk18 = sub_81D09F4,
},
{
sub_81CFA04,
sub_81CFA34,
sub_81CFE08,
sub_81CFE40,
sub_81CFE70,
sub_81CFA48,
sub_81CFE98,
.unk0 = sub_81CFA04,
.unk4 = sub_81CFA34,
.unk8 = sub_81CFE08,
.unkC = sub_81CFE40,
.unk10 = sub_81CFE70,
.unk14 = sub_81CFA48,
.unk18 = sub_81CFE98,
},
};
@ -300,7 +277,7 @@ bool32 IsLoopedTaskActive(u32 taskId)
bool32 FuncIsActiveLoopedTask(LoopedTask func)
{
s32 i;
int i;
for (i = 0; i < NUM_TASKS; i++)
{
if (gTasks[i].isActive
@ -413,7 +390,7 @@ void sub_81C72BC(void)
else
{
InitPokenavResources(gPokenavResources);
gPokenavResources->mode = MODE_FORCE_CALL_1;
gPokenavResources->mode = POKENAV_MODE_FORCE_CALL_1;
ResetTasks();
ResetSpriteData();
FreeAllSpritePalettes();
@ -426,7 +403,7 @@ void sub_81C72BC(void)
static void FreePokenavResources(void)
{
s32 i;
int i;
for (i = 0; i < SUBSTRUCT_COUNT; i++)
FreePokenavSubstruct(i);
@ -437,12 +414,12 @@ static void FreePokenavResources(void)
static void InitPokenavResources(struct PokenavResources *a0)
{
s32 i;
int i;
for (i = 0; i < SUBSTRUCT_COUNT; i++)
a0->field10[i] = NULL;
a0->mode = MODE_NORMAL;
a0->mode = POKENAV_MODE_NORMAL;
a0->currentMenuIndex = 0;
a0->hasAnyRibbons = AnyMonHasRibbon();
a0->currentMenuCb1 = NULL;
@ -450,7 +427,7 @@ static void InitPokenavResources(struct PokenavResources *a0)
static bool32 AnyMonHasRibbon(void)
{
s32 i, j;
int i, j;
for (i = 0; i < PARTY_SIZE; i++)
{
@ -507,7 +484,7 @@ void sub_81C742C(u8 taskId)
// Wait for LoopedTask_InitPokenavMenu to finish
if (PokenavMainMenuLoopedTaskIsActive())
break;
SetActivePokenavMenu(0 + UNKNOWN_OFFSET);
SetActivePokenavMenu(POKENAV_MENU_0);
data[0] = 4;
break;
case 2:
@ -521,10 +498,10 @@ void sub_81C742C(u8 taskId)
ShutdownPokenav();
data[0] = 5;
}
else if (v1 >= UNKNOWN_OFFSET)
else if (v1 >= POKENAV_MENU_IDS_START)
{
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex][NAVMENU_CB_UNK_6]();
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex][NAVMENU_CB_UNK_5]();
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex].unk18();
PokenavMenuCallbacks[gPokenavResources->currentMenuIndex].unk14();
if (SetActivePokenavMenu(v1))
{
data[0] = 4;
@ -549,7 +526,7 @@ void sub_81C742C(u8 taskId)
case 5:
if (!WaitForPokenavShutdownFade())
{
bool32 calledFromScript = (gPokenavResources->mode != MODE_NORMAL);
bool32 calledFromScript = (gPokenavResources->mode != POKENAV_MODE_NORMAL);
sub_81C9430();
FreePokenavResources();
@ -562,18 +539,18 @@ void sub_81C742C(u8 taskId)
}
}
bool32 SetActivePokenavMenu(u32 indexWithOffset)
static bool32 SetActivePokenavMenu(u32 menuId)
{
u32 index = indexWithOffset - UNKNOWN_OFFSET;
u32 index = menuId - POKENAV_MENU_IDS_START;
InitKeys_();
if (!PokenavMenuCallbacks[index][NAVMENU_CB_UNK_0]())
if (!PokenavMenuCallbacks[index].unk0())
return FALSE;
if (!PokenavMenuCallbacks[index][NAVMENU_CB_UNK_2]())
if (!PokenavMenuCallbacks[index].unk8())
return FALSE;
sub_81C7834(PokenavMenuCallbacks[index][NAVMENU_CB_UNK_3], PokenavMenuCallbacks[index][NAVMENU_CB_UNK_4]);
gPokenavResources->currentMenuCb1 = PokenavMenuCallbacks[index][NAVMENU_CB_UNK_1];
sub_81C7834(PokenavMenuCallbacks[index].unkC, PokenavMenuCallbacks[index].unk10);
gPokenavResources->currentMenuCb1 = PokenavMenuCallbacks[index].unk4;
gPokenavResources->currentMenuIndex = index;
return TRUE;
}
@ -605,7 +582,8 @@ void SetPokenavVBlankCallback(void)
void *AllocSubstruct(u32 index, u32 size)
{
return gPokenavResources->field10[index] = Alloc(size);
gPokenavResources->field10[index] = Alloc(size);
return gPokenavResources->field10[index];
}
void *GetSubstructPtr(u32 index)
@ -619,7 +597,7 @@ void FreePokenavSubstruct(u32 index)
FREE_AND_SET_NULL(gPokenavResources->field10[index]);
}
u16 GetPokenavMode(void)
u32 GetPokenavMode(void)
{
return gPokenavResources->mode;
}

View File

@ -19,12 +19,10 @@ enum
POKENAV_GFX_CONDITION_MENU,
POKENAV_GFX_RIBBONS_MENU,
POKENAV_GFX_MATCH_CALL_MENU,
// One of these is for the zoomed-in map, and the other is for the
// zoomed-out map. Don't know which is which yet.
POKENAV_GFX_MAP_MENU_UNK0,
POKENAV_GFX_MAP_MENU_UNK1,
POKENAV_GFX_PARTY_MENU,
POKENAV_GFX_SEARCH_MENU,
POKENAV_GFX_COOL_MENU,
@ -32,8 +30,7 @@ enum
POKENAV_GFX_CUTE_MENU,
POKENAV_GFX_SMART_MENU,
POKENAV_GFX_TOUGH_MENU,
POKENAV_GFX_MENUS_END
POKENAV_GFX_MENUS_END,
};
#define POKENAV_GFX_SUBMENUS_START POKENAV_GFX_PARTY_MENU
@ -60,27 +57,23 @@ struct CompressedSpriteSheetNoSize
u32 tag;
};
extern void sub_81CAADC(void);
void CleanupPokenavMainMenuResources(void);
void LoadLeftHeaderGfxForSubMenu(u32 arg0);
void LoadLeftHeaderGfxForMenu(u32 arg0);
void HideLeftHeaderSubmenuSprites(bool32 arg0);
void HideLeftHeaderSprites(bool32 arg0);
void ShowLeftHeaderSprites(u32 arg0, bool32 arg1);
void ShowLeftHeaderSubmenuSprites(u32 arg0, bool32 arg1);
void MoveLeftHeader(struct Sprite *sprite, s32 arg1, s32 arg2, s32 arg3);
void SpriteCB_MoveLeftHeader(struct Sprite *sprite);
void InitPokenavMainMenuResources(void);
void InitHoennMapHeaderSprites(void);
void sub_81C7B74(void);
void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 a1, u32 a2);
u32 LoopedTask_ScrollMenuHeaderDown(s32 a0);
u32 LoopedTask_ScrollMenuHeaderUp(s32 a0);
void sub_81C7BF8(u32 a0);
void SpriteCB_SpinningPokenav(struct Sprite* sprite);
u32 LoopedTask_InitPokenavMenu(s32 a0);
static void CleanupPokenavMainMenuResources(void);
static void LoadLeftHeaderGfxForSubMenu(u32 arg0);
static void LoadLeftHeaderGfxForMenu(u32 index);
static void HideLeftHeaderSubmenuSprites(bool32 isOnRightSide);
static void HideLeftHeaderSprites(bool32 isOnRightSide);
static void ShowLeftHeaderSprites(u32 startY, bool32 isOnRightSide);
static void ShowLeftHeaderSubmenuSprites(u32 startY, bool32 isOnRightSide);
static void MoveLeftHeader(struct Sprite *sprite, int startX, int endX, int duration);
static void SpriteCB_MoveLeftHeader(struct Sprite *sprite);
static void InitPokenavMainMenuResources(void);
static void InitHoennMapHeaderSprites(void);
static void sub_81C7B74(void);
static u32 LoopedTask_ScrollMenuHeaderDown(int a0);
static u32 LoopedTask_ScrollMenuHeaderUp(int a0);
static void sub_81C7BF8(u32 a0);
static void SpriteCB_SpinningPokenav(struct Sprite* sprite);
static u32 LoopedTask_InitPokenavMenu(int a0);
const u16 gSpinningPokenavPaletteData[] = INCBIN_U16("graphics/pokenav/icon2.gbapal");
const u32 gSpinningPokenavGfx[] = INCBIN_U32("graphics/pokenav/icon2.4bpp.lz");
@ -121,7 +114,7 @@ const struct WindowTemplate gUnknown_0861FA08[2] =
},
};
const u8 *const sMenuButtonReminders[12] =
const u8 *const sHelpBarTexts[12] =
{
gText_Pokenav_ClearButtonList,
gText_PokenavMap_ZoomedOutButtons,
@ -367,7 +360,7 @@ bool32 WaitForPokenavShutdownFade(void)
return TRUE;
}
u32 LoopedTask_InitPokenavMenu(s32 a0)
static u32 LoopedTask_InitPokenavMenu(int a0)
{
struct PokenavMainMenuResources *structPtr;
@ -447,7 +440,7 @@ bool32 MainMenuLoopedTaskIsBusy(void)
return IsLoopedTaskActive(structPtr->currentTaskId);
}
u32 LoopedTask_ScrollMenuHeaderDown(s32 a0)
static u32 LoopedTask_ScrollMenuHeaderDown(int a0)
{
switch (a0)
{
@ -468,7 +461,7 @@ u32 LoopedTask_ScrollMenuHeaderDown(s32 a0)
}
}
u32 LoopedTask_ScrollMenuHeaderUp(s32 a0)
static u32 LoopedTask_ScrollMenuHeaderUp(int a0)
{
if (ChangeBgY(0, 384, 2) <= 0)
{
@ -508,7 +501,7 @@ void sub_81C7990(u32 a0, u16 a1)
CpuFill16(a1, gPlttBufferFaded + 0x100 + (a0 * 16), 16 * sizeof(u16));
}
__attribute__((naked))
NAKED
void sub_81C79BC(u16 *a0, u16 *a1, u32 a2, u32 a3, u32 a4, u32 a5)
{
asm(".syntax unified\n\
@ -644,7 +637,7 @@ _081C7AAE:\n\
.syntax divided");
}
void sub_81C7AC0(s32 a0)
void sub_81C7AC0(int a0)
{
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
@ -675,15 +668,15 @@ void sub_81C7B40(void)
BlendPalettes(0xFFFEFFFE, 16, RGB_BLACK);
}
void InitBgTemplates(const struct BgTemplate *templates, s32 count)
void InitBgTemplates(const struct BgTemplate *templates, int count)
{
s32 i;
int i;
for (i = 0; i < count; i++)
InitBgFromTemplate(templates++);
}
void sub_81C7B74(void)
static void sub_81C7B74(void)
{
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
@ -694,12 +687,12 @@ void sub_81C7B74(void)
CopyWindowToVram(structPtr->unk10, 3); // TODO: Use a defined constant here.
}
void sub_81C7BA4(u32 a0)
void sub_81C7BA4(u32 helpBarIndex)
{
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
sub_81C7BF8(structPtr->unk10);
AddTextPrinterParameterized3(structPtr->unk10, 1, 0, 1, gMenuButtonReminderColor, 0, sMenuButtonReminders[a0]);
AddTextPrinterParameterized3(structPtr->unk10, 1, 0, 1, gMenuButtonReminderColor, 0, sHelpBarTexts[helpBarIndex]);
}
bool32 IsDma3ManagerBusyWithBgCopy_(void)
@ -707,15 +700,15 @@ bool32 IsDma3ManagerBusyWithBgCopy_(void)
return IsDma3ManagerBusyWithBgCopy();
}
void sub_81C7BF8(u32 windowId)
static void sub_81C7BF8(u32 windowId)
{
FillWindowPixelBuffer(windowId, PIXEL_FILL(4));
FillWindowPixelRect(windowId, PIXEL_FILL(5), 0, 0, 0x80, 1);
}
void InitPokenavMainMenuResources(void)
static void InitPokenavMainMenuResources(void)
{
s32 i;
int i;
u8 spriteId;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
@ -728,7 +721,7 @@ void InitPokenavMainMenuResources(void)
structPtr->spinningPokenav = &gSprites[spriteId];
}
void CleanupPokenavMainMenuResources(void)
static void CleanupPokenavMainMenuResources(void)
{
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
@ -737,7 +730,7 @@ void CleanupPokenavMainMenuResources(void)
FreeSpritePaletteByTag(0);
}
void SpriteCB_SpinningPokenav(struct Sprite *sprite)
static void SpriteCB_SpinningPokenav(struct Sprite *sprite)
{
// If the background starts scrolling, follow it.
sprite->pos2.y = (GetBgY(0) / 256u) * -1;
@ -763,15 +756,15 @@ void ResumeSpinningPokenavSprite(void)
structPtr->spinningPokenav->subpriority = 0;
}
void InitHoennMapHeaderSprites(void)
static void InitHoennMapHeaderSprites(void)
{
s32 i, spriteId;
int i, spriteId;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
LoadCompressedSpriteSheet(&sPokenavHoennMapLeftHeaderSpriteSheet);
AllocSpritePalette(1);
AllocSpritePalette(2);
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
for (i = 0; i < (int)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
{
spriteId = CreateSprite(&sPokenavLeftHeaderHoennMapSpriteTemplate, 0, 0, 1);
structPtr->leftHeaderSprites[i] = &gSprites[spriteId];
@ -805,7 +798,7 @@ void sub_81C7E14(u32 arg0)
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + 64;
}
void LoadLeftHeaderGfxForMenu(u32 index)
static void LoadLeftHeaderGfxForMenu(u32 index)
{
struct PokenavMainMenuResources *structPtr;
u32 size, tag;
@ -827,7 +820,7 @@ void LoadLeftHeaderGfxForMenu(u32 index)
structPtr->leftHeaderSprites[1]->pos2.x = 64;
}
void LoadLeftHeaderGfxForSubMenu(u32 arg0)
static void LoadLeftHeaderGfxForSubMenu(u32 arg0)
{
u32 size, tag;
@ -866,10 +859,10 @@ void sub_81C7FC4(u32 arg0, bool32 arg1)
void sub_81C7FDC(void)
{
s32 i;
int i;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
for (i = 0; i < (int)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
{
structPtr->leftHeaderSprites[i]->invisible = TRUE;
structPtr->submenuLeftHeaderSprites[i]->invisible = TRUE;
@ -886,9 +879,9 @@ bool32 sub_81C8010(void)
return TRUE;
}
void ShowLeftHeaderSprites(u32 startY, bool32 isOnRightSide)
static void ShowLeftHeaderSprites(u32 startY, bool32 isOnRightSide)
{
s32 start, end, i;
int start, end, i;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
if (!isOnRightSide)
@ -896,16 +889,16 @@ void ShowLeftHeaderSprites(u32 startY, bool32 isOnRightSide)
else
start = 256, end = 160;
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
for (i = 0; i < (int)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
{
structPtr->leftHeaderSprites[i]->pos1.y = startY;
MoveLeftHeader(structPtr->leftHeaderSprites[i], start, end, 12);
}
}
void ShowLeftHeaderSubmenuSprites(u32 startY, bool32 isOnRightSide)
static void ShowLeftHeaderSubmenuSprites(u32 startY, bool32 isOnRightSide)
{
s32 start, end, i;
int start, end, i;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
if (!isOnRightSide)
@ -913,16 +906,16 @@ void ShowLeftHeaderSubmenuSprites(u32 startY, bool32 isOnRightSide)
else
start = 256, end = 192;
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->submenuLeftHeaderSprites); i++)
for (i = 0; i < (int)ARRAY_COUNT(structPtr->submenuLeftHeaderSprites); i++)
{
structPtr->submenuLeftHeaderSprites[i]->pos1.y = startY;
MoveLeftHeader(structPtr->submenuLeftHeaderSprites[i], start, end, 12);
}
}
void HideLeftHeaderSprites(bool32 isOnRightSide)
static void HideLeftHeaderSprites(bool32 isOnRightSide)
{
s32 start, end, i;
int start, end, i;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
if (!isOnRightSide)
@ -930,15 +923,15 @@ void HideLeftHeaderSprites(bool32 isOnRightSide)
else
start = 192, end = 256;
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
for (i = 0; i < (int)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
{
MoveLeftHeader(structPtr->leftHeaderSprites[i], start, end, 12);
}
}
void HideLeftHeaderSubmenuSprites(bool32 isOnRightSide)
static void HideLeftHeaderSubmenuSprites(bool32 isOnRightSide)
{
s32 start, end, i;
int start, end, i;
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
if (!isOnRightSide)
@ -946,13 +939,13 @@ void HideLeftHeaderSubmenuSprites(bool32 isOnRightSide)
else
start = 192, end = 256;
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->submenuLeftHeaderSprites); i++)
for (i = 0; i < (int)ARRAY_COUNT(structPtr->submenuLeftHeaderSprites); i++)
{
MoveLeftHeader(structPtr->submenuLeftHeaderSprites[i], start, end, 12);
}
}
void MoveLeftHeader(struct Sprite *sprite, s32 startX, s32 endX, s32 duration)
static void MoveLeftHeader(struct Sprite *sprite, int startX, int endX, int duration)
{
sprite->pos1.x = startX;
sprite->data[0] = startX * 16;
@ -962,7 +955,7 @@ void MoveLeftHeader(struct Sprite *sprite, s32 startX, s32 endX, s32 duration)
sprite->callback = SpriteCB_MoveLeftHeader;
}
void SpriteCB_MoveLeftHeader(struct Sprite *sprite)
static void SpriteCB_MoveLeftHeader(struct Sprite *sprite)
{
if (sprite->data[2] != 0)
{

View File

@ -1101,7 +1101,7 @@ static void MatchCall_GetMessage_Type4(match_call_t matchCall, u8 *dest)
sub_8197080(dest);
}
void sub_81D1920(const match_call_text_data_t *sub0, u8 *dest)
static void sub_81D1920(const match_call_text_data_t *sub0, u8 *dest)
{
u32 i;
for (i = 0; sub0[i].text != NULL; i++)
@ -1415,7 +1415,7 @@ NAKED const u8 *sub_81D1B40(u32 idx, u32 offset)
}
#endif
s32 sub_81D1BD0(u32 idx)
int sub_81D1BD0(u32 idx)
{
u32 i;
@ -1429,9 +1429,9 @@ s32 sub_81D1BD0(u32 idx)
bool32 sub_81D1BF8(u32 idx)
{
s32 i;
int i;
for (i = 0; i < (s32)ARRAY_COUNT(sMatchCallHeaders); i++)
for (i = 0; i < (int)ARRAY_COUNT(sMatchCallHeaders); i++)
{
u32 r0 = MatchCall_GetRematchTableIdx(i);
if (r0 != REMATCH_TABLE_ENTRIES && r0 == idx)
@ -1442,7 +1442,7 @@ bool32 sub_81D1BF8(u32 idx)
void SetMatchCallRegisteredFlag(void)
{
s32 r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
int r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
if (r0 >= 0)
FlagSet(FLAG_MATCH_CALL_REGISTERED + r0);
}

View File

@ -82,7 +82,6 @@ struct MatchCallListTemplate
extern void sub_81CBD48(u16 windowId, u32 a1);
extern void sub_81DB620(u32 windowId, u32 a1, u32 a2, u32 a3, u32 a4);
extern u8 *sub_81CAFD8(u16 a0, u32 a1);
void sub_81C82E4(struct UnknownSubStruct_81C81D4 *a0);
u32 sub_81C91AC(struct UnknownInnerStruct_81C81D4 *a0, const struct BgTemplate *a1, struct MatchCallListTemplate *a2, s32 a3);

466
src/pokenav_unk_1.c Normal file
View File

@ -0,0 +1,466 @@
#include "global.h"
#include "pokenav.h"
#include "event_data.h"
#include "main.h"
#include "sound.h"
#include "constants/songs.h"
struct Pokenav1Struct
{
u16 menuType;
s16 cursorPos;
u16 descriptionId;
u16 helpBarIndex;
u32 unk8;
u32 (*callback)(struct Pokenav1Struct*);
};
static bool32 sub_81C9814(struct Pokenav1Struct *a0);
static void sub_81C97F8(struct Pokenav1Struct *a0);
static void sub_81C97C0(struct Pokenav1Struct *a0);
static u32 sub_81C97BC(struct Pokenav1Struct *a0);
static void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1);
static u32 sub_81C97A4(struct Pokenav1Struct *a0);
static u32 sub_81C9798(struct Pokenav1Struct *a0);
static u32 sub_81C96FC(struct Pokenav1Struct *a0);
static u32 sub_81C963C(struct Pokenav1Struct *a0);
static u32 sub_81C9600(struct Pokenav1Struct *a0);
static u32 sub_81C9588(struct Pokenav1Struct *a0);
static u32 sub_81C9520(struct Pokenav1Struct *a0);
static u32 sub_81C943C(struct Pokenav1Struct *a0);
static u32 (*sub_81C93EC(void))(struct Pokenav1Struct*);
static void sub_81C939C(struct Pokenav1Struct *state);
static const u8 sLastCursorPositions[] = {2, 3, 4, 2, 5};
static const u8 sDescriptionIds[][6] =
{
{ 0, 1, 4, 4, 4, 4 },
{ 0, 1, 2, 4, 4, 4 },
{ 0, 1, 2, 3, 4, 4 },
{ 5, 6, 7, 4, 4, 4 },
{ 8, 9, 10, 11, 12, 13 },
};
static u8 GetPokenavMainMenuType(void)
{
u8 retVal = 0;
if (FlagGet(FLAG_ADDED_MATCH_CALL_TO_POKENAV))
{
retVal = 1;
if (FlagGet(FLAG_SYS_RIBBON_GET))
retVal = 2;
}
return retVal;
}
bool32 sub_81C9298(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
return FALSE;
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 0;
state->descriptionId = 0;
state->helpBarIndex = 0;
sub_81C939C(state);
return TRUE;
}
bool32 sub_81C92CC(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
return FALSE;
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 2;
state->descriptionId = 2;
state->helpBarIndex = 0;
sub_81C939C(state);
return TRUE;
}
bool32 sub_81C9304(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
return FALSE;
state->menuType = GetPokenavMainMenuType();
state->cursorPos = 3;
state->descriptionId = 3;
sub_81C939C(state);
return TRUE;
}
bool32 sub_81C9338(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
return FALSE;
state->menuType = 3;
state->cursorPos = 0;
state->descriptionId = 5;
state->helpBarIndex = 0;
sub_81C939C(state);
return TRUE;
}
bool32 sub_81C9368(void)
{
struct Pokenav1Struct *state = AllocSubstruct(1, sizeof(struct Pokenav1Struct));
if (!state)
return FALSE;
state->menuType = 4;
state->cursorPos = sub_81C76AC();
state->descriptionId = state->cursorPos + 8;
state->helpBarIndex = 0;
sub_81C939C(state);
return TRUE;
}
static void sub_81C939C(struct Pokenav1Struct *state)
{
switch (state->menuType)
{
case 0:
SetPokenavMode(POKENAV_MODE_NORMAL);
// fallthrough
case 1:
case 2:
state->callback = sub_81C93EC();
break;
case 3:
state->callback = sub_81C963C;
break;
case 4:
state->callback = sub_81C96FC;
break;
}
}
static u32 (*sub_81C93EC(void))(struct Pokenav1Struct*)
{
switch (GetPokenavMode())
{
default:
case POKENAV_MODE_NORMAL:
return sub_81C943C;
case POKENAV_MODE_FORCE_CALL_1:
return sub_81C9520;
case POKENAV_MODE_FORCE_CALL_2:
return sub_81C9588;
}
}
u32 sub_81C941C(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->callback(state);
}
void sub_81C9430(void)
{
FreePokenavSubstruct(1);
}
static u32 sub_81C943C(struct Pokenav1Struct *a0)
{
if (sub_81C9814(a0))
return 1;
if (gMain.newKeys & A_BUTTON)
{
switch (sDescriptionIds[a0->menuType][a0->cursorPos])
{
case 0:
a0->helpBarIndex = gSaveBlock2Ptr->regionMapZoom ? 2 : 1;
sub_81C97B0(a0, POKENAV_MENU_6);
return 8;
case 1:
a0->menuType = 3;
a0->cursorPos = 0;
a0->descriptionId = sDescriptionIds[3][0];
a0->callback = sub_81C963C;
return 2;
case 2:
a0->helpBarIndex = 6;
sub_81C97B0(a0, POKENAV_MENU_B);
return 8;
case 3:
if (CanViewRibbonsMenu())
{
a0->helpBarIndex = 9;
sub_81C97B0(a0, POKENAV_MENU_C);
return 8;
}
else
{
a0->callback = sub_81C9600;
return 6;
}
case 4:
return -1;
}
}
if (gMain.newKeys & B_BUTTON)
return -1;
return 0;
}
static u32 sub_81C9520(struct Pokenav1Struct *a0)
{
if (sub_81C9814(a0))
return 1;
if (gMain.newKeys & A_BUTTON)
{
if (sDescriptionIds[a0->menuType][a0->cursorPos] == 2)
{
a0->helpBarIndex = 6;
sub_81C97B0(a0, POKENAV_MENU_B);
return 8;
}
else
{
PlaySE(SE_HAZURE);
return 0;
}
}
if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_HAZURE);
return 0;
}
return 0;
}
static u32 sub_81C9588(struct Pokenav1Struct *a0)
{
if (sub_81C9814(a0))
return 1;
if (gMain.newKeys & A_BUTTON)
{
u32 v0 = sDescriptionIds[a0->menuType][a0->cursorPos];
if (v0 != 2 && v0 != 4)
{
PlaySE(SE_HAZURE);
return 0;
}
else if (v0 == 2)
{
a0->helpBarIndex = 6;
sub_81C97B0(a0, POKENAV_MENU_B);
return 8;
}
else
{
return -1;
}
}
else if (gMain.newKeys & B_BUTTON)
{
return -1;
}
return 0;
}
static u32 sub_81C9600(struct Pokenav1Struct *a0)
{
if (sub_81C9814(a0))
{
a0->callback = sub_81C93EC();
return 1;
}
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
a0->callback = sub_81C93EC();
return 7;
}
return 0;
}
static u32 sub_81C963C(struct Pokenav1Struct *a0)
{
u32 v0 = sub_81C9814(a0);
if (v0)
return 1;
if (gMain.newKeys & A_BUTTON)
{
switch (sDescriptionIds[a0->menuType][a0->cursorPos])
{
case 6:
a0->menuType = 4;
a0->cursorPos = v0;
a0->descriptionId = sDescriptionIds[4][0];
a0->callback = sub_81C96FC;
return 4;
case 5:
a0->helpBarIndex = v0;
sub_81C97B0(a0, POKENAV_MENU_7);
return 8;
case 7:
PlaySE(SE_SELECT);
sub_81C97C0(a0);
return 3;
}
}
if (gMain.newKeys & B_BUTTON)
{
if (a0->cursorPos != sLastCursorPositions[a0->menuType])
{
a0->cursorPos = sLastCursorPositions[a0->menuType];
a0->callback = sub_81C9798;
return 1;
}
else
{
PlaySE(SE_SELECT);
sub_81C97C0(a0);
return 3;
}
}
return 0;
}
static u32 sub_81C96FC(struct Pokenav1Struct *a0)
{
if (sub_81C9814(a0))
return 1;
if (gMain.newKeys & A_BUTTON)
{
u8 v0 = sDescriptionIds[a0->menuType][a0->cursorPos];
if (v0 != 13)
{
sub_81C7694(v0 - 8);
sub_81C97B0(a0, POKENAV_MENU_8);
a0->helpBarIndex = 3;
return 8;
}
else
{
PlaySE(SE_SELECT);
sub_81C97F8(a0);
return 5;
}
}
if (gMain.newKeys & B_BUTTON)
{
if (a0->cursorPos != sLastCursorPositions[a0->menuType])
{
a0->cursorPos = sLastCursorPositions[a0->menuType];
a0->callback = sub_81C97A4;
return 1;
}
else
{
PlaySE(SE_SELECT);
sub_81C97F8(a0);
return 5;
}
}
return 0;
}
static u32 sub_81C9798(struct Pokenav1Struct *a0)
{
sub_81C97C0(a0);
return 3;
}
static u32 sub_81C97A4(struct Pokenav1Struct *a0)
{
sub_81C97F8(a0);
return 5;
}
static void sub_81C97B0(struct Pokenav1Struct *a0, u32 a1)
{
a0->unk8 = a1;
a0->callback = sub_81C97BC;
}
static u32 sub_81C97BC(struct Pokenav1Struct *a0)
{
return a0->unk8;
}
static void sub_81C97C0(struct Pokenav1Struct *a0)
{
a0->menuType = GetPokenavMainMenuType();
a0->cursorPos = 1;
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
a0->callback = sub_81C943C;
}
static void sub_81C97F8(struct Pokenav1Struct *a0)
{
a0->menuType = 3;
a0->cursorPos = 1;
a0->descriptionId = sDescriptionIds[3][1];
a0->callback = sub_81C963C;
}
static bool32 sub_81C9814(struct Pokenav1Struct *a0)
{
if (gMain.newKeys & DPAD_UP)
{
if (--a0->cursorPos < 0)
a0->cursorPos = sLastCursorPositions[a0->menuType];
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
return TRUE;
}
else if (gMain.newKeys & DPAD_DOWN)
{
a0->cursorPos++;
if (a0->cursorPos > sLastCursorPositions[a0->menuType])
a0->cursorPos = 0;
a0->descriptionId = sDescriptionIds[a0->menuType][a0->cursorPos];
return TRUE;
}
else
{
return FALSE;
}
}
int sub_81C9894(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->menuType;
}
int sub_81C98A4(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->cursorPos;
}
int sub_81C98B4(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->descriptionId;
}
int sub_81C98C4(void)
{
struct Pokenav1Struct *state = GetSubstructPtr(1);
return state->helpBarIndex;
}

503
src/pokenav_unk_3.c Executable file
View File

@ -0,0 +1,503 @@
#include "global.h"
#include "battle_setup.h"
#include "data.h"
#include "event_data.h"
#include "gym_leader_rematch.h"
#include "international_string_util.h"
#include "main.h"
#include "match_call.h"
#include "overworld.h"
#include "pokemon.h"
#include "pokenav.h"
#include "sound.h"
#include "string_util.h"
#include "strings.h"
#include "constants/flags.h"
#include "constants/songs.h"
struct Pokenav3Struct
{
u16 unk0;
u16 unk2;
const u8 *unk4;
u16 unk8;
u16 unkA;
u16 unkC;
u32 unk10;
u32 unk14;
u32 (*callback)(struct Pokenav3Struct*);
struct Pokenav3Struct_Unk1C unk1C[99];
};
static u32 sub_81CAB44(struct Pokenav3Struct *);
static u32 sub_81CABFC(struct Pokenav3Struct *);
static u32 sub_81CAC04(struct Pokenav3Struct *);
static u32 sub_81CACB8(struct Pokenav3Struct *);
static u32 sub_81CACF8(struct Pokenav3Struct *);
static u32 sub_81CAD20(int);
static bool32 sub_81CB1D0(void);
extern const u8 gUnknown_08622508[];
extern const u8 gUnknown_0862250A[];
extern const u8 *const gUnknown_08622028[][4];
bool32 sub_81CAAE8(void)
{
struct Pokenav3Struct *state = AllocSubstruct(5, sizeof(struct Pokenav3Struct));
if (!state)
return FALSE;
state->callback = sub_81CAB44;
state->unk8 = 0;
state->unk10 = 0;
state->unk14 = CreateLoopedTask(sub_81CAD20, 1);
return TRUE;
}
u32 sub_81CAB24(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->callback(state);
}
void sub_81CAB38(void)
{
FreePokenavSubstruct(5);
}
static u32 sub_81CAB44(struct Pokenav3Struct *state)
{
int selectedMatchCall;
if (gMain.newAndRepeatedKeys & DPAD_UP)
return 2;
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
return 1;
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
return 4;
if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
return 3;
if (gMain.newKeys & A_BUTTON)
{
state->callback = sub_81CAC04;
state->unk0 = 0;
selectedMatchCall = GetSelectedMatchCall();
if (!state->unk1C[selectedMatchCall].unk0 || sub_81D17E8(state->unk1C[selectedMatchCall].unk2))
{
state->unk4 = gUnknown_0862250A;
state->unk2 = 2;
}
else
{
state->unk4 = gUnknown_08622508;
state->unk2 = 1;
}
return 5;
}
if (gMain.newKeys & B_BUTTON)
{
if (GetPokenavMode() != POKENAV_MODE_FORCE_CALL_1)
{
state->callback = sub_81CABFC;
return 15;
}
else
{
PlaySE(SE_HAZURE);
}
}
return 0;
}
static u32 sub_81CABFC(struct Pokenav3Struct *state)
{
return POKENAV_MENU_4;
}
static u32 sub_81CAC04(struct Pokenav3Struct *state)
{
if ((gMain.newKeys & DPAD_UP) && state->unk0)
{
state->unk0--;
return 6;
}
if ((gMain.newKeys & DPAD_DOWN) && state->unk0 < state->unk2)
{
state->unk0++;
return 6;
}
if (gMain.newKeys & A_BUTTON)
{
switch (state->unk4[state->unk0])
{
case 2:
state->callback = sub_81CAB44;
return 7;
case 0:
if (GetPokenavMode() == POKENAV_MODE_FORCE_CALL_1)
SetPokenavMode(POKENAV_MODE_FORCE_CALL_2);
state->callback = sub_81CACF8;
if (sub_81CB1D0())
return 9;
return 8;
case 1:
state->callback = sub_81CACB8;
return 11;
}
}
if (gMain.newKeys & B_BUTTON)
{
state->callback = sub_81CAB44;
return 7;
}
return 0;
}
static u32 sub_81CACB8(struct Pokenav3Struct *state)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
return 12;
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
return 13;
if (gMain.newKeys & B_BUTTON)
{
state->callback = sub_81CAB44;
return 14;
}
return 0;
}
static u32 sub_81CACF8(struct Pokenav3Struct *state)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
state->callback = sub_81CAB44;
return 10;
}
return 0;
}
static u32 sub_81CAD20(int taskState)
{
int i, j;
struct Pokenav3Struct *state = GetSubstructPtr(5);
switch (taskState)
{
case 0:
state->unk8 = 0;
state->unkA = 0;
return LT_INC_AND_CONTINUE;
case 1:
for (i = 0, j = state->unk8; i < 30; i++, j++)
{
if (MatchCallFlagGetByIndex(j))
{
state->unk1C[state->unkA].unk2 = j;
state->unk1C[state->unkA].unk0 = 1;
state->unk1C[state->unkA].unk1 = sub_81D16DC(j);
state->unkA++;
}
if (++state->unk8 >= 21) // TODO: This is the size of sMatchCallHeaders
{
state->unkC = state->unk8;
state->unk8 = 0;
return LT_INC_AND_CONTINUE;
}
}
return LT_CONTINUE;
case 2:
for (i = 0, j = state->unk8; i < 30; i++, j++)
{
if (!sub_81D1BF8(state->unk8) && sub_81CAE08(state->unk8))
{
state->unk1C[state->unkA].unk2 = state->unk8;
state->unk1C[state->unkA].unk0 = 0;
state->unk1C[state->unkA].unk1 = sub_81CB0C8(j);
state->unkA++;
}
if (++state->unk8 > REMATCH_TABLE_ENTRIES - 1)
return LT_INC_AND_CONTINUE;
}
return LT_CONTINUE;
case 3:
state->unk10 = 1;
break;
}
return LT_FINISH;
}
bool32 sub_81CAE08(int rematchIndex)
{
if (rematchIndex < REMATCH_TABLE_ENTRIES)
return FlagGet(FLAG_MATCH_CALL_REGISTERED + rematchIndex);
return FALSE;
}
int sub_81CAE28(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unk10;
}
int sub_81CAE38(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unkA;
}
int sub_81CAE48(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unkC;
}
int unref_sub_81CAE58(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unkA - state->unkC;
}
int unref_sub_81CAE6C(int arg0)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
arg0 += state->unkC;
if (arg0 >= state->unkA)
return REMATCH_TABLE_ENTRIES;
return state->unk1C[arg0].unk2;
}
struct Pokenav3Struct_Unk1C *sub_81CAE94(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unk1C;
}
u16 sub_81CAEA4(int index)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unk1C[index].unk1;
}
bool32 sub_81CAEBC(int index)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
if (!state->unk1C[index].unk0)
index = state->unk1C[index].unk2;
else
index = MatchCall_GetRematchTableIdx(state->unk1C[index].unk2);
if (index == REMATCH_TABLE_ENTRIES)
return FALSE;
return gSaveBlock1Ptr->trainerRematches[index] != 0;
}
int sub_81CAF04(int index)
{
int var0;
struct Pokenav3Struct *state = GetSubstructPtr(5);
if (!state->unk1C[index].unk0)
{
index = GetTrainerIdxByRematchIdx(state->unk1C[index].unk2);
return gTrainers[index].trainerPic;
}
var0 = state->unk1C[index].unk2;
index = MatchCall_GetRematchTableIdx(var0);
if (index != REMATCH_TABLE_ENTRIES)
{
index = GetTrainerIdxByRematchIdx(index);
return gTrainers[index].trainerPic;
}
index = sub_81D1BD0(var0);
return gFacilityClassToPicIndex[index];
}
const u8 *sub_81CAF78(int index, u8 *arg1)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
*arg1 = 0;
if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType))
return gText_CallCantBeMadeHere;
if (!state->unk1C[index].unk0)
*arg1 = SelectMatchCallMessage(GetTrainerIdxByRematchIdx(state->unk1C[index].unk2), gStringVar4);
else
MatchCall_GetMessage(state->unk1C[index].unk2, gStringVar4);
return gStringVar4;
}
const u8 *sub_81CAFD8(int index, int textType)
{
int var0;
struct Pokenav3Struct *state = GetSubstructPtr(5);
if (state->unk1C[index].unk0)
{
var0 = MatchCall_GetRematchTableIdx(state->unk1C[index].unk2);
if (var0 == REMATCH_TABLE_ENTRIES)
return sub_81D1B40(state->unk1C[index].unk2, textType);
}
else
{
var0 = state->unk1C[index].unk2;
}
return gUnknown_08622028[var0][textType];
}
u16 sub_81CB01C(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
return state->unk0;
}
u16 sub_81CB02C(int arg0)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
if (state->unk2 < arg0)
return 3;
return state->unk4[arg0];
}
void sub_81CB050(struct Pokenav3Struct_Unk1C *arg0, u8 *str)
{
const u8 *trainerName;
const u8 *className;
if (!arg0->unk0)
{
int index = GetTrainerIdxByRematchIdx(arg0->unk2);
const struct Trainer *trainer = &gTrainers[index];
int class = trainer->trainerClass;
className = gTrainerClassNames[class];
trainerName = trainer->trainerName;
}
else
{
sub_81D1A78(arg0->unk2, &className, &trainerName);
}
if (className && trainerName)
{
u8 *str2 = sub_81DB494(str, 7, className, 69);
sub_81DB494(str2, 7, trainerName, 51);
}
else
{
sub_81DB494(str, 7, NULL, 120);
}
}
int sub_81CB0C8(int rematchIndex)
{
int mapGroup = gRematchTable[rematchIndex].mapGroup;
int mapNum = gRematchTable[rematchIndex].mapNum;
return Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->regionMapSectionId;
}
int sub_81CB0E4(int index)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
int count = 1;
while (++index < state->unkA)
{
if (!state->unk1C[index].unk0)
return count;
if (sub_81D17E8(state->unk1C[index].unk2))
return count;
count++;
}
return 0;
}
int sub_81CB128(int index)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
int count = -1;
while (--index >= 0)
{
if (!state->unk1C[index].unk0)
return count;
if (sub_81D17E8(state->unk1C[index].unk2))
return count;
count--;
}
return 0;
}
bool32 unref_sub_81CB16C(void)
{
int i;
for (i = 0; i < REMATCH_TABLE_ENTRIES; i++)
{
if (sub_81CAE08(i) && gSaveBlock1Ptr->trainerRematches[i])
return TRUE;
}
for (i = 0; i < 21; i++) // TODO: This is the size of sMatchCallHeaders
{
if (MatchCallFlagGetByIndex(i))
{
int index = MatchCall_GetRematchTableIdx(i);
if (gSaveBlock1Ptr->trainerRematches[index])
return TRUE;
}
}
return FALSE;
}
static bool32 sub_81CB1D0(void)
{
struct Pokenav3Struct *state = GetSubstructPtr(5);
int index = GetSelectedMatchCall();
if (!state->unk1C[index].unk0)
{
if (sub_81CAEA4(index) == gMapHeader.regionMapSectionId)
{
if (!gSaveBlock1Ptr->trainerRematches[state->unk1C[index].unk2])
return TRUE;
}
}
else
{
if (state->unk1C[index].unk2 == 11)
{
if (sub_81CAEA4(index) == gMapHeader.regionMapSectionId
&& FlagGet(FLAG_BADGE05_GET) == TRUE)
{
if (!FlagGet(FLAG_WATTSON_REMATCH_AVAILABLE))
return TRUE;
}
}
}
return FALSE;
}

View File

@ -1379,8 +1379,6 @@ static u8 sub_814118C(u16 r0, u16 r1)
}
}
// r7/r8 swap
#ifdef NONMATCHING
static void sub_8141344(u8 taskId)
{
u8 randf;
@ -1412,8 +1410,7 @@ static void sub_8141344(u8 taskId)
g = S16TOPOSFLOAT(g) / 5.0f;
gUnknown_0203AB88->var82 = g * 3;
gUnknown_0203AB88->var84 = g;
gUnknown_0203AB88->var86 = g;
gUnknown_0203AB88->var86 = gUnknown_0203AB88->var84 = g;
gUnknown_0203AB88->var88 = S16TOPOSFLOAT(angles[(rand & 1) + r5]);
gUnknown_0203AB88->var8C = S16TOPOSFLOAT(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var18);
@ -1424,260 +1421,6 @@ static void sub_8141344(u8 taskId)
gUnknown_0203AB88->varA0 = 36.0f;
gTasks[taskId].func = sub_814155C;
}
#else
static const u16 gUnknown_085B6422[4] = {0, 180, 90, 270};
NAKED
static void sub_8141344(u8 taskId)
{
asm_unified(" push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x8\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r10, r0\n\
movs r4, 0\n\
ldr r1, =gUnknown_085B6422\n\
mov r0, sp\n\
movs r2, 0x8\n\
bl memcpy\n\
bl Random\n\
lsls r0, 16\n\
lsrs r7, r0, 16\n\
adds r0, r7, 0\n\
movs r1, 0x64\n\
bl __umodsi3\n\
lsls r0, 16\n\
lsrs r6, r0, 16\n\
ldr r3, =gUnknown_0203AB88\n\
ldr r0, [r3]\n\
ldr r2, =gTasks\n\
mov r5, r10\n\
lsls r1, r5, 2\n\
add r1, r10\n\
lsls r1, 3\n\
adds r1, r2\n\
ldrh r2, [r1, 0x14]\n\
adds r0, 0x7C\n\
strb r2, [r0]\n\
ldr r0, [r3]\n\
adds r2, r0, 0\n\
adds r2, 0x7F\n\
strb r4, [r2]\n\
subs r2, 0x1\n\
strb r4, [r2]\n\
adds r0, 0x7D\n\
strb r4, [r0]\n\
ldrh r0, [r1, 0x18]\n\
adds r1, r7, 0\n\
bl sub_814118C\n\
adds r4, r0, 0\n\
lsls r4, 24\n\
lsrs r1, r4, 24\n\
adds r0, r7, 0\n\
bl __modsi3\n\
lsrs r4, 25\n\
subs r0, r4\n\
lsls r0, 24\n\
lsrs r4, r0, 24\n\
ldr r0, =gLocalTime\n\
ldrb r0, [r0, 0x2]\n\
lsls r0, 24\n\
asrs r0, 24\n\
movs r5, 0x1\n\
cmp r0, 0xC\n\
bgt _081413C8\n\
movs r5, 0\n\
_081413C8:\n\
cmp r6, 0x4F\n\
bhi _081413E0\n\
lsls r0, r5, 25\n\
b _081413EA\n\
.pool\n\
_081413E0:\n\
lsls r1, r5, 24\n\
asrs r1, 24\n\
movs r0, 0x1\n\
subs r0, r1\n\
lsls r0, 25\n\
_081413EA:\n\
lsrs r5, r0, 24\n\
ldr r0, _08141530 @ =gUnknown_0203AB88\n\
ldr r6, [r0]\n\
ldrb r0, [r6, 0x4]\n\
lsls r0, 30\n\
lsrs r0, 25\n\
ldr r1, _08141534 @ =gUnknown_085B6348\n\
adds r0, r1\n\
lsls r4, 24\n\
asrs r4, 24\n\
ldrh r0, [r0, 0x1A]\n\
adds r4, r0\n\
adds r0, r6, 0\n\
adds r0, 0x80\n\
strh r4, [r0]\n\
lsls r4, 16\n\
asrs r4, 16\n\
adds r0, r4, 0\n\
bl __floatsisf\n\
cmp r4, 0\n\
bge _0814141C\n\
ldr r1, _08141538 @ =0x47800000\n\
bl __addsf3\n\
_0814141C:\n\
ldr r1, _0814153C @ =0x40A00000\n\
bl __divsf3\n\
bl __fixunssfsi\n\
lsls r0, 16\n\
lsrs r4, r0, 16\n\
lsls r0, r4, 1\n\
adds r0, r4\n\
movs r2, 0x82\n\
adds r2, r6\n\
mov r8, r2\n\
strh r0, [r2]\n\
adds r0, r6, 0\n\
adds r0, 0x84\n\
strh r4, [r0]\n\
adds r0, 0x2\n\
strh r4, [r0]\n\
movs r0, 0x88\n\
adds r0, r6\n\
mov r9, r0\n\
movs r0, 0x1\n\
ands r0, r7\n\
lsls r1, r5, 24\n\
asrs r1, 24\n\
adds r0, r1\n\
lsls r0, 1\n\
add r0, sp\n\
movs r1, 0\n\
ldrsh r4, [r0, r1]\n\
adds r0, r4, 0\n\
bl __floatsisf\n\
cmp r4, 0\n\
bge _08141468\n\
ldr r1, _08141538 @ =0x47800000\n\
bl __addsf3\n\
_08141468:\n\
mov r2, r9\n\
str r0, [r2]\n\
adds r7, r6, 0\n\
adds r7, 0x8C\n\
ldrb r0, [r6, 0x4]\n\
lsls r0, 30\n\
lsrs r0, 25\n\
ldr r5, _08141534 @ =gUnknown_085B6348\n\
adds r0, r5\n\
movs r1, 0x18\n\
ldrsh r4, [r0, r1]\n\
adds r0, r4, 0\n\
bl __floatsisf\n\
adds r5, r0, 0\n\
cmp r4, 0\n\
bge _08141492\n\
ldr r1, _08141538 @ =0x47800000\n\
bl __addsf3\n\
adds r5, r0, 0\n\
_08141492:\n\
str r5, [r7]\n\
adds r7, r6, 0\n\
adds r7, 0x90\n\
ldr r1, _08141540 @ =0x3F000000\n\
adds r0, r5, 0\n\
bl __mulsf3\n\
adds r1, r5, 0\n\
bl __subsf3\n\
adds r5, r0, 0\n\
mov r2, r8\n\
movs r0, 0\n\
ldrsh r4, [r2, r0]\n\
adds r0, r4, 0\n\
bl __floatsisf\n\
adds r2, r0, 0\n\
cmp r4, 0\n\
bge _081414C2\n\
ldr r1, _08141538 @ =0x47800000\n\
bl __addsf3\n\
adds r2, r0, 0\n\
_081414C2:\n\
adds r0, r5, 0\n\
adds r1, r2, 0\n\
bl __divsf3\n\
str r0, [r7]\n\
adds r1, r6, 0\n\
adds r1, 0x94\n\
ldr r0, _08141544 @ =0x42880000\n\
str r0, [r1]\n\
adds r1, 0x8\n\
ldr r0, _08141548 @ =0x00000000\n\
str r0, [r1]\n\
adds r5, r6, 0\n\
adds r5, 0x98\n\
mov r1, r8\n\
movs r2, 0\n\
ldrsh r4, [r1, r2]\n\
adds r0, r4, 0\n\
bl __floatsisf\n\
adds r2, r0, 0\n\
cmp r4, 0\n\
bge _081414F8\n\
ldr r1, _08141538 @ =0x47800000\n\
bl __addsf3\n\
adds r2, r0, 0\n\
_081414F8:\n\
ldr r0, _0814154C @ =0x41000000\n\
adds r1, r2, 0\n\
bl __divsf3\n\
bl __negsf2\n\
str r0, [r5]\n\
adds r1, r6, 0\n\
adds r1, 0xA0\n\
ldr r0, _08141550 @ =0x42100000\n\
str r0, [r1]\n\
ldr r1, _08141554 @ =gTasks\n\
mov r5, r10\n\
lsls r0, r5, 2\n\
add r0, r10\n\
lsls r0, 3\n\
adds r0, r1\n\
ldr r1, _08141558 @ =sub_814155C\n\
str r1, [r0]\n\
add sp, 0x8\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\
.align 2, 0\n\
_08141530:\n\
.4byte gUnknown_0203AB88\n\
_08141534:\n\
.4byte gUnknown_085B6348\n\
_08141538:\n\
.4byte 0x47800000\n\
_0814153C:\n\
.4byte 0x40A00000\n\
_08141540:\n\
.4byte 0x3F000000\n\
_08141544:\n\
.4byte 0x42880000\n\
_08141548:\n\
.4byte 0x00000000\n\
_0814154C:\n\
.4byte 0x41000000\n\
_08141550:\n\
.4byte 0x42100000\n\
_08141554:\n\
.4byte gTasks\n\
_08141558:\n\
.4byte sub_814155C");
}
#endif // NONMATCHING
static void sub_814155C(u8 taskId)
{
@ -4345,17 +4088,17 @@ static void sub_81448B8(struct Sprite *sprite)
gUnknown_0203AB88->var38 = sprite;
}
#ifdef NONMATCHING
static void sub_8144A24(struct Sprite *sprite)
{
u8 z;
u16 o;
u8 h = 0; // r10 (sp+0xc)
u8 j = 5; // r9 (r9)
u8 p = 0; // sp+0xc (sp+0x10)
u8 i;
u8 s[10] = {}; // sp+0 (sp+0)
u16 t = Random(); // sp+0x10 (r10)
u8 h = 0;
u8 j = 5;
u8 p = 0;
u8 i = 0;
u8 val;
u8 s[10] = {};
u16 rand = Random();
gUnknown_0203AB88->var7D = 1;
gUnknown_0203AB88->var03_5 = TRUE;
@ -4364,13 +4107,14 @@ static void sub_8144A24(struct Sprite *sprite)
gUnknown_0203AB88->var88 = sprite->data[3];
gUnknown_0203AB88->var98 = 0.0f;
gUnknown_0203AB88->var8C = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1C;
o = (gUnknown_0203AB88->var04_0 * 30 + 33) + (0x1 - gUnknown_0203AB88->var03_0) * 15;
for (i = 0; i < 4; i++)
{
if (o < sprite->data[3] && sprite->data[3] <= o + 90)
{
sprite->data[0] = i / 2;
gUnknown_0203AB88->var03_0 = i & 1;
gUnknown_0203AB88->var03_0 = i % 2;
break;
}
if (i == 3)
@ -4381,354 +4125,52 @@ static void sub_8144A24(struct Sprite *sprite)
}
o += 90;
}
if (gUnknown_0203AB88->var03_0)
{
if (sprite->data[0])
{
PlayCry1(SPECIES_TAILLOW, -63);
}
else
{
PlayCry1(SPECIES_TAILLOW, 63);
}
}
else
{
PlayCry1(SPECIES_SHROOMISH, -63);
}
i = 2;
val = 2;
z = (gUnknown_0203AB88->var7F + 2) % 12;
if (gUnknown_0203AB88->var03_0 == 1 && gUnknown_0203AB88->var04_0 == 1)
j += 6;
else
j += i;
for (; i < j; i++)
j += val;
for (i = val; i < j; i++)
{
if (!(gUnknown_0203AB88->var08 & gUnknown_085B62E4[z].var04))
{
s[h++] = i;
if (!p && (gUnknown_085B62E4[z].var04 & gUnknown_085B6154[gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]].var00))
{
if (p == 0 && (gUnknown_085B62E4[z].var04 & gUnknown_085B6154[gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]].var0C))
p = i;
}
}
z = (z + 1) % 0xC;
}
if ((gUnknown_0203AB88->var03_0 + 1) & gUnknown_0203AB88->var02)
{
if (p && (t & 0xFF) < 0xc0)
{
if (p && (rand & 0xFF) < 0xc0)
sprite->data[7] = p;
}
else
{
sprite->data[7] = s[t % h];
}
sprite->data[7] = s[rand % h];
}
else
{
sprite->data[7] = s[t % h];
sprite->data[7] = s[rand % h];
}
sprite->callback = sub_8144168;
}
#else
NAKED
static void sub_8144A24(struct Sprite *sprite)
{
asm_unified("push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x14\n\
adds r7, r0, 0\n\
movs r0, 0\n\
mov r9, r0\n\
movs r1, 0x5\n\
mov r8, r1\n\
str r0, [sp, 0xC]\n\
mov r0, sp\n\
movs r1, 0\n\
movs r2, 0xA\n\
bl memset\n\
bl Random\n\
lsls r0, 16\n\
lsrs r0, 16\n\
str r0, [sp, 0x10]\n\
ldr r3, _08144B10 @ =gUnknown_0203AB88\n\
ldr r0, [r3]\n\
adds r0, 0x7D\n\
movs r5, 0x1\n\
strb r5, [r0]\n\
ldr r2, [r3]\n\
ldrb r0, [r2, 0x3]\n\
movs r1, 0x20\n\
orrs r0, r1\n\
strb r0, [r2, 0x3]\n\
ldr r2, [r3]\n\
ldrb r1, [r2, 0x3]\n\
movs r0, 0x41\n\
negs r0, r0\n\
ands r0, r1\n\
strb r0, [r2, 0x3]\n\
ldr r0, [r3]\n\
adds r0, 0x7E\n\
movs r1, 0xFF\n\
strb r1, [r0]\n\
ldr r6, [r3]\n\
adds r4, r6, 0\n\
adds r4, 0x88\n\
movs r1, 0x34\n\
ldrsh r0, [r7, r1]\n\
bl __floatsisf\n\
str r0, [r4]\n\
adds r1, r6, 0\n\
adds r1, 0x98\n\
ldr r0, _08144B14 @ =0x00000000\n\
str r0, [r1]\n\
adds r2, r6, 0\n\
adds r2, 0x8C\n\
ldr r1, _08144B18 @ =gUnknown_085B6348\n\
ldrb r0, [r6, 0x4]\n\
lsls r0, 30\n\
lsrs r0, 25\n\
adds r1, 0x1C\n\
adds r0, r1\n\
ldr r0, [r0]\n\
str r0, [r2]\n\
ldrb r0, [r6, 0x4]\n\
lsls r0, 30\n\
lsrs r0, 30\n\
lsls r1, r0, 4\n\
subs r1, r0\n\
lsls r1, 1\n\
adds r1, 0x21\n\
ldrb r0, [r6, 0x3]\n\
lsls r0, 27\n\
lsrs r0, 27\n\
subs r5, r0\n\
lsls r0, r5, 4\n\
subs r0, r5\n\
adds r1, r0\n\
lsls r1, 16\n\
lsrs r1, 16\n\
mov r5, r9\n\
movs r0, 0x34\n\
ldrsh r2, [r7, r0]\n\
_08144ACA:\n\
cmp r1, r2\n\
bge _08144AD6\n\
adds r0, r1, 0\n\
adds r0, 0x5A\n\
cmp r2, r0\n\
ble _08144B38\n\
_08144AD6:\n\
cmp r5, 0x3\n\
beq _08144B1C\n\
adds r0, r1, 0\n\
adds r0, 0x5A\n\
lsls r0, 16\n\
lsrs r1, r0, 16\n\
adds r0, r5, 0x1\n\
lsls r0, 24\n\
lsrs r5, r0, 24\n\
cmp r5, 0x3\n\
bls _08144ACA\n\
_08144AEC:\n\
ldr r0, _08144B10 @ =gUnknown_0203AB88\n\
ldr r0, [r0]\n\
ldrb r1, [r0, 0x3]\n\
movs r0, 0x1F\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _08144B64\n\
movs r1, 0x2E\n\
ldrsh r0, [r7, r1]\n\
cmp r0, 0\n\
beq _08144B58\n\
movs r0, 0x98\n\
lsls r0, 1\n\
movs r1, 0x3F\n\
negs r1, r1\n\
bl PlayCry1\n\
b _08144B70\n\
.align 2, 0\n\
_08144B10:\n\
.4byte gUnknown_0203AB88\n\
_08144B14:\n\
.4byte 0x00000000\n\
_08144B18:\n\
.4byte gUnknown_085B6348\n\
_08144B1C:\n\
movs r0, 0x1\n\
strh r0, [r7, 0x2E]\n\
ldr r0, =gUnknown_0203AB88\n\
ldr r2, [r0]\n\
ldrb r1, [r2, 0x3]\n\
movs r0, 0x20\n\
negs r0, r0\n\
ands r0, r1\n\
movs r1, 0x1\n\
orrs r0, r1\n\
strb r0, [r2, 0x3]\n\
b _08144AEC\n\
.pool\n\
_08144B38:\n\
lsrs r0, r5, 1\n\
strh r0, [r7, 0x2E]\n\
ldr r0, =gUnknown_0203AB88\n\
ldr r3, [r0]\n\
movs r1, 0x1\n\
ands r1, r5\n\
ldrb r2, [r3, 0x3]\n\
movs r0, 0x20\n\
negs r0, r0\n\
ands r0, r2\n\
orrs r0, r1\n\
strb r0, [r3, 0x3]\n\
b _08144AEC\n\
.pool\n\
_08144B58:\n\
movs r0, 0x98\n\
lsls r0, 1\n\
movs r1, 0x3F\n\
bl PlayCry1\n\
b _08144B70\n\
_08144B64:\n\
movs r0, 0x99\n\
lsls r0, 1\n\
movs r1, 0x3F\n\
negs r1, r1\n\
bl PlayCry1\n\
_08144B70:\n\
movs r0, 0x2\n\
mov r10, r0\n\
ldr r4, =gUnknown_0203AB88\n\
ldr r5, [r4]\n\
adds r0, r5, 0\n\
adds r0, 0x7F\n\
ldrb r0, [r0]\n\
adds r0, 0x2\n\
movs r1, 0xC\n\
bl __modsi3\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
ldrb r1, [r5, 0x3]\n\
movs r0, 0x1F\n\
ands r0, r1\n\
cmp r0, 0x1\n\
bne _08144BA8\n\
ldrb r1, [r5, 0x4]\n\
movs r0, 0x3\n\
ands r0, r1\n\
cmp r0, 0x1\n\
bne _08144BA8\n\
mov r0, r8\n\
adds r0, 0x6\n\
b _08144BAC\n\
.pool\n\
_08144BA8:\n\
mov r0, r8\n\
add r0, r10\n\
_08144BAC:\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
mov r5, r10\n\
cmp r5, r8\n\
bcs _08144C18\n\
ldr r1, =gUnknown_085B6154+0xC\n\
mov r10, r1\n\
_08144BBC:\n\
ldr r3, [r4]\n\
lsls r0, r6, 3\n\
ldr r1, =gUnknown_085B62E4+0x4\n\
adds r0, r1\n\
ldr r1, [r3, 0x8]\n\
ldr r2, [r0]\n\
ands r1, r2\n\
cmp r1, 0\n\
bne _08144C02\n\
mov r0, r9\n\
adds r1, r0, 0x1\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r9, r1\n\
add r0, sp\n\
strb r5, [r0]\n\
ldr r0, [sp, 0xC]\n\
cmp r0, 0\n\
bne _08144C02\n\
ldrb r1, [r3, 0x1A]\n\
lsls r1, 28\n\
lsrs r1, 28\n\
adds r0, r3, 0\n\
adds r0, 0x1B\n\
adds r0, r1\n\
ldrb r1, [r0]\n\
lsls r0, r1, 2\n\
adds r0, r1\n\
lsls r0, 2\n\
add r0, r10\n\
ldr r0, [r0]\n\
ands r2, r0\n\
cmp r2, 0\n\
beq _08144C02\n\
str r5, [sp, 0xC]\n\
_08144C02:\n\
adds r0, r6, 0x1\n\
movs r1, 0xC\n\
bl __modsi3\n\
lsls r0, 24\n\
lsrs r6, r0, 24\n\
adds r0, r5, 0x1\n\
lsls r0, 24\n\
lsrs r5, r0, 24\n\
cmp r5, r8\n\
bcc _08144BBC\n\
_08144C18:\n\
ldr r0, [r4]\n\
ldrb r1, [r0, 0x3]\n\
lsls r1, 27\n\
lsrs r1, 27\n\
adds r1, 0x1\n\
ldrb r0, [r0, 0x2]\n\
ands r1, r0\n\
cmp r1, 0\n\
beq _08144C48\n\
ldr r1, [sp, 0xC]\n\
cmp r1, 0\n\
beq _08144C48\n\
movs r0, 0xFF\n\
ldr r1, [sp, 0x10]\n\
ands r0, r1\n\
cmp r0, 0xBF\n\
bhi _08144C48\n\
mov r0, sp\n\
ldrh r0, [r0, 0xC]\n\
b _08144C54\n\
.pool\n\
_08144C48:\n\
ldr r0, [sp, 0x10]\n\
mov r1, r9\n\
bl __modsi3\n\
add r0, sp\n\
ldrb r0, [r0]\n\
_08144C54:\n\
strh r0, [r7, 0x3C]\n\
ldr r1, =sub_8144168\n\
str r1, [r7, 0x1C]\n\
add sp, 0x14\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\
.pool");
}
#endif // NONMATCHING
static const u16 gUnknown_085B7B1A[] = {
0x907,

View File

@ -1405,479 +1405,71 @@ void sub_8107CC4(u8 taskId)
}
}
#ifdef NONMATCHING
void sub_8107D58(u8 taskId)
{
s16 i;
struct ScanlineEffectParams params;
struct Task *task = &gTasks[taskId];
// u16 *scanlineBuffer;
switch (task->data[0])
{
case 0:
for (i = 0; i < task->data[4]; i++)
{
/* scanlineBuffer = &gScanlineEffectRegBuffers[0][i];
*(u16 *)(&gScanlineEffect) = task->data[2];
*scanlineBuffer = task->data[2] & -1; */
gScanlineEffectRegBuffers[1][i] = task->data[2];
gScanlineEffectRegBuffers[0][i] = (u16)((int)(task->data[2] & 0xFFFF));
}
for (i = task->data[4]; i < task->data[5]; i++)
{
gScanlineEffectRegBuffers[1][i] = task->data[1];
gScanlineEffectRegBuffers[0][i] = (u16)((int)(task->data[1] & 0xFFFF));
}
for (i = task->data[5]; i < 160; i++)
{
gScanlineEffectRegBuffers[1][i] = task->data[2];
gScanlineEffectRegBuffers[0][i] = (u16)((int)(task->data[2] & 0xFFFF));
}
if (task->data[4] == 0)
{
gScanlineEffectRegBuffers[1][i] = task->data[1];
gScanlineEffectRegBuffers[0][i] = task->data[1];
}
else
{
gScanlineEffectRegBuffers[1][i] = task->data[2];
gScanlineEffectRegBuffers[0][i] = task->data[2];
}
params.dmaDest = (vu16 *)REG_ADDR_BLDALPHA;
params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
params.initState = 1;
params.unused9 = 0;
ScanlineEffect_SetParams(params);
task->data[0]++;
break;
case 1:
if (task->data[3] == 0)
{
if (--task->data[4] <= 0)
{
task->data[4] = 0;
task->data[0]++;
}
}
else if (++task->data[5] > 111)
case 0:
for (i = 0; i < task->data[4]; i++)
gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[1][i] = task->data[2];
for (i = task->data[4]; i < task->data[5]; i++)
gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[1][i] = task->data[1];
for (i = task->data[5]; i < 160; i++)
gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[1][i] = task->data[2];
if (task->data[4] == 0)
gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[1][i] = task->data[1];
else
gScanlineEffectRegBuffers[0][i] = gScanlineEffectRegBuffers[1][i] = task->data[2];
params.dmaDest = (vu16 *)REG_ADDR_BLDALPHA;
params.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
params.initState = 1;
params.unused9 = 0;
ScanlineEffect_SetParams(params);
task->data[0]++;
break;
case 1:
if (task->data[3] == 0)
{
if (--task->data[4] <= 0)
{
task->data[4] = 0;
task->data[0]++;
}
for (i = 0; i < task->data[4]; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
}
for (i = task->data[4]; i < task->data[5]; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[1];
}
for (i = task->data[5]; i < 160; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
}
break;
case 2:
for (i = 0; i < task->data[4]; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
}
for (i = task->data[4]; i < task->data[5]; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[1];
}
for (i = task->data[5]; i < 160; i++)
{
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
}
if (task->data[15] == -1)
{
ScanlineEffect_Stop();
DestroyTask(taskId);
}
break;
}
else if (++task->data[5] > 111)
{
task->data[0]++;
}
for (i = 0; i < task->data[4]; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
for (i = task->data[4]; i < task->data[5]; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[1];
for (i = task->data[5]; i < 160; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
break;
case 2:
for (i = 0; i < task->data[4]; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
for (i = task->data[4]; i < task->data[5]; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[1];
for (i = task->data[5]; i < 160; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = task->data[2];
if (task->data[15] == -1)
{
ScanlineEffect_Stop();
DestroyTask(taskId);
}
break;
}
}
#else
NAKED
void sub_8107D58(u8 taskId)
{
asm_unified("push {r4-r7,lr}\n\
sub sp, 0xC\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
lsls r0, r7, 2\n\
adds r0, r7\n\
lsls r0, 3\n\
ldr r1, =gTasks\n\
adds r4, r0, r1\n\
movs r1, 0x8\n\
ldrsh r0, [r4, r1]\n\
cmp r0, 0x1\n\
bne _08107D74\n\
b _08107EAC\n\
_08107D74:\n\
cmp r0, 0x1\n\
bgt _08107D84\n\
cmp r0, 0\n\
beq _08107D8C\n\
b _08108022\n\
.pool\n\
_08107D84:\n\
cmp r0, 0x2\n\
bne _08107D8A\n\
b _08107F78\n\
_08107D8A:\n\
b _08108022\n\
_08107D8C:\n\
movs r3, 0\n\
movs r2, 0x10\n\
ldrsh r0, [r4, r2]\n\
ldr r1, =gScanlineEffectRegBuffers\n\
mov r12, r1\n\
cmp r3, r0\n\
bge _08107DCA\n\
mov r7, r12\n\
movs r5, 0xF0\n\
lsls r5, 3\n\
add r5, r12\n\
ldr r6, =0x0000ffff\n\
_08107DA4:\n\
lsls r2, r3, 16\n\
asrs r2, 16\n\
lsls r1, r2, 1\n\
adds r3, r1, r7\n\
adds r1, r5\n\
ldrh r0, [r4, 0xC]\n\
strh r0, [r1]\n\
ldrh r1, [r4, 0xC]\n\
adds r0, r6, 0\n\
ands r0, r1\n\
strh r0, [r3]\n\
adds r2, 0x1\n\
lsls r2, 16\n\
lsrs r3, r2, 16\n\
asrs r2, 16\n\
movs r1, 0x10\n\
ldrsh r0, [r4, r1]\n\
cmp r2, r0\n\
blt _08107DA4\n\
_08107DCA:\n\
ldrh r3, [r4, 0x10]\n\
lsls r2, r3, 16\n\
asrs r1, r2, 16\n\
movs r3, 0x12\n\
ldrsh r0, [r4, r3]\n\
cmp r1, r0\n\
bge _08107E04\n\
ldr r5, =gScanlineEffectRegBuffers\n\
movs r0, 0xF0\n\
lsls r0, 3\n\
adds r6, r5, r0\n\
ldr r7, =0x0000ffff\n\
_08107DE2:\n\
asrs r2, 16\n\
lsls r1, r2, 1\n\
adds r3, r1, r5\n\
adds r1, r6\n\
ldrh r0, [r4, 0xA]\n\
strh r0, [r1]\n\
ldrh r1, [r4, 0xA]\n\
adds r0, r7, 0\n\
ands r0, r1\n\
strh r0, [r3]\n\
adds r2, 0x1\n\
lsls r2, 16\n\
asrs r1, r2, 16\n\
movs r3, 0x12\n\
ldrsh r0, [r4, r3]\n\
cmp r1, r0\n\
blt _08107DE2\n\
_08107E04:\n\
ldrh r3, [r4, 0x12]\n\
lsls r2, r3, 16\n\
asrs r0, r2, 16\n\
cmp r0, 0x9F\n\
bgt _08107E3A\n\
ldr r5, =gScanlineEffectRegBuffers\n\
movs r0, 0xF0\n\
lsls r0, 3\n\
adds r6, r5, r0\n\
ldr r7, =0x0000ffff\n\
_08107E18:\n\
asrs r2, 16\n\
lsls r1, r2, 1\n\
adds r3, r1, r5\n\
adds r1, r6\n\
ldrh r0, [r4, 0xC]\n\
strh r0, [r1]\n\
ldrh r1, [r4, 0xC]\n\
adds r0, r7, 0\n\
ands r0, r1\n\
strh r0, [r3]\n\
adds r2, 0x1\n\
lsls r2, 16\n\
lsrs r3, r2, 16\n\
lsls r2, r3, 16\n\
asrs r0, r2, 16\n\
cmp r0, 0x9F\n\
ble _08107E18\n\
_08107E3A:\n\
movs r1, 0x10\n\
ldrsh r0, [r4, r1]\n\
cmp r0, 0\n\
bne _08107E64\n\
lsls r0, r3, 16\n\
asrs r0, 15\n\
mov r3, r12\n\
adds r2, r0, r3\n\
movs r1, 0xF0\n\
lsls r1, 3\n\
add r1, r12\n\
adds r0, r1\n\
ldrh r1, [r4, 0xA]\n\
strh r1, [r0]\n\
ldrh r0, [r4, 0xA]\n\
b _08107E7A\n\
.pool\n\
_08107E64:\n\
lsls r0, r3, 16\n\
asrs r0, 15\n\
mov r1, r12\n\
adds r2, r0, r1\n\
movs r1, 0xF0\n\
lsls r1, 3\n\
add r1, r12\n\
adds r0, r1\n\
ldrh r1, [r4, 0xC]\n\
strh r1, [r0]\n\
ldrh r0, [r4, 0xC]\n\
_08107E7A:\n\
strh r0, [r2]\n\
ldr r0, =0x04000052\n\
str r0, [sp]\n\
ldr r0, =0xa2600001\n\
str r0, [sp, 0x4]\n\
mov r1, sp\n\
movs r2, 0\n\
movs r0, 0x1\n\
strb r0, [r1, 0x8]\n\
mov r0, sp\n\
strb r2, [r0, 0x9]\n\
ldr r0, [sp]\n\
ldr r1, [sp, 0x4]\n\
ldr r2, [sp, 0x8]\n\
bl ScanlineEffect_SetParams\n\
ldrh r0, [r4, 0x8]\n\
adds r0, 0x1\n\
strh r0, [r4, 0x8]\n\
b _08108022\n\
.pool\n\
_08107EAC:\n\
movs r2, 0xE\n\
ldrsh r1, [r4, r2]\n\
cmp r1, 0\n\
bne _08107EC4\n\
ldrh r0, [r4, 0x10]\n\
subs r0, 0x1\n\
strh r0, [r4, 0x10]\n\
lsls r0, 16\n\
cmp r0, 0\n\
bgt _08107ED8\n\
strh r1, [r4, 0x10]\n\
b _08107ED2\n\
_08107EC4:\n\
ldrh r0, [r4, 0x12]\n\
adds r0, 0x1\n\
strh r0, [r4, 0x12]\n\
lsls r0, 16\n\
asrs r0, 16\n\
cmp r0, 0x6F\n\
ble _08107ED8\n\
_08107ED2:\n\
ldrh r0, [r4, 0x8]\n\
adds r0, 0x1\n\
strh r0, [r4, 0x8]\n\
_08107ED8:\n\
movs r3, 0\n\
movs r1, 0x10\n\
ldrsh r0, [r4, r1]\n\
cmp r3, r0\n\
bge _08107F0C\n\
ldr r6, =gScanlineEffectRegBuffers\n\
ldr r5, =gScanlineEffect\n\
_08107EE6:\n\
lsls r1, r3, 16\n\
asrs r1, 16\n\
lsls r3, r1, 1\n\
ldrb r2, [r5, 0x14]\n\
lsls r0, r2, 4\n\
subs r0, r2\n\
lsls r0, 7\n\
adds r3, r0\n\
adds r3, r6\n\
ldrh r0, [r4, 0xC]\n\
strh r0, [r3]\n\
adds r1, 0x1\n\
lsls r1, 16\n\
lsrs r3, r1, 16\n\
asrs r1, 16\n\
movs r2, 0x10\n\
ldrsh r0, [r4, r2]\n\
cmp r1, r0\n\
blt _08107EE6\n\
_08107F0C:\n\
ldrh r3, [r4, 0x10]\n\
lsls r2, r3, 16\n\
asrs r1, r2, 16\n\
movs r3, 0x12\n\
ldrsh r0, [r4, r3]\n\
cmp r1, r0\n\
bge _08107F40\n\
ldr r6, =gScanlineEffectRegBuffers\n\
ldr r5, =gScanlineEffect\n\
_08107F1E:\n\
asrs r3, r2, 16\n\
lsls r2, r3, 1\n\
ldrb r1, [r5, 0x14]\n\
lsls r0, r1, 4\n\
subs r0, r1\n\
lsls r0, 7\n\
adds r2, r0\n\
adds r2, r6\n\
ldrh r0, [r4, 0xA]\n\
strh r0, [r2]\n\
adds r3, 0x1\n\
lsls r2, r3, 16\n\
asrs r1, r2, 16\n\
movs r3, 0x12\n\
ldrsh r0, [r4, r3]\n\
cmp r1, r0\n\
blt _08107F1E\n\
_08107F40:\n\
ldrh r3, [r4, 0x12]\n\
lsls r1, r3, 16\n\
asrs r0, r1, 16\n\
cmp r0, 0x9F\n\
bgt _08108022\n\
ldr r6, =gScanlineEffectRegBuffers\n\
ldr r5, =gScanlineEffect\n\
_08107F4E:\n\
asrs r3, r1, 16\n\
lsls r2, r3, 1\n\
ldrb r1, [r5, 0x14]\n\
lsls r0, r1, 4\n\
subs r0, r1\n\
lsls r0, 7\n\
adds r2, r0\n\
adds r2, r6\n\
ldrh r0, [r4, 0xC]\n\
strh r0, [r2]\n\
adds r3, 0x1\n\
lsls r1, r3, 16\n\
asrs r0, r1, 16\n\
cmp r0, 0x9F\n\
ble _08107F4E\n\
b _08108022\n\
.pool\n\
_08107F78:\n\
movs r3, 0\n\
movs r1, 0x10\n\
ldrsh r0, [r4, r1]\n\
cmp r3, r0\n\
bge _08107FAC\n\
ldr r6, =gScanlineEffectRegBuffers\n\
ldr r5, =gScanlineEffect\n\
_08107F86:\n\
lsls r1, r3, 16\n\
asrs r1, 16\n\
lsls r3, r1, 1\n\
ldrb r2, [r5, 0x14]\n\
lsls r0, r2, 4\n\
subs r0, r2\n\
lsls r0, 7\n\
adds r3, r0\n\
adds r3, r6\n\
ldrh r0, [r4, 0xC]\n\
strh r0, [r3]\n\
adds r1, 0x1\n\
lsls r1, 16\n\
lsrs r3, r1, 16\n\
asrs r1, 16\n\
movs r2, 0x10\n\
ldrsh r0, [r4, r2]\n\
cmp r1, r0\n\
blt _08107F86\n\
_08107FAC:\n\
ldrh r3, [r4, 0x10]\n\
lsls r2, r3, 16\n\
asrs r1, r2, 16\n\
movs r3, 0x12\n\
ldrsh r0, [r4, r3]\n\
cmp r1, r0\n\
bge _08107FE0\n\
ldr r6, =gScanlineEffectRegBuffers\n\
ldr r5, =gScanlineEffect\n\
_08107FBE:\n\
asrs r3, r2, 16\n\
lsls r2, r3, 1\n\
ldrb r1, [r5, 0x14]\n\
lsls r0, r1, 4\n\
subs r0, r1\n\
lsls r0, 7\n\
adds r2, r0\n\
adds r2, r6\n\
ldrh r0, [r4, 0xA]\n\
strh r0, [r2]\n\
adds r3, 0x1\n\
lsls r2, r3, 16\n\
asrs r1, r2, 16\n\
movs r3, 0x12\n\
ldrsh r0, [r4, r3]\n\
cmp r1, r0\n\
blt _08107FBE\n\
_08107FE0:\n\
ldrh r3, [r4, 0x12]\n\
lsls r1, r3, 16\n\
asrs r0, r1, 16\n\
cmp r0, 0x9F\n\
bgt _0810800C\n\
ldr r6, =gScanlineEffectRegBuffers\n\
ldr r5, =gScanlineEffect\n\
_08107FEE:\n\
asrs r3, r1, 16\n\
lsls r2, r3, 1\n\
ldrb r1, [r5, 0x14]\n\
lsls r0, r1, 4\n\
subs r0, r1\n\
lsls r0, 7\n\
adds r2, r0\n\
adds r2, r6\n\
ldrh r0, [r4, 0xC]\n\
strh r0, [r2]\n\
adds r3, 0x1\n\
lsls r1, r3, 16\n\
asrs r0, r1, 16\n\
cmp r0, 0x9F\n\
ble _08107FEE\n\
_0810800C:\n\
movs r0, 0x26\n\
ldrsh r1, [r4, r0]\n\
movs r0, 0x1\n\
negs r0, r0\n\
cmp r1, r0\n\
bne _08108022\n\
bl ScanlineEffect_Stop\n\
adds r0, r7, 0\n\
bl DestroyTask\n\
_08108022:\n\
add sp, 0xC\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n");
}
#endif
void sub_8108034(struct Sprite *sprite)
{
@ -1925,82 +1517,82 @@ void sub_8108140(u8 taskId)
switch (task->data[0])
{
case 0:
sub_80A805C(task, task->data[15], 0x100, 0x100, 224, 0x200, 32);
case 0:
sub_80A805C(task, task->data[15], 0x100, 0x100, 224, 0x200, 32);
task->data[0]++;
case 1:
if (++task->data[3] > 1)
{
task->data[3] = 0;
if (++task->data[4] & 1)
{
gSprites[task->data[15]].pos2.x = 3;
gSprites[task->data[15]].pos1.y++;
}
else
{
gSprites[task->data[15]].pos2.x = -3;
}
}
if (sub_80A80C8(task) == 0)
{
SetBattlerSpriteYOffsetFromYScale(task->data[15]);
gSprites[task->data[15]].pos2.x = 0;
task->data[3] = 0;
task->data[4] = 0;
task->data[0]++;
case 1:
if (++task->data[3] > 1)
{
task->data[3] = 0;
if (++task->data[4] & 1)
{
gSprites[task->data[15]].pos2.x = 3;
gSprites[task->data[15]].pos1.y++;
}
else
{
gSprites[task->data[15]].pos2.x = -3;
}
}
if (sub_80A80C8(task) == 0)
{
SetBattlerSpriteYOffsetFromYScale(task->data[15]);
gSprites[task->data[15]].pos2.x = 0;
task->data[3] = 0;
task->data[4] = 0;
task->data[0]++;
}
break;
case 2:
if (++task->data[3] > 4)
{
sub_80A805C(task, task->data[15], 224, 0x200, 384, 224, 8);
task->data[3] = 0;
task->data[0]++;
}
break;
case 3:
if (sub_80A80C8(task) == 0)
{
task->data[3] = 0;
task->data[4] = 0;
task->data[0]++;
}
break;
case 4:
sub_8108408(task, taskId);
}
break;
case 2:
if (++task->data[3] > 4)
{
sub_80A805C(task, task->data[15], 224, 0x200, 384, 224, 8);
task->data[3] = 0;
task->data[0]++;
case 5:
if (++task->data[3] > 1)
}
break;
case 3:
if (sub_80A80C8(task) == 0)
{
task->data[3] = 0;
task->data[4] = 0;
task->data[0]++;
}
break;
case 4:
sub_8108408(task, taskId);
task->data[0]++;
case 5:
if (++task->data[3] > 1)
{
task->data[3] = 0;
if (++task->data[4] & 1)
gSprites[task->data[15]].pos2.y += 2;
else
gSprites[task->data[15]].pos2.y -= 2;
if (task->data[4] == 10)
{
sub_80A805C(task, task->data[15], 384, 224, 0x100, 0x100, 8);
task->data[3] = 0;
if (++task->data[4] & 1)
gSprites[task->data[15]].pos2.y += 2;
else
gSprites[task->data[15]].pos2.y -= 2;
if (task->data[4] == 10)
{
sub_80A805C(task, task->data[15], 384, 224, 0x100, 0x100, 8);
task->data[3] = 0;
task->data[4] = 0;
task->data[0]++;
}
}
break;
case 6:
gSprites[task->data[15]].pos1.y--;
if (sub_80A80C8(task) == 0)
{
ResetSpriteRotScale(task->data[15]);
gSprites[task->data[15]].pos1.y = task->data[5];
task->data[4] = 0;
task->data[0]++;
}
break;
case 7:
if (task->data[2] == 0)
DestroyAnimVisualTask(taskId);
break;
}
break;
case 6:
gSprites[task->data[15]].pos1.y--;
if (sub_80A80C8(task) == 0)
{
ResetSpriteRotScale(task->data[15]);
gSprites[task->data[15]].pos1.y = task->data[5];
task->data[4] = 0;
task->data[0]++;
}
break;
case 7:
if (task->data[2] == 0)
DestroyAnimVisualTask(taskId);
break;
}
}
@ -2073,21 +1665,21 @@ void sub_810851C(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
sprite->data[4] += (sprite->data[1] % 6) * 3;
sprite->data[5] += (sprite->data[1] % 3) * 3;
sprite->data[0]++;
case 1:
sprite->data[2] += sprite->data[4];
sprite->data[3] += sprite->data[5];
sprite->pos1.x = sprite->data[2] >> 4;
sprite->pos1.y = sprite->data[3] >> 4;
if (sprite->pos1.x < -8 || sprite->pos1.x > 248 || sprite->pos1.y < -8 || sprite->pos1.y > 120)
{
gTasks[sprite->data[6]].data[sprite->data[7]]--;
DestroySprite(sprite);
}
break;
case 0:
sprite->data[4] += (sprite->data[1] % 6) * 3;
sprite->data[5] += (sprite->data[1] % 3) * 3;
sprite->data[0]++;
case 1:
sprite->data[2] += sprite->data[4];
sprite->data[3] += sprite->data[5];
sprite->pos1.x = sprite->data[2] >> 4;
sprite->pos1.y = sprite->data[3] >> 4;
if (sprite->pos1.x < -8 || sprite->pos1.x > 248 || sprite->pos1.y < -8 || sprite->pos1.y > 120)
{
gTasks[sprite->data[6]].data[sprite->data[7]]--;
DestroySprite(sprite);
}
break;
}
}
@ -2119,39 +1711,39 @@ void sub_810862C(u8 taskId)
switch (task->data[0])
{
case 0:
if (++task->data[2] > 2)
case 0:
if (++task->data[2] > 2)
{
task->data[2] = 0;
sub_810871C(task, taskId);
}
if (task->data[10] != 0 && task->data[13] == 0)
{
gBattleAnimArgs[0] = 1;
gBattleAnimArgs[1] = 0;
gBattleAnimArgs[2] = 12;
taskId2 = CreateTask(sub_81152DC, 80);
if (taskId2 != 0xFF)
{
task->data[2] = 0;
sub_810871C(task, taskId);
gTasks[taskId2].func(taskId2);
gAnimVisualTaskCount++;
}
if (task->data[10] != 0 && task->data[13] == 0)
gBattleAnimArgs[0] = 3;
taskId2 = CreateTask(sub_81152DC, 80);
if (taskId2 != 0xFF)
{
gBattleAnimArgs[0] = 1;
gBattleAnimArgs[1] = 0;
gBattleAnimArgs[2] = 12;
taskId2 = CreateTask(sub_81152DC, 80);
if (taskId2 != 0xFF)
{
gTasks[taskId2].func(taskId2);
gAnimVisualTaskCount++;
}
gBattleAnimArgs[0] = 3;
taskId2 = CreateTask(sub_81152DC, 80);
if (taskId2 != 0xFF)
{
gTasks[taskId2].func(taskId2);
gAnimVisualTaskCount++;
}
task->data[13] = 1;
gTasks[taskId2].func(taskId2);
gAnimVisualTaskCount++;
}
if (task->data[11] >= task->data[12])
task->data[0]++;
break;
case 1:
if (task->data[9] == 0)
DestroyAnimVisualTask(taskId);
break;
task->data[13] = 1;
}
if (task->data[11] >= task->data[12])
task->data[0]++;
break;
case 1:
if (task->data[9] == 0)
DestroyAnimVisualTask(taskId);
break;
}
}
@ -2232,66 +1824,66 @@ void sub_8108978(u8 taskId)
switch (task->data[0])
{
case 0:
sub_8108AC0(task);
if (task->data[10] != 0)
task->data[0]++;
break;
case 1:
sub_8108AC0(task);
if (++task->data[1] > 16)
case 0:
sub_8108AC0(task);
if (task->data[10] != 0)
task->data[0]++;
break;
case 1:
sub_8108AC0(task);
if (++task->data[1] > 16)
{
task->data[1] = 0;
task->data[0]++;
}
break;
case 2:
sub_8108AC0(task);
task->data[5] += task->data[7] * 6;
if (!(task->data[5] >= -16 && task->data[5] <= 256))
{
if (++task->data[12] > 2)
{
task->data[13] = 1;
task->data[0] = 6;
task->data[1] = 0;
}
else
{
task->data[1] = 0;
task->data[0]++;
}
break;
case 2:
sub_8108AC0(task);
task->data[5] += task->data[7] * 6;
if (!(task->data[5] >= -16 && task->data[5] <= 256))
{
if (++task->data[12] > 2)
{
task->data[13] = 1;
task->data[0] = 6;
task->data[1] = 0;
}
else
{
task->data[1] = 0;
task->data[0]++;
}
}
break;
case 3:
sub_8108AC0(task);
task->data[6] -= task->data[7] * 2;
if (++task->data[1] > 7)
task->data[0]++;
break;
case 4:
sub_8108AC0(task);
task->data[5] -= task->data[7] * 6;
if (!(task->data[5] >= -16 && task->data[5] <= 256))
{
task->data[12]++;
task->data[1] = 0;
task->data[0]++;
}
break;
case 5:
sub_8108AC0(task);
task->data[6] -= task->data[7] * 2;
if (++task->data[1] > 7)
task->data[0] = 2;
break;
case 6:
if (task->data[8] == 0)
task->data[0]++;
break;
default:
DestroyAnimVisualTask(taskId);
break;
}
break;
case 3:
sub_8108AC0(task);
task->data[6] -= task->data[7] * 2;
if (++task->data[1] > 7)
task->data[0]++;
break;
case 4:
sub_8108AC0(task);
task->data[5] -= task->data[7] * 6;
if (!(task->data[5] >= -16 && task->data[5] <= 256))
{
task->data[12]++;
task->data[1] = 0;
task->data[0]++;
}
break;
case 5:
sub_8108AC0(task);
task->data[6] -= task->data[7] * 2;
if (++task->data[1] > 7)
task->data[0] = 2;
break;
case 6:
if (task->data[8] == 0)
task->data[0]++;
break;
default:
DestroyAnimVisualTask(taskId);
break;
}
}