mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Break up pokenav into subfiles
The files are separated based on the pokenav resources substruct ID they use.
This commit is contained in:
parent
d84d94e29a
commit
0dc73b0b3a
16556
asm/pokenav.s
16556
asm/pokenav.s
File diff suppressed because it is too large
Load Diff
864
asm/pokenav_unk_1.s
Normal file
864
asm/pokenav_unk_1.s
Normal file
@ -0,0 +1,864 @@
|
||||
.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.
|
2185
asm/pokenav_unk_10.s
Normal file
2185
asm/pokenav_unk_10.s
Normal file
File diff suppressed because it is too large
Load Diff
2277
asm/pokenav_unk_2.s
Normal file
2277
asm/pokenav_unk_2.s
Normal file
File diff suppressed because it is too large
Load Diff
1036
asm/pokenav_unk_3.s
Normal file
1036
asm/pokenav_unk_3.s
Normal file
File diff suppressed because it is too large
Load Diff
2347
asm/pokenav_unk_4.s
Normal file
2347
asm/pokenav_unk_4.s
Normal file
File diff suppressed because it is too large
Load Diff
1396
asm/pokenav_unk_5.s
Normal file
1396
asm/pokenav_unk_5.s
Normal file
File diff suppressed because it is too large
Load Diff
1752
asm/pokenav_unk_6.s
Normal file
1752
asm/pokenav_unk_6.s
Normal file
File diff suppressed because it is too large
Load Diff
2001
asm/pokenav_unk_7.s
Normal file
2001
asm/pokenav_unk_7.s
Normal file
File diff suppressed because it is too large
Load Diff
1377
asm/pokenav_unk_8.s
Normal file
1377
asm/pokenav_unk_8.s
Normal file
File diff suppressed because it is too large
Load Diff
1393
asm/pokenav_unk_9.s
Normal file
1393
asm/pokenav_unk_9.s
Normal file
File diff suppressed because it is too large
Load Diff
11
asmdiff.ps1
11
asmdiff.ps1
@ -107,8 +107,13 @@ if ($start_num -gt 0x1000000)
|
||||
$end_str = [System.Convert]::ToString($start_num + $offset_num, 16)
|
||||
$end_str = "0x$end_str"
|
||||
|
||||
Write-Host "$Start - $end_str"
|
||||
$start_str = "0x$Start"
|
||||
|
||||
Write-Host "$start_str - $end_str"
|
||||
$objdump = Join-Path -Path $env:DEVKITARM -ChildPath "arm-none-eabi\bin\objdump.exe"
|
||||
&$objdump -D -bbinary -marmv4t -Mforce-thumb --start-address="$Start" --stop-address="$end_str" .\baserom.gba > .\baserom.dump
|
||||
&$objdump -D -bbinary -marmv4t -Mforce-thumb --start-address="$Start" --stop-address="$end_str" .\pokeemerald.gba > .\pokeemerald.dump
|
||||
Write-Host "Dumping [0/2]"
|
||||
&$objdump -D -bbinary -marmv4t -Mforce-thumb --start-address="$start_str" --stop-address="$end_str" .\baserom.gba > .\baserom.dump
|
||||
Write-Host "Dumping [1/2]"
|
||||
&$objdump -D -bbinary -marmv4t -Mforce-thumb --start-address="$start_str" --stop-address="$end_str" .\pokeemerald.gba > .\pokeemerald.dump
|
||||
Write-Host "Dumping [2/2]"
|
||||
Invoke-Expression "$DiffTool .\baserom.dump .\pokeemerald.dump"
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
.section .rodata
|
||||
|
||||
// pokenav_unk_1.s
|
||||
gUnknown_0861FC54:: @ 861FC54
|
||||
.byte 2
|
||||
.byte 3
|
||||
@ -13,6 +14,7 @@ gUnknown_0861FC54:: @ 861FC54
|
||||
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"
|
||||
|
||||
@ -201,7 +203,8 @@ gUnknown_08620384:: @ 8620384
|
||||
.4byte 0x4000040
|
||||
.4byte 0xa2600001
|
||||
.byte 1, 0, 0, 0
|
||||
|
||||
|
||||
// pokenav_unk_3.s
|
||||
gUnknown_08620390:: @ 8620390
|
||||
.string "Becalm fighting emotions.$"
|
||||
|
||||
@ -1227,6 +1230,7 @@ gUnknown_08622508:: @ 8622508
|
||||
gUnknown_0862250A:: @ 862250A
|
||||
.byte 0, 1, 2, 0, 0, 0
|
||||
|
||||
// pokenav_unk_4.s
|
||||
gUnknown_08622510:: @ 8622510
|
||||
.incbin "graphics/pokenav/ui_matchcall.gbapal"
|
||||
|
||||
@ -1323,6 +1327,7 @@ gUnknown_08622848:: @ 8622848
|
||||
gUnknown_08622850:: @ 8622850
|
||||
spr_template 8, 13, gUnknown_08622848, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
|
||||
|
||||
// pokenav_unk_5.s
|
||||
gUnknown_08622868:: @ 8622868
|
||||
.incbin "graphics/pokenav/8622868.gbapal"
|
||||
|
||||
@ -1456,6 +1461,10 @@ gUnknown_086231C8:: @ 86231C8
|
||||
gUnknown_086231D0:: @ 86231D0
|
||||
spr_template 6, 11, gUnknown_086231C8, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_81CCEF4
|
||||
|
||||
// pokenav_unk_6.s
|
||||
// <none>
|
||||
|
||||
// pokenav_unk_7.s
|
||||
gUnknown_086231E8:: @ 86231E8
|
||||
.incbin "graphics/pokenav/86231E8.gbapal"
|
||||
|
||||
@ -1488,6 +1497,7 @@ gUnknown_08623374:: @ 8623374
|
||||
gUnknown_0862337C:: @ 862337C
|
||||
window_template 1, 13, 0x1C, 3, 2, 15, 0x44
|
||||
|
||||
// pokenav_unk_8.s
|
||||
gUnknown_08623384:: @ 8623384
|
||||
.4byte NULL
|
||||
.4byte sub_81CE37C
|
||||
@ -1548,6 +1558,7 @@ gUnknown_086235D4:: @ 86235D4
|
||||
.string "{UNK_SPACER}$"
|
||||
.align 2
|
||||
|
||||
// pokenav_unk_9.s
|
||||
gUnknown_086235D8:: @ 86235D8
|
||||
.4byte sub_81CFB8C
|
||||
.4byte sub_81CFC2C
|
||||
@ -1595,6 +1606,7 @@ gUnknown_086237F4:: @ 86237F4
|
||||
.string "{UNK_SPACER}$"
|
||||
.align 2
|
||||
|
||||
// pokenav_unk_10.s
|
||||
gUnknown_086237F8:: @ 86237F8
|
||||
.byte 1, 1, 0, 0
|
||||
.byte 3, 4, 1, 0
|
||||
|
@ -1,6 +1,28 @@
|
||||
#ifndef GUARD_POKENAV_H
|
||||
#define GUARD_POKENAV_H
|
||||
|
||||
typedef u32 (*LoopedTask)(s32 state);
|
||||
|
||||
// Return values of LoopedTask functions.
|
||||
#define LT_INC_AND_PAUSE 0
|
||||
#define LT_INC_AND_CONTINUE 1
|
||||
#define LT_PAUSE 2
|
||||
#define LT_CONTINUE 3
|
||||
#define LT_FINISH 4
|
||||
#define LT_SET_STATE(newState) (newState + 5)
|
||||
|
||||
// pokenav.c
|
||||
extern u32 sub_81C99D4(void);
|
||||
|
||||
void CB2_InitPokeNav(void);
|
||||
u32 CreateLoopedTask(LoopedTask loopedTask, u32 priority);
|
||||
bool32 FuncIsActiveLoopedTask(LoopedTask func);
|
||||
void *GetSubstructPtr(u32 index);
|
||||
void FreePokenavSubstruct(u32 index);
|
||||
void *AllocSubstruct(u32 index, u32 size);
|
||||
void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes);
|
||||
bool32 IsLoopedTaskActive(u32 taskId);
|
||||
|
||||
// pokenav_match_call_ui.c
|
||||
|
||||
#endif //GUARD_POKENAV_H
|
||||
|
@ -300,8 +300,19 @@ SECTIONS {
|
||||
src/unk_pokedex_area_screen_helper.o(.text);
|
||||
src/battle_pyramid_bag.o(.text);
|
||||
src/pokenav.o(.text);
|
||||
asm/pokenav.o(.text);
|
||||
src/pokenav_match_call.o(.text);
|
||||
src/pokenav_main_menu.o(.text);
|
||||
src/pokenav_match_call_ui.o(.text);
|
||||
asm/pokenav_unk_1.o(.text);
|
||||
asm/pokenav_unk_2.o(.text);
|
||||
asm/pokenav_unk_3.o(.text);
|
||||
asm/pokenav_unk_4.o(.text);
|
||||
asm/pokenav_unk_5.o(.text);
|
||||
asm/pokenav_unk_6.o(.text);
|
||||
asm/pokenav_unk_7.o(.text);
|
||||
asm/pokenav_unk_8.o(.text);
|
||||
asm/pokenav_unk_9.o(.text);
|
||||
asm/pokenav_unk_10.o(.text);
|
||||
src/pokenav_match_call_data.o(.text);
|
||||
src/menu_specialized.o(.text);
|
||||
src/ereader_helpers.o(.text);
|
||||
src/faraway_island.o(.text);
|
||||
@ -617,8 +628,10 @@ SECTIONS {
|
||||
src/unk_pokedex_area_screen_helper.o(.rodata);
|
||||
src/battle_pyramid_bag.o(.rodata);
|
||||
src/pokenav.o(.rodata);
|
||||
src/pokenav_main_menu.o(.rodata);
|
||||
src/pokenav_match_call_ui.o(.rodata);
|
||||
data/pokenav.o(.rodata);
|
||||
src/pokenav_match_call.o(.rodata);
|
||||
src/pokenav_match_call_data.o(.rodata);
|
||||
src/menu_specialized.o(.rodata);
|
||||
data/ereader_helpers.o(.rodata);
|
||||
src/faraway_island.o(.rodata);
|
||||
|
2241
src/pokenav.c
2241
src/pokenav.c
File diff suppressed because it is too large
Load Diff
990
src/pokenav_main_menu.c
Normal file
990
src/pokenav_main_menu.c
Normal file
@ -0,0 +1,990 @@
|
||||
#include "global.h"
|
||||
#include "pokenav.h"
|
||||
#include "constants/songs.h"
|
||||
#include "sound.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "palette.h"
|
||||
#include "bg.h"
|
||||
#include "window.h"
|
||||
#include "strings.h"
|
||||
#include "graphics.h"
|
||||
#include "decompress.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "menu.h"
|
||||
#include "dma3.h"
|
||||
|
||||
enum
|
||||
{
|
||||
NAVGEAR_GFX_MAIN_MENU,
|
||||
NAVGEAR_GFX_CONDITION_MENU,
|
||||
NAVGEAR_GFX_RIBBONS_MENU,
|
||||
NAVGEAR_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.
|
||||
NAVGEAR_GFX_MAP_MENU_UNK0,
|
||||
NAVGEAR_GFX_MAP_MENU_UNK1,
|
||||
|
||||
NAVGEAR_GFX_PARTY_MENU,
|
||||
NAVGEAR_GFX_SEARCH_MENU,
|
||||
NAVGEAR_GFX_COOL_MENU,
|
||||
NAVGEAR_GFX_BEAUTY_MENU,
|
||||
NAVGEAR_GFX_CUTE_MENU,
|
||||
NAVGEAR_GFX_SMART_MENU,
|
||||
NAVGEAR_GFX_TOUGH_MENU,
|
||||
|
||||
NAVGEAR_GFX_MENUS_END
|
||||
};
|
||||
|
||||
#define NAVGEAR_GFX_SUBMENUS_START NAVGEAR_GFX_PARTY_MENU
|
||||
|
||||
struct PokenavMainMenuResources
|
||||
{
|
||||
void (*unk0)(u32);
|
||||
u32 (*unk4)(void);
|
||||
u32 unk8;
|
||||
u32 currentTaskId;
|
||||
u32 unk10;
|
||||
u32 unk14;
|
||||
struct Sprite *spinningNavgear;
|
||||
struct Sprite *leftHeaderSprites[2];
|
||||
struct Sprite *submenuLeftHeaderSprites[2];
|
||||
u8 tilemapBuffer[0x800];
|
||||
};
|
||||
|
||||
// This struct uses a 32bit tag, and doesn't have a size field.
|
||||
// Needed to match LoadLeftHeaderGfxForSubMenu.
|
||||
struct CompressedSpriteSheetNoSize
|
||||
{
|
||||
const u32 *data; // LZ77 compressed palette data
|
||||
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 InitHoenMapHeaderSprites(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_SpinningNavgear(struct Sprite* sprite);
|
||||
u32 LoopedTask_InitPokenavMenu(s32 a0);
|
||||
|
||||
const u16 gSpinningNavgearPaletteData[] = INCBIN_U16("graphics/pokenav/icon2.gbapal");
|
||||
const u32 gSpinningNavgearGfx[] = INCBIN_U32("graphics/pokenav/icon2.4bpp.lz");
|
||||
const u32 gUnused_SpinningNavgearGfx2[] = INCBIN_U32("graphics/pokenav/icon2_unused.4bpp.lz");
|
||||
|
||||
const struct BgTemplate gPokenavMainMenuBgTemplates[] =
|
||||
{
|
||||
{
|
||||
.bg = 0,
|
||||
.charBaseIndex = 0,
|
||||
.mapBaseIndex = 5,
|
||||
.screenSize = 0,
|
||||
.paletteMode = 0,
|
||||
.priority = 0,
|
||||
.baseTile = 0,
|
||||
}
|
||||
};
|
||||
|
||||
const struct WindowTemplate gUnknown_0861FA08[2] =
|
||||
{
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 22,
|
||||
.width = 16,
|
||||
.height = 2,
|
||||
.paletteNum = 0,
|
||||
.baseBlock = 0x36,
|
||||
},
|
||||
{
|
||||
.bg = 0xFF,
|
||||
.tilemapLeft = 0,
|
||||
.tilemapTop = 0,
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.paletteNum = 0,
|
||||
.baseBlock = 0,
|
||||
},
|
||||
};
|
||||
|
||||
const u8 *const (sMenuButtonReminders[12]) =
|
||||
{
|
||||
gText_Navgear_ClearButtonList,
|
||||
gText_NavgearMap_ZoomedOutButtons,
|
||||
gText_NavgearMap_ZoomedInButtons,
|
||||
gText_NavgearCondition_MonListButtons,
|
||||
gText_NavgearCondition_MonStatusButtons,
|
||||
gText_NavgearCondition_MarkingButtons,
|
||||
gText_NavgearMatchCall_TrainerListButtons,
|
||||
gText_NavgearMatchCall_CallMenuButtons,
|
||||
gText_NavgearMatchCall_CheckTrainerButtons,
|
||||
gText_NavgearRibbons_MonListButtons,
|
||||
gText_NavgearRibbons_RibbonListButtons,
|
||||
gText_NavgearRibbons_RibbonCheckButtons,
|
||||
};
|
||||
|
||||
const u8 gMenuButtonReminderColor[4] =
|
||||
{
|
||||
4, 1, 2, 0
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet gSpinningNavgearSpriteSheet[] =
|
||||
{
|
||||
{
|
||||
.data = gSpinningNavgearGfx,
|
||||
.size = 0x1000,
|
||||
.tag = 0,
|
||||
}
|
||||
};
|
||||
|
||||
static const struct SpritePalette gSpinningNavgearPalette[] =
|
||||
{
|
||||
{
|
||||
.data = gSpinningNavgearPaletteData,
|
||||
.tag = 0,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet sPokenavHoenMapLeftHeaderSpriteSheet =
|
||||
{
|
||||
.data = gPokenavLeftHeaderHoennMap_Gfx,
|
||||
.size = 0xC00,
|
||||
.tag = 2
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet sPokenavMenuLeftHeaderSpriteSheets[] =
|
||||
{
|
||||
[NAVGEAR_GFX_MAIN_MENU] = {
|
||||
.data = gPokenavLeftHeaderMainMenu_Gfx,
|
||||
.size = 0x20,
|
||||
.tag = 3
|
||||
},
|
||||
[NAVGEAR_GFX_CONDITION_MENU] = {
|
||||
.data = gPokenavLeftHeaderCondition_Gfx,
|
||||
.size = 0x20,
|
||||
.tag = 1
|
||||
},
|
||||
[NAVGEAR_GFX_RIBBONS_MENU] = {
|
||||
.data = gPokenavLeftHeaderRibbons_Gfx,
|
||||
.size = 0x20,
|
||||
.tag = 2
|
||||
},
|
||||
[NAVGEAR_GFX_MATCH_CALL_MENU] = {
|
||||
.data = gPokenavLeftHeaderMatchCall_Gfx,
|
||||
.size = 0x20,
|
||||
.tag = 4
|
||||
},
|
||||
[NAVGEAR_GFX_MAP_MENU_UNK0] = {
|
||||
.data = gPokenavLeftHeaderHoennMap_Gfx,
|
||||
.size = 0x20,
|
||||
.tag = 0
|
||||
},
|
||||
[NAVGEAR_GFX_MAP_MENU_UNK1] = {
|
||||
.data = gPokenavLeftHeaderHoennMap_Gfx,
|
||||
.size = 0x40,
|
||||
.tag = 0
|
||||
}
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheetNoSize sPokenavSubMenuLeftHeaderSpriteSheets[] =
|
||||
{
|
||||
[NAVGEAR_GFX_PARTY_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderParty_Gfx,
|
||||
.tag = 1
|
||||
},
|
||||
[NAVGEAR_GFX_SEARCH_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderSearch_Gfx,
|
||||
.tag = 1
|
||||
},
|
||||
[NAVGEAR_GFX_COOL_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderCool_Gfx,
|
||||
.tag = 4
|
||||
},
|
||||
[NAVGEAR_GFX_BEAUTY_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderBeauty_Gfx,
|
||||
.tag = 1
|
||||
},
|
||||
[NAVGEAR_GFX_CUTE_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderCute_Gfx,
|
||||
.tag = 2
|
||||
},
|
||||
[NAVGEAR_GFX_SMART_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderSmart_Gfx,
|
||||
.tag = 0
|
||||
},
|
||||
[NAVGEAR_GFX_TOUGH_MENU - NAVGEAR_GFX_SUBMENUS_START] = {
|
||||
.data = gPokenavLeftHeaderTough_Gfx,
|
||||
.tag = 0
|
||||
}
|
||||
};
|
||||
|
||||
static const struct OamData sSpinningNavgearSpriteOam =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 0, // FIXME: Use SPRITE_SHAPE
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 2, // FIXME: Use SPRITE_SIZE
|
||||
.tileNum = 0,
|
||||
.priority = 0,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpinningNavgearAnims[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 8),
|
||||
ANIMCMD_FRAME(16, 8),
|
||||
ANIMCMD_FRAME(32, 8),
|
||||
ANIMCMD_FRAME(48, 8),
|
||||
ANIMCMD_FRAME(64, 8),
|
||||
ANIMCMD_FRAME(80, 8),
|
||||
ANIMCMD_FRAME(96, 8),
|
||||
ANIMCMD_FRAME(112, 8),
|
||||
ANIMCMD_JUMP(0)
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sSpinningNavgearAnimTable[] =
|
||||
{
|
||||
sSpinningNavgearAnims
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sSpinningNavgearSpriteTemplate =
|
||||
{
|
||||
.tileTag = 0,
|
||||
.paletteTag = 0,
|
||||
.oam = &sSpinningNavgearSpriteOam,
|
||||
.anims = sSpinningNavgearAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCB_SpinningNavgear
|
||||
};
|
||||
|
||||
static const struct OamData sPokenavLeftHeaderHoenMapSpriteOam =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 1,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 3,
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const struct OamData sUnknown_0861FB24 =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 1,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 2,
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sPokenavLeftHeaderHoenMapSpriteTemplate =
|
||||
{
|
||||
.tileTag = 2,
|
||||
.paletteTag = 1,
|
||||
.oam = &sPokenavLeftHeaderHoenMapSpriteOam,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCallbackDummy
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sUnknown_0861FB44 =
|
||||
{
|
||||
.tileTag = 2,
|
||||
.paletteTag = 2,
|
||||
.oam = &sUnknown_0861FB24,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCallbackDummy
|
||||
};
|
||||
|
||||
bool32 InitPokenavMainMenu(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr;
|
||||
|
||||
structPtr = AllocSubstruct(0, sizeof(struct PokenavMainMenuResources));
|
||||
if (structPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
ResetSpriteData();
|
||||
FreeAllSpritePalettes();
|
||||
structPtr->currentTaskId = CreateLoopedTask(LoopedTask_InitPokenavMenu, 1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 PokenavMainMenuLoopedTaskIsActive(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
return IsLoopedTaskActive(structPtr->currentTaskId);
|
||||
}
|
||||
|
||||
void ShutdownPokenav(void)
|
||||
{
|
||||
PlaySE(SE_PN_OFF);
|
||||
sub_81CAADC();
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, -1, 0, 16, RGB_BLACK);
|
||||
}
|
||||
|
||||
bool32 WaitForPokenavShutdownFade(void)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sub_81C99D4();
|
||||
CleanupPokenavMainMenuResources();
|
||||
FreeAllWindowBuffers();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 LoopedTask_InitPokenavMenu(s32 a0)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr;
|
||||
|
||||
switch (a0)
|
||||
{
|
||||
case 0:
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
|
||||
FreeAllWindowBuffers();
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, gPokenavMainMenuBgTemplates, ARRAY_COUNT(gPokenavMainMenuBgTemplates));
|
||||
ResetBgPositions();
|
||||
reset_temp_tile_data_buffers();
|
||||
return LT_INC_AND_CONTINUE;
|
||||
case 1:
|
||||
structPtr = GetSubstructPtr(0);
|
||||
decompress_and_copy_tile_data_to_vram(0, &gPokenavHeader_Gfx, 0, 0, 0);
|
||||
SetBgTilemapBuffer(0, structPtr->tilemapBuffer);
|
||||
CopyToBgTilemapBuffer(0, &gPokenavHeader_Tilemap, 0, 0);
|
||||
CopyPaletteIntoBufferUnfaded(gPokenavHeader_Pal, 0, 0x20);
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 2:
|
||||
if (free_temp_tile_data_buffers_if_possible())
|
||||
return LT_PAUSE;
|
||||
|
||||
sub_81C7B74();
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 3:
|
||||
if (IsDma3ManagerBusyWithBgCopy())
|
||||
return LT_PAUSE;
|
||||
|
||||
InitPokenavMainMenuResources();
|
||||
InitHoenMapHeaderSprites();
|
||||
ShowBg(0);
|
||||
return LT_FINISH;
|
||||
default:
|
||||
return LT_FINISH;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81C7834(void *func1, void *func2) // Fix types later.
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
structPtr->unk0 = func1;
|
||||
structPtr->unk4 = func2;
|
||||
structPtr->unk8 = 0;
|
||||
}
|
||||
|
||||
void sub_81C7850(u32 a0)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
structPtr->unk8 = 0;
|
||||
structPtr->unk0(a0);
|
||||
}
|
||||
|
||||
u32 sub_81C786C(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
return structPtr->unk4();
|
||||
}
|
||||
|
||||
void sub_81C7880(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
structPtr->currentTaskId = CreateLoopedTask(LoopedTask_ScrollMenuHeaderDown, 4);
|
||||
}
|
||||
|
||||
void sub_81C78A0(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
structPtr->currentTaskId = CreateLoopedTask(LoopedTask_ScrollMenuHeaderUp, 4);
|
||||
}
|
||||
|
||||
bool32 MainMenuLoopedTaskIsBusy(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
return IsLoopedTaskActive(structPtr->currentTaskId);
|
||||
}
|
||||
|
||||
u32 LoopedTask_ScrollMenuHeaderDown(s32 a0)
|
||||
{
|
||||
switch (a0)
|
||||
{
|
||||
default:
|
||||
return LT_FINISH;
|
||||
case 1:
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 0:
|
||||
return LT_INC_AND_PAUSE;
|
||||
case 2:
|
||||
if (ChangeBgY(0, 384, 1) >= 0x2000u)
|
||||
{
|
||||
ChangeBgY(0, 0x2000, 0);
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
||||
return LT_PAUSE;
|
||||
}
|
||||
}
|
||||
|
||||
u32 LoopedTask_ScrollMenuHeaderUp(s32 a0)
|
||||
{
|
||||
if (ChangeBgY(0, 384, 2) <= 0)
|
||||
{
|
||||
ChangeBgY(0, 0, 0);
|
||||
return 4;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size)
|
||||
{
|
||||
CpuCopy16(palette, gPlttBufferUnfaded + bufferOffset, size);
|
||||
}
|
||||
|
||||
void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes)
|
||||
{
|
||||
const struct SpritePalette *current;
|
||||
u32 index;
|
||||
|
||||
for (current = palettes; current->data != NULL; current++)
|
||||
{
|
||||
index = AllocSpritePalette(current->tag);
|
||||
if (index == 0xFF)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = (index * 16) + 0x100;
|
||||
CopyPaletteIntoBufferUnfaded(current->data, index, 0x20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81C7990(u32 a0, u16 a1)
|
||||
{
|
||||
CpuFill16(a1, gPlttBufferFaded + 0x100 + (a0 * 16), 16 * sizeof(u16));
|
||||
}
|
||||
|
||||
__attribute__((naked))
|
||||
void sub_81C79BC(u16 *a0, u16 *a1, u32 a2, u32 a3, u32 a4, u32 a5)
|
||||
{
|
||||
asm(".syntax unified\n\
|
||||
push {r4-r7,lr}\n\
|
||||
mov r7, r10\n\
|
||||
mov r6, r9\n\
|
||||
mov r5, r8\n\
|
||||
push {r5-r7}\n\
|
||||
sub sp, 0xC\n\
|
||||
str r0, [sp]\n\
|
||||
str r1, [sp, 0x4]\n\
|
||||
mov r10, r2\n\
|
||||
str r3, [sp, 0x8]\n\
|
||||
ldr r0, [sp, 0x2C]\n\
|
||||
cmp r0, 0\n\
|
||||
bne _081C79E4\n\
|
||||
ldr r2, =0x001fffff\n\
|
||||
mov r1, r10\n\
|
||||
ands r2, r1\n\
|
||||
ldr r0, [sp]\n\
|
||||
b _081C79F4\n\
|
||||
.pool\n\
|
||||
_081C79E4:\n\
|
||||
ldr r2, [sp, 0x2C]\n\
|
||||
ldr r0, [sp, 0x8]\n\
|
||||
cmp r2, r0\n\
|
||||
blt _081C7A00\n\
|
||||
ldr r2, =0x001fffff\n\
|
||||
mov r1, r10\n\
|
||||
ands r2, r1\n\
|
||||
ldr r0, [sp, 0x4]\n\
|
||||
_081C79F4:\n\
|
||||
ldr r1, [sp, 0x30]\n\
|
||||
bl CpuSet\n\
|
||||
b _081C7AAE\n\
|
||||
.pool\n\
|
||||
_081C7A00:\n\
|
||||
movs r2, 0x1\n\
|
||||
negs r2, r2\n\
|
||||
add r10, r2\n\
|
||||
b _081C7AA6\n\
|
||||
_081C7A08:\n\
|
||||
ldr r1, [sp]\n\
|
||||
ldrh r0, [r1]\n\
|
||||
movs r2, 0x1F\n\
|
||||
mov r9, r2\n\
|
||||
mov r1, r9\n\
|
||||
ands r1, r0\n\
|
||||
mov r9, r1\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r2, r0, 21\n\
|
||||
movs r1, 0x1F\n\
|
||||
ands r1, r2\n\
|
||||
mov r8, r1\n\
|
||||
lsrs r7, r0, 26\n\
|
||||
movs r2, 0x1F\n\
|
||||
ands r7, r2\n\
|
||||
ldr r0, [sp, 0x4]\n\
|
||||
ldrh r4, [r0]\n\
|
||||
movs r0, 0x1F\n\
|
||||
ands r0, r4\n\
|
||||
mov r1, r9\n\
|
||||
subs r0, r1\n\
|
||||
lsls r0, 8\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
bl __divsi3\n\
|
||||
ldr r2, [sp, 0x2C]\n\
|
||||
adds r6, r0, 0\n\
|
||||
muls r6, r2\n\
|
||||
asrs r6, 8\n\
|
||||
lsls r4, 16\n\
|
||||
lsrs r0, r4, 21\n\
|
||||
movs r1, 0x1F\n\
|
||||
ands r0, r1\n\
|
||||
mov r2, r8\n\
|
||||
subs r0, r2\n\
|
||||
lsls r0, 8\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
bl __divsi3\n\
|
||||
ldr r1, [sp, 0x2C]\n\
|
||||
adds r5, r0, 0\n\
|
||||
muls r5, r1\n\
|
||||
asrs r5, 8\n\
|
||||
lsrs r4, 26\n\
|
||||
movs r2, 0x1F\n\
|
||||
ands r4, r2\n\
|
||||
subs r4, r7\n\
|
||||
lsls r4, 8\n\
|
||||
adds r0, r4, 0\n\
|
||||
ldr r1, [sp, 0x8]\n\
|
||||
bl __divsi3\n\
|
||||
ldr r1, [sp, 0x2C]\n\
|
||||
muls r0, r1\n\
|
||||
asrs r0, 8\n\
|
||||
add r6, r9\n\
|
||||
movs r2, 0x1F\n\
|
||||
ands r6, r2\n\
|
||||
add r5, r8\n\
|
||||
ands r5, r2\n\
|
||||
adds r0, r7, r0\n\
|
||||
ands r0, r2\n\
|
||||
lsls r0, 10\n\
|
||||
lsls r5, 5\n\
|
||||
orrs r0, r5\n\
|
||||
orrs r0, r6\n\
|
||||
ldr r1, [sp, 0x30]\n\
|
||||
strh r0, [r1]\n\
|
||||
ldr r2, [sp]\n\
|
||||
adds r2, 0x2\n\
|
||||
str r2, [sp]\n\
|
||||
ldr r0, [sp, 0x4]\n\
|
||||
adds r0, 0x2\n\
|
||||
str r0, [sp, 0x4]\n\
|
||||
adds r1, 0x2\n\
|
||||
str r1, [sp, 0x30]\n\
|
||||
movs r1, 0x1\n\
|
||||
negs r1, r1\n\
|
||||
add r10, r1\n\
|
||||
_081C7AA6:\n\
|
||||
movs r0, 0x1\n\
|
||||
negs r0, r0\n\
|
||||
cmp r10, r0\n\
|
||||
bne _081C7A08\n\
|
||||
_081C7AAE:\n\
|
||||
add sp, 0xC\n\
|
||||
pop {r3-r5}\n\
|
||||
mov r8, r3\n\
|
||||
mov r9, r4\n\
|
||||
mov r10, r5\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.syntax divided");
|
||||
}
|
||||
|
||||
void sub_81C7AC0(s32 a0)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
switch (a0)
|
||||
{
|
||||
case 0:
|
||||
BeginNormalPaletteFade(structPtr->unk14, -2, 0, 16, RGB_BLACK);
|
||||
break;
|
||||
case 1:
|
||||
BeginNormalPaletteFade(structPtr->unk14, -2, 16, 0, RGB_BLACK);
|
||||
break;
|
||||
case 2:
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, -2, 0, 16, RGB_BLACK);
|
||||
break;
|
||||
case 3:
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, -2, 16, 0, RGB_BLACK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 IsPaletteFadeActive(void)
|
||||
{
|
||||
return gPaletteFade.active;
|
||||
}
|
||||
|
||||
void sub_81C7B40(void)
|
||||
{
|
||||
BlendPalettes(0xFFFEFFFE, 16, RGB_BLACK);
|
||||
}
|
||||
|
||||
void InitBgTemplates(const struct BgTemplate *templates, s32 count)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
InitBgFromTemplate(templates++);
|
||||
}
|
||||
|
||||
void sub_81C7B74(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
InitWindows(&gUnknown_0861FA08[0]);
|
||||
structPtr->unk10 = 0;
|
||||
sub_81C7BF8(structPtr->unk10);
|
||||
PutWindowTilemap(structPtr->unk10);
|
||||
CopyWindowToVram(structPtr->unk10, 3); // TODO: Use a defined constant here.
|
||||
}
|
||||
|
||||
void sub_81C7BA4(u32 a0)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
sub_81C7BF8(structPtr->unk10);
|
||||
AddTextPrinterParameterized3(structPtr->unk10, 1, 0, 1, gMenuButtonReminderColor, 0, sMenuButtonReminders[a0]);
|
||||
}
|
||||
|
||||
bool32 IsDma3ManagerBusyWithBgCopy_(void)
|
||||
{
|
||||
return IsDma3ManagerBusyWithBgCopy();
|
||||
}
|
||||
|
||||
void sub_81C7BF8(u32 windowId)
|
||||
{
|
||||
FillWindowPixelBuffer(windowId, PIXEL_FILL(4));
|
||||
FillWindowPixelRect(windowId, PIXEL_FILL(5), 0, 0, 0x80, 1);
|
||||
}
|
||||
|
||||
void InitPokenavMainMenuResources(void)
|
||||
{
|
||||
s32 i;
|
||||
u8 spriteId;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSpinningNavgearSpriteSheet); i++)
|
||||
LoadCompressedSpriteSheet(&gSpinningNavgearSpriteSheet[i]);
|
||||
|
||||
Pokenav_AllocAndLoadPalettes(gSpinningNavgearPalette);
|
||||
structPtr->unk14 = ~1 & ~(0x10000 << IndexOfSpritePaletteTag(0));
|
||||
spriteId = CreateSprite(&sSpinningNavgearSpriteTemplate, 220, 12, 0);
|
||||
structPtr->spinningNavgear = &gSprites[spriteId];
|
||||
}
|
||||
|
||||
void CleanupPokenavMainMenuResources(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
DestroySprite(structPtr->spinningNavgear);
|
||||
FreeSpriteTilesByTag(0);
|
||||
FreeSpritePaletteByTag(0);
|
||||
}
|
||||
|
||||
void SpriteCB_SpinningNavgear(struct Sprite *sprite)
|
||||
{
|
||||
// If the background starts scrolling, follow it.
|
||||
sprite->pos2.y = (GetBgY(0) / 256u) * -1;
|
||||
}
|
||||
|
||||
struct Sprite *PauseSpinningNavgearSprite(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
structPtr->spinningNavgear->callback = SpriteCallbackDummy;
|
||||
return structPtr->spinningNavgear;
|
||||
}
|
||||
|
||||
void ResumeSpinningNavgearSprite(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
structPtr->spinningNavgear->pos1.x = 220;
|
||||
structPtr->spinningNavgear->pos1.y = 12;
|
||||
structPtr->spinningNavgear->callback = SpriteCB_SpinningNavgear;
|
||||
structPtr->spinningNavgear->invisible = FALSE;
|
||||
structPtr->spinningNavgear->oam.priority = 0;
|
||||
structPtr->spinningNavgear->subpriority = 0;
|
||||
}
|
||||
|
||||
void InitHoenMapHeaderSprites(void)
|
||||
{
|
||||
s32 i, spriteId;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
LoadCompressedSpriteSheet(&sPokenavHoenMapLeftHeaderSpriteSheet);
|
||||
AllocSpritePalette(1);
|
||||
AllocSpritePalette(2);
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
|
||||
{
|
||||
spriteId = CreateSprite(&sPokenavLeftHeaderHoenMapSpriteTemplate, 0, 0, 1);
|
||||
structPtr->leftHeaderSprites[i] = &gSprites[spriteId];
|
||||
structPtr->leftHeaderSprites[i]->invisible = TRUE;
|
||||
structPtr->leftHeaderSprites[i]->pos2.x = i * 64;
|
||||
|
||||
spriteId = CreateSprite(&sUnknown_0861FB44, 0, 0, 2);
|
||||
structPtr->submenuLeftHeaderSprites[i] = &gSprites[spriteId];
|
||||
structPtr->submenuLeftHeaderSprites[i]->invisible = TRUE;
|
||||
structPtr->submenuLeftHeaderSprites[i]->pos2.x = i * 32;
|
||||
structPtr->submenuLeftHeaderSprites[i]->pos2.y = 18;
|
||||
structPtr->submenuLeftHeaderSprites[i]->oam.tileNum += (i * 8) + 64;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadLeftHeaderGfxForIndex(u32 arg0)
|
||||
{
|
||||
if (arg0 < NAVGEAR_GFX_SUBMENUS_START)
|
||||
LoadLeftHeaderGfxForMenu(arg0);
|
||||
else
|
||||
LoadLeftHeaderGfxForSubMenu(arg0 - NAVGEAR_GFX_SUBMENUS_START);
|
||||
}
|
||||
|
||||
void sub_81C7E14(u32 arg0)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
if (arg0 == 4)
|
||||
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + 32;
|
||||
else
|
||||
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + 64;
|
||||
}
|
||||
|
||||
void LoadLeftHeaderGfxForMenu(u32 index)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr;
|
||||
u32 size, tag;
|
||||
|
||||
if (index >= NAVGEAR_GFX_SUBMENUS_START)
|
||||
return;
|
||||
|
||||
structPtr = GetSubstructPtr(0);
|
||||
tag = sPokenavMenuLeftHeaderSpriteSheets[index].tag;
|
||||
size = GetDecompressedDataSize(sPokenavMenuLeftHeaderSpriteSheets[index].data);
|
||||
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(1) * 16) + 0x100, 0x20);
|
||||
LZ77UnCompWram(sPokenavMenuLeftHeaderSpriteSheets[index].data, gDecompressionBuffer);
|
||||
RequestDma3Copy(gDecompressionBuffer, (void *)VRAM + 0x10000 + (GetSpriteTileStartByTag(2) * 32), size, 1);
|
||||
structPtr->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + sPokenavMenuLeftHeaderSpriteSheets[index].size;
|
||||
|
||||
if (index == NAVGEAR_GFX_MAP_MENU_UNK0 || index == NAVGEAR_GFX_MAP_MENU_UNK1)
|
||||
structPtr->leftHeaderSprites[1]->pos2.x = 56;
|
||||
else
|
||||
structPtr->leftHeaderSprites[1]->pos2.x = 64;
|
||||
}
|
||||
|
||||
void LoadLeftHeaderGfxForSubMenu(u32 arg0)
|
||||
{
|
||||
u32 size, tag;
|
||||
|
||||
if (arg0 >= NAVGEAR_GFX_MENUS_END - NAVGEAR_GFX_SUBMENUS_START)
|
||||
return;
|
||||
|
||||
tag = sPokenavSubMenuLeftHeaderSpriteSheets[arg0].tag;
|
||||
size = GetDecompressedDataSize(sPokenavSubMenuLeftHeaderSpriteSheets[arg0].data);
|
||||
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(2) * 16) + 0x100, 0x20);
|
||||
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[arg0].data, &gDecompressionBuffer[0x1000]);
|
||||
RequestDma3Copy(&gDecompressionBuffer[0x1000], (void *)VRAM + 0x10800 + (GetSpriteTileStartByTag(2) * 32), size, 1);
|
||||
}
|
||||
|
||||
void sub_81C7FA0(u32 arg0, bool32 arg1, bool32 arg2)
|
||||
{
|
||||
u32 var;
|
||||
|
||||
if (!arg1)
|
||||
var = 0x30;
|
||||
else
|
||||
var = 0x10;
|
||||
|
||||
if (arg0 < 6)
|
||||
ShowLeftHeaderSprites(var, arg2);
|
||||
else
|
||||
ShowLeftHeaderSubmenuSprites(var, arg2);
|
||||
}
|
||||
|
||||
void sub_81C7FC4(u32 arg0, bool32 arg1)
|
||||
{
|
||||
if (arg0 < 6)
|
||||
HideLeftHeaderSprites(arg1);
|
||||
else
|
||||
HideLeftHeaderSubmenuSprites(arg1);
|
||||
}
|
||||
|
||||
void sub_81C7FDC(void)
|
||||
{
|
||||
s32 i;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
|
||||
{
|
||||
structPtr->leftHeaderSprites[i]->invisible = TRUE;
|
||||
structPtr->submenuLeftHeaderSprites[i]->invisible = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_81C8010(void)
|
||||
{
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
if (structPtr->leftHeaderSprites[0]->callback == SpriteCallbackDummy && structPtr->submenuLeftHeaderSprites[0]->callback == SpriteCallbackDummy)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void ShowLeftHeaderSprites(u32 startY, bool32 isOnRightSide)
|
||||
{
|
||||
s32 start, end, i;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
if (!isOnRightSide)
|
||||
start = -96, end = 32;
|
||||
else
|
||||
start = 256, end = 160;
|
||||
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
|
||||
{
|
||||
structPtr->leftHeaderSprites[i]->pos1.y = startY;
|
||||
MoveLeftHeader(structPtr->leftHeaderSprites[i], start, end, 12);
|
||||
}
|
||||
}
|
||||
|
||||
void ShowLeftHeaderSubmenuSprites(u32 startY, bool32 isOnRightSide)
|
||||
{
|
||||
s32 start, end, i;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
if (!isOnRightSide)
|
||||
start = -96, end = 16;
|
||||
else
|
||||
start = 256, end = 192;
|
||||
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->submenuLeftHeaderSprites); i++)
|
||||
{
|
||||
structPtr->submenuLeftHeaderSprites[i]->pos1.y = startY;
|
||||
MoveLeftHeader(structPtr->submenuLeftHeaderSprites[i], start, end, 12);
|
||||
}
|
||||
}
|
||||
|
||||
void HideLeftHeaderSprites(bool32 isOnRightSide)
|
||||
{
|
||||
s32 start, end, i;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
if (!isOnRightSide)
|
||||
start = 32, end = -96;
|
||||
else
|
||||
start = 192, end = 256;
|
||||
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->leftHeaderSprites); i++)
|
||||
{
|
||||
MoveLeftHeader(structPtr->leftHeaderSprites[i], start, end, 12);
|
||||
}
|
||||
}
|
||||
|
||||
void HideLeftHeaderSubmenuSprites(bool32 isOnRightSide)
|
||||
{
|
||||
s32 start, end, i;
|
||||
struct PokenavMainMenuResources *structPtr = GetSubstructPtr(0);
|
||||
|
||||
if (!isOnRightSide)
|
||||
start = 16, end = -96;
|
||||
else
|
||||
start = 192, end = 256;
|
||||
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(structPtr->submenuLeftHeaderSprites); i++)
|
||||
{
|
||||
MoveLeftHeader(structPtr->submenuLeftHeaderSprites[i], start, end, 12);
|
||||
}
|
||||
}
|
||||
|
||||
void MoveLeftHeader(struct Sprite *sprite, s32 startX, s32 endX, s32 duration)
|
||||
{
|
||||
sprite->pos1.x = startX;
|
||||
sprite->data[0] = startX * 16;
|
||||
sprite->data[1] = (endX - startX) * 16 / duration;
|
||||
sprite->data[2] = duration;
|
||||
sprite->data[7] = endX;
|
||||
sprite->callback = SpriteCB_MoveLeftHeader;
|
||||
}
|
||||
|
||||
void SpriteCB_MoveLeftHeader(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[2] != 0)
|
||||
{
|
||||
sprite->data[2]--;
|
||||
sprite->data[0] += sprite->data[1];
|
||||
sprite->pos1.x = sprite->data[0] >> 4;
|
||||
if (sprite->pos1.x < -16 || sprite->pos1.x > 256)
|
||||
sprite->invisible = TRUE;
|
||||
else
|
||||
sprite->invisible = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->pos1.x = sprite->data[7];
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
1266
src/pokenav_match_call_ui.c
Normal file
1266
src/pokenav_match_call_ui.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -169,7 +169,7 @@ gUnknown_02022D00: @ 2022D00
|
||||
.include "src/unk_pokedex_area_screen_helper.o"
|
||||
.include "src/battle_pyramid_bag.o"
|
||||
.include "src/pokenav.o"
|
||||
|
||||
.include "src/pokenav_match_call_ui.o"
|
||||
.include "src/menu_specialized.o"
|
||||
.include "src/faraway_island.o"
|
||||
.include "src/trainer_hill.o"
|
||||
|
Loading…
Reference in New Issue
Block a user