Merge branch 'master' of https://github.com/pret/pokeemerald into decompile_pokedex

This commit is contained in:
golem galvanize 2018-04-25 00:28:57 -04:00
commit 6a401b5386
68 changed files with 4728 additions and 8948 deletions

View File

@ -554,7 +554,7 @@ _080A60E8:
ldrh r0, [r1, 0x2]
cmp r0, 0
bne _080A610C
ldr r1, =gAnimSpeciesByBanks
ldr r1, =gAnimBattlerSpecies
lsls r0, r4, 1
adds r0, r1
ldrh r1, [r0]
@ -1224,7 +1224,7 @@ _080A65D8:
bl sub_80A62DC
_080A65DE:
adds r0, r4, 0
bl sub_80D30DC
bl UpdateMonIconFrame
pop {r4}
pop {r0}
bx r0

File diff suppressed because it is too large Load Diff

View File

@ -3326,7 +3326,7 @@ _0819064A:
adds r6, 0x1
cmp r6, 0xF
ble _0819064A
bl sub_80D2F04
bl LoadMonIconPalettes
ldr r0, =sub_8190CD4
movs r1, 0
bl CreateTask
@ -3695,7 +3695,7 @@ sub_8190938: @ 8190938
cmp r0, 0
bne _0819094A
adds r0, r1, 0
bl sub_80D30DC
bl UpdateMonIconFrame
_0819094A:
pop {r0}
bx r0
@ -3710,7 +3710,7 @@ sub_8190950: @ 8190950
cmp r0, 0
bne _08190962
adds r0, r4, 0
bl sub_80D30DC
bl UpdateMonIconFrame
_08190962:
ldrh r0, [r4, 0x22]
adds r1, r0, 0x4
@ -3774,7 +3774,7 @@ sub_81909CC: @ 81909CC
cmp r0, 0
bne _081909DE
adds r0, r4, 0
bl sub_80D30DC
bl UpdateMonIconFrame
_081909DE:
ldrh r0, [r4, 0x22]
subs r1, r0, 0x4
@ -3838,7 +3838,7 @@ sub_8190A48: @ 8190A48
cmp r0, 0
bne _08190A5A
adds r0, r4, 0
bl sub_80D30DC
bl UpdateMonIconFrame
_08190A5A:
ldrh r0, [r4, 0x20]
adds r1, r0, 0x4
@ -3902,7 +3902,7 @@ sub_8190AC4: @ 8190AC4
cmp r0, 0
bne _08190AD6
adds r0, r4, 0
bl sub_80D30DC
bl UpdateMonIconFrame
_08190AD6:
ldrh r0, [r4, 0x20]
subs r1, r0, 0x4
@ -6471,7 +6471,7 @@ _0819218E:
adds r6, 0x1
cmp r6, 0xF
ble _08192158
bl sub_80D2F9C
bl FreeMonIconPalettes
ldr r4, =gUnknown_0203CD78
ldr r0, [r4]
bl Free

View File

@ -1,975 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start InitDewfordTrend
InitDewfordTrend: @ 81224D4
push {r4-r7,lr}
movs r6, 0
ldr r5, =gSaveBlock1Ptr
_081224DA:
movs r0, 0xA
bl sub_811EE38
ldr r1, [r5]
lsls r4, r6, 3
adds r1, r4
ldr r2, =0x00002e6c
adds r1, r2
strh r0, [r1]
bl Random
movs r1, 0x1
ands r1, r0
cmp r1, 0
beq _08122514
movs r0, 0xC
bl sub_811EE38
ldr r1, [r5]
adds r1, r4
ldr r7, =0x00002e6e
adds r1, r7
b _08122522
.pool
_08122514:
movs r0, 0xD
bl sub_811EE38
ldr r1, [r5]
adds r1, r4
ldr r2, =0x00002e6e
adds r1, r2
_08122522:
strh r0, [r1]
bl Random
ldr r3, [r5]
adds r3, r4
movs r2, 0x1
ands r2, r0
ldr r7, =0x00002e69
adds r3, r7
lsls r2, 6
ldrb r0, [r3]
movs r7, 0x41
negs r7, r7
adds r1, r7, 0
ands r0, r1
orrs r0, r2
strb r0, [r3]
ldr r0, =0x00002e68
adds r1, r4, r0
ldr r0, [r5]
adds r0, r1
bl sub_8122B28
adds r0, r6, 0x1
lsls r0, 16
lsrs r6, r0, 16
cmp r6, 0x4
bls _081224DA
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x00002e68
adds r0, r1
movs r1, 0x5
movs r2, 0
bl sub_8122804
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end InitDewfordTrend
thumb_func_start UpdateDewfordTrendPerDay
UpdateDewfordTrendPerDay: @ 8122580
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
lsls r0, 16
lsrs r1, r0, 16
cmp r1, 0
bne _08122596
b _081226BE
_08122596:
lsls r0, r1, 2
adds r0, r1
str r0, [sp]
movs r0, 0
mov r10, r0
movs r1, 0x7F
mov r9, r1
movs r2, 0x80
negs r2, r2
mov r8, r2
_081225AA:
ldr r2, [sp]
mov r3, r10
lsls r0, r3, 3
ldr r4, =0x00002e68
adds r0, r4
ldr r3, =gSaveBlock1Ptr
ldr r1, [r3]
adds r5, r1, r0
ldrb r6, [r5, 0x1]
movs r0, 0x40
ands r0, r6
cmp r0, 0
bne _08122608
ldrb r4, [r5]
lsls r3, r4, 25
lsrs r1, r3, 25
lsls r0, r2, 16
lsrs r0, 16
cmp r1, r0
bcc _081225F8
adds r0, r1, 0
subs r0, r2
mov r1, r9
ands r0, r1
mov r1, r8
ands r1, r4
orrs r1, r0
strb r1, [r5]
movs r0, 0x7F
ands r1, r0
cmp r1, 0
bne _0812269E
movs r0, 0x40
orrs r0, r6
b _0812269C
.pool
_081225F8:
lsrs r0, r3, 25
subs r2, r0
mov r0, r8
ands r0, r4
strb r0, [r5]
movs r0, 0x40
orrs r0, r6
strb r0, [r5, 0x1]
_08122608:
ldrb r7, [r5]
lsls r0, r7, 25
lsrs r0, 25
adds r4, r0, r2
ldrh r0, [r5]
lsls r6, r0, 18
lsls r0, r4, 16
lsrs r0, 16
lsrs r1, r6, 25
cmp r0, r1
bls _08122678
adds r0, r4, 0
bl __umodsi3
adds r3, r0, 0
lsrs r1, r6, 25
adds r0, r4, 0
str r3, [sp, 0x4]
bl __udivsi3
adds r4, r0, 0
movs r0, 0x1
eors r4, r0
ands r4, r0
lsls r2, r4, 6
ldrb r0, [r5, 0x1]
movs r4, 0x41
negs r4, r4
adds r1, r4, 0
ands r0, r1
orrs r0, r2
strb r0, [r5, 0x1]
movs r1, 0x40
ands r0, r1
ldr r3, [sp, 0x4]
cmp r0, 0
beq _08122662
adds r1, r3, 0
mov r0, r9
ands r1, r0
mov r0, r8
ands r0, r7
orrs r0, r1
strb r0, [r5]
b _0812269E
_08122662:
ldrh r0, [r5]
lsls r0, 18
lsrs r0, 25
subs r0, r3
mov r1, r9
ands r0, r1
mov r1, r8
ands r1, r7
orrs r1, r0
strb r1, [r5]
b _0812269E
_08122678:
mov r2, r9
ands r4, r2
mov r0, r8
ands r0, r7
orrs r0, r4
strb r0, [r5]
lsls r0, 25
ldrh r1, [r5]
lsls r1, 18
lsrs r0, 25
lsrs r1, 25
cmp r0, r1
bne _0812269E
ldrb r0, [r5, 0x1]
movs r3, 0x41
negs r3, r3
adds r1, r3, 0
ands r0, r1
_0812269C:
strb r0, [r5, 0x1]
_0812269E:
mov r0, r10
adds r0, 0x1
lsls r0, 16
lsrs r0, 16
mov r10, r0
cmp r0, 0x4
bhi _081226AE
b _081225AA
_081226AE:
ldr r4, =gSaveBlock1Ptr
ldr r0, [r4]
ldr r1, =0x00002e68
adds r0, r1
movs r1, 0x5
movs r2, 0
bl sub_8122804
_081226BE:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end UpdateDewfordTrendPerDay
thumb_func_start sub_81226D8
sub_81226D8: @ 81226D8
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x8
mov r8, r0
movs r0, 0
movs r1, 0
str r0, [sp]
str r1, [sp, 0x4]
mov r0, r8
bl sub_8122BB0
lsls r0, 24
cmp r0, 0
beq _081226F8
b _081227F2
_081226F8:
ldr r4, =0x00000893
adds r0, r4, 0
bl FlagGet
lsls r0, 24
cmp r0, 0
bne _08122744
adds r0, r4, 0
bl FlagSet
ldr r0, =0x00000894
bl FlagGet
lsls r0, 24
cmp r0, 0
bne _08122744
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
mov r0, r8
ldrh r2, [r0]
ldr r3, =0x00002e6c
adds r0, r1, r3
strh r2, [r0]
mov r2, r8
ldrh r0, [r2, 0x2]
adds r3, 0x2
adds r1, r3
strh r0, [r1]
movs r0, 0x1
b _081227F4
.pool
_08122744:
mov r0, r8
ldrh r1, [r0, 0x2]
lsls r1, 16
ldrh r0, [r0]
orrs r0, r1
str r0, [sp, 0x4]
movs r1, 0x80
lsls r1, 7
ldr r0, [sp]
orrs r0, r1
str r0, [sp]
mov r0, sp
bl sub_8122B28
movs r5, 0
_08122762:
ldr r6, =gSaveBlock1Ptr
lsls r4, r5, 3
ldr r1, =0x00002e68
adds r0, r4, r1
ldr r1, [r6]
adds r1, r0
mov r0, sp
movs r2, 0
bl atk90_changetypestoenemyattacktype
lsls r0, 24
adds r7, r4, 0
cmp r0, 0
beq _081227D4
movs r2, 0x4
mov r12, r6
cmp r2, r5
bls _081227A6
ldr r4, =0x00002e68
_08122788:
ldr r0, [r6]
lsls r3, r2, 3
adds r0, r4
adds r3, r0, r3
subs r2, 0x1
lsls r1, r2, 3
adds r0, r1
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [r3]
str r1, [r3, 0x4]
lsls r2, 16
lsrs r2, 16
cmp r2, r5
bhi _08122788
_081227A6:
mov r3, r12
ldr r2, [r3]
ldr r0, =0x00002e68
adds r2, r0
adds r2, r7
ldr r0, [sp]
ldr r1, [sp, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
cmp r5, 0x4
bne _081227C2
mov r0, r8
bl sub_80EDC60
_081227C2:
movs r0, 0
cmp r5, 0
bne _081227F4
movs r0, 0x1
b _081227F4
.pool
_081227D4:
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x4
bls _08122762
ldr r2, [r6]
ldr r1, =0x00002e88
adds r2, r1
ldr r0, [sp]
ldr r1, [sp, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
mov r0, r8
bl sub_80EDC60
_081227F2:
movs r0, 0
_081227F4:
add sp, 0x8
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_81226D8
thumb_func_start sub_8122804
sub_8122804: @ 8122804
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
mov r9, r0
lsls r1, 16
lsrs r7, r1, 16
lsls r2, 24
lsrs r2, 24
mov r10, r2
movs r2, 0
cmp r2, r7
bcs _0812286C
_08122820:
adds r1, r2, 0x1
lsls r0, r1, 16
lsrs r5, r0, 16
mov r8, r1
cmp r5, r7
bcs _08122862
lsls r0, r2, 3
mov r1, r9
adds r6, r1, r0
_08122832:
lsls r0, r5, 3
mov r1, r9
adds r4, r1, r0
adds r0, r4, 0
adds r1, r6, 0
mov r2, r10
bl atk90_changetypestoenemyattacktype
lsls r0, 24
cmp r0, 0
beq _08122858
ldr r2, [r4]
ldr r3, [r4, 0x4]
ldr r0, [r6]
ldr r1, [r6, 0x4]
str r0, [r4]
str r1, [r4, 0x4]
str r2, [r6]
str r3, [r6, 0x4]
_08122858:
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, r7
bcc _08122832
_08122862:
mov r1, r8
lsls r0, r1, 16
lsrs r2, r0, 16
cmp r2, r7
bcc _08122820
_0812286C:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8122804
thumb_func_start sub_812287C
sub_812287C: @ 812287C
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x4
mov r8, r0
adds r6, r1, 0
movs r4, 0x80
lsls r4, 1
adds r0, r4, 0
bl Alloc
mov r10, r0
cmp r0, 0
beq _08122980
adds r0, r4, 0
bl Alloc
adds r7, r0, 0
cmp r7, 0
bne _081228B0
mov r0, r10
bl Free
b _08122980
_081228B0:
bl GetLinkPlayerCount
lsls r0, 24
lsrs r0, 24
mov r9, r0
movs r5, 0
cmp r5, r9
bcs _081228DE
_081228C0:
lsls r0, r5, 2
adds r0, r5
lsls r0, 3
add r0, r10
adds r1, r5, 0
muls r1, r6
add r1, r8
movs r2, 0x28
bl memcpy
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, r9
bcc _081228C0
_081228DE:
mov r4, r10
mov r8, r7
movs r3, 0
movs r5, 0
cmp r5, r9
bcs _08122946
_081228EA:
movs r6, 0
_081228EC:
adds r0, r7, 0
adds r1, r4, 0
adds r2, r3, 0
str r3, [sp]
bl sub_8122C1C
lsls r0, 16
asrs r0, 16
ldr r3, [sp]
cmp r0, 0
bge _08122918
ldr r0, [r4]
ldr r1, [r4, 0x4]
mov r2, r8
adds r2, 0x8
mov r8, r2
subs r2, 0x8
stm r2!, {r0,r1}
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
b _08122930
_08122918:
lsls r0, 3
adds r2, r7, r0
ldrb r1, [r2]
lsls r1, 25
ldrb r0, [r4]
lsls r0, 25
cmp r1, r0
bcs _08122930
ldr r0, [r4]
ldr r1, [r4, 0x4]
str r0, [r2]
str r1, [r2, 0x4]
_08122930:
adds r4, 0x8
adds r0, r6, 0x1
lsls r0, 16
lsrs r6, r0, 16
cmp r6, 0x4
bls _081228EC
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, r9
bcc _081228EA
_08122946:
adds r0, r7, 0
adds r1, r3, 0
movs r2, 0x2
bl sub_8122804
adds r4, r7, 0
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r1, =0x00002e68
adds r1, r0
mov r8, r1
movs r5, 0
_0812295E:
ldm r4!, {r0,r1}
mov r2, r8
adds r2, 0x8
mov r8, r2
subs r2, 0x8
stm r2!, {r0,r1}
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x4
bls _0812295E
mov r0, r10
bl Free
adds r0, r7, 0
bl Free
_08122980:
add sp, 0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_812287C
thumb_func_start sub_8122998
sub_8122998: @ 8122998
push {lr}
ldr r2, =gSaveBlock1Ptr
ldr r0, =gSpecialVar_0x8004
ldrh r1, [r0]
lsls r1, 3
ldr r0, [r2]
adds r1, r0
ldr r0, =gStringVar1
ldr r2, =0x00002e6c
adds r1, r2
movs r2, 0x2
movs r3, 0x1
bl ConvertEasyChatWordsToString
pop {r0}
bx r0
.pool
thumb_func_end sub_8122998
thumb_func_start sub_81229C8
sub_81229C8: @ 81229C8
push {r4,lr}
movs r4, 0
ldr r0, =gSaveBlock1Ptr
ldr r3, [r0]
ldr r1, =0x00002e68
adds r0, r3, r1
ldrb r1, [r0]
lsls r1, 25
lsrs r1, 25
ldr r2, =0x00002e70
adds r0, r3, r2
ldrb r0, [r0]
lsls r0, 25
lsrs r0, 25
subs r1, r0
cmp r1, 0x1
bgt _08122A0C
ldr r1, =0x00002e69
adds r0, r3, r1
ldrb r1, [r0]
movs r2, 0x40
adds r0, r2, 0
ands r0, r1
cmp r0, 0
bne _08122A0C
ldr r1, =0x00002e71
adds r0, r3, r1
ldrb r1, [r0]
adds r0, r2, 0
ands r0, r1
lsls r0, 24
lsrs r0, 24
negs r0, r0
lsrs r4, r0, 31
_08122A0C:
ldr r0, =gSpecialVar_Result
strh r4, [r0]
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81229C8
thumb_func_start sub_8122A30
sub_8122A30: @ 8122A30
ldr r2, =gSpecialVar_Result
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r3, =0x00002e6c
adds r1, r0, r3
adds r3, 0x2
adds r0, r3
ldrh r0, [r0]
ldrh r1, [r1]
adds r0, r1
movs r1, 0x7
ands r0, r1
strh r0, [r2]
bx lr
.pool
thumb_func_end sub_8122A30
thumb_func_start atk90_changetypestoenemyattacktype
atk90_changetypestoenemyattacktype: @ 8122A58
push {r4,r5,lr}
adds r3, r0, 0
adds r5, r1, 0
lsls r2, 24
lsrs r2, 24
adds r0, r2, 0
cmp r2, 0x1
beq _08122A9E
cmp r2, 0x1
bgt _08122A72
cmp r2, 0
beq _08122A78
b _08122B1A
_08122A72:
cmp r0, 0x2
beq _08122ACA
b _08122B1A
_08122A78:
ldrb r0, [r3]
lsls r1, r0, 25
ldrb r0, [r5]
lsls r0, 25
cmp r1, r0
bhi _08122B16
cmp r1, r0
bcc _08122AC6
ldrh r0, [r3]
lsls r3, r0, 18
ldrh r0, [r5]
lsls r2, r0, 18
lsrs r1, r3, 25
lsrs r0, r2, 25
cmp r1, r0
bhi _08122B16
lsrs r1, r3, 25
lsrs r0, r2, 25
b _08122AC2
_08122A9E:
ldrh r0, [r3]
lsls r4, r0, 18
ldrh r0, [r5]
lsls r2, r0, 18
lsrs r1, r4, 25
lsrs r0, r2, 25
cmp r1, r0
bhi _08122B16
lsrs r1, r4, 25
lsrs r0, r2, 25
cmp r1, r0
bcc _08122AC6
ldrb r0, [r3]
lsls r1, r0, 25
ldrb r0, [r5]
lsls r0, 25
cmp r1, r0
bhi _08122B16
_08122AC2:
cmp r1, r0
bcs _08122B1A
_08122AC6:
movs r0, 0
b _08122B22
_08122ACA:
ldrb r0, [r3]
lsls r1, r0, 25
ldrb r0, [r5]
lsls r0, 25
cmp r1, r0
bhi _08122B16
cmp r1, r0
bcc _08122AC6
ldrh r0, [r3]
lsls r4, r0, 18
ldrh r0, [r5]
lsls r2, r0, 18
lsrs r1, r4, 25
lsrs r0, r2, 25
cmp r1, r0
bhi _08122B16
lsrs r1, r4, 25
lsrs r0, r2, 25
cmp r1, r0
bcc _08122AC6
ldrh r1, [r3, 0x2]
ldrh r0, [r5, 0x2]
cmp r1, r0
bhi _08122B16
cmp r1, r0
bcc _08122AC6
ldrh r1, [r3, 0x4]
ldrh r0, [r5, 0x4]
cmp r1, r0
bhi _08122B16
cmp r1, r0
bcc _08122AC6
ldrh r1, [r3, 0x6]
ldrh r0, [r5, 0x6]
cmp r1, r0
bhi _08122B16
cmp r1, r0
bcc _08122AC6
_08122B16:
movs r0, 0x1
b _08122B22
_08122B1A:
bl Random
movs r1, 0x1
ands r0, r1
_08122B22:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end atk90_changetypestoenemyattacktype
thumb_func_start sub_8122B28
sub_8122B28: @ 8122B28
push {r4,r5,lr}
adds r5, r0, 0
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x62
bl __umodsi3
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x32
bls _08122B6A
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x62
bl __umodsi3
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x50
bls _08122B6A
bl Random
lsls r0, 16
lsrs r0, 16
movs r1, 0x62
bl __umodsi3
lsls r0, 16
lsrs r4, r0, 16
_08122B6A:
adds r1, r4, 0
adds r1, 0x1E
movs r0, 0x7F
ands r1, r0
lsls r1, 7
ldrh r2, [r5]
ldr r0, =0xffffc07f
ands r0, r2
orrs r0, r1
strh r0, [r5]
bl Random
lsls r0, 16
lsrs r0, 16
adds r1, r4, 0x1
bl __modsi3
adds r0, 0x1E
movs r1, 0x7F
ands r0, r1
ldrb r2, [r5]
movs r1, 0x80
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r5]
bl Random
strh r0, [r5, 0x2]
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8122B28
thumb_func_start sub_8122BB0
sub_8122BB0: @ 8122BB0
push {r4-r6,lr}
adds r5, r0, 0
movs r4, 0
ldr r6, =gSaveBlock1Ptr
_08122BB8:
lsls r1, r4, 3
ldr r0, [r6]
adds r1, r0
ldr r0, =0x00002e6c
adds r1, r0
adds r0, r5, 0
bl sub_8122BF0
lsls r0, 24
cmp r0, 0
beq _08122BDC
movs r0, 0x1
b _08122BE8
.pool
_08122BDC:
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x4
bls _08122BB8
movs r0, 0
_08122BE8:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_8122BB0
thumb_func_start sub_8122BF0
sub_8122BF0: @ 8122BF0
push {r4,lr}
adds r3, r0, 0
adds r2, r1, 0
movs r4, 0
_08122BF8:
ldrh r1, [r3]
ldrh r0, [r2]
adds r2, 0x2
adds r3, 0x2
cmp r1, r0
beq _08122C08
movs r0, 0
b _08122C14
_08122C08:
adds r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0x1
bls _08122BF8
movs r0, 0x1
_08122C14:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8122BF0
thumb_func_start sub_8122C1C
sub_8122C1C: @ 8122C1C
push {r4-r7,lr}
adds r5, r0, 0
adds r7, r1, 0
lsls r2, 16
lsrs r6, r2, 16
movs r4, 0
cmp r4, r6
bge _08122C52
_08122C2C:
adds r1, r5, 0x4
adds r0, r7, 0x4
bl sub_8122BF0
lsls r0, 24
cmp r0, 0
beq _08122C40
lsls r0, r4, 16
asrs r0, 16
b _08122C56
_08122C40:
adds r5, 0x8
lsls r0, r4, 16
movs r1, 0x80
lsls r1, 9
adds r0, r1
lsrs r4, r0, 16
asrs r0, 16
cmp r0, r6
blt _08122C2C
_08122C52:
movs r0, 0x1
negs r0, r0
_08122C56:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_8122C1C
.align 2, 0 @ Don't pad with nop.

File diff suppressed because it is too large Load Diff

View File

@ -1071,7 +1071,7 @@ sub_808B164: @ 808B164
adds r0, r6, 0
adds r1, r5, 0
adds r2, r4, 0
bl sub_80FBFD4
bl CheckForRotatingGatePuzzleCollisionWithoutAnimation
cmp r0, 0
beq _0808B1A2
movs r0, 0x8

View File

@ -1,570 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_80D47D4
sub_80D47D4: @ 80D47D4
push {lr}
bl HideStartMenu
bl ShowMapNamePopup
movs r0, 0x1
pop {r1}
bx r1
thumb_func_end sub_80D47D4
thumb_func_start ShowMapNamePopup
ShowMapNamePopup: @ 80D47E4
push {r4,lr}
movs r0, 0x80
lsls r0, 7
bl FlagGet
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080D486C
ldr r4, =Task_MapNamePopUpWindow
adds r0, r4, 0
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _080D4844
adds r0, r4, 0
movs r1, 0x5A
bl CreateTask
ldr r4, =gUnknown_02039DD4
strb r0, [r4]
movs r0, 0x12
movs r1, 0x28
bl SetGpuReg
ldr r2, =gTasks
ldrb r1, [r4]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x6
strh r1, [r0, 0x8]
ldrb r1, [r4]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x28
strh r1, [r0, 0xC]
b _080D486C
.pool
_080D4844:
ldr r3, =gTasks
ldr r2, =gUnknown_02039DD4
ldrb r0, [r2]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r3
movs r4, 0x8
ldrsh r0, [r1, r4]
cmp r0, 0x2
beq _080D485E
movs r0, 0x2
strh r0, [r1, 0x8]
_080D485E:
ldrb r0, [r2]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r3
movs r0, 0x1
strh r0, [r1, 0xE]
_080D486C:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ShowMapNamePopup
thumb_func_start Task_MapNamePopUpWindow
Task_MapNamePopUpWindow: @ 80D487C
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r4, r1, r0
movs r2, 0x8
ldrsh r1, [r4, r2]
adds r3, r0, 0
cmp r1, 0x6
bhi _080D4966
lsls r0, r1, 2
ldr r1, =_080D48A8
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080D48A8:
.4byte _080D48DE
.4byte _080D4908
.4byte _080D4920
.4byte _080D4966
.4byte _080D494C
.4byte _080D4960
.4byte _080D48C4
_080D48C4:
ldrh r0, [r4, 0x10]
adds r0, 0x1
movs r1, 0
strh r0, [r4, 0x10]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1E
ble _080D4966
strh r1, [r4, 0x8]
strh r1, [r4, 0x10]
bl ShowMapNamePopUpWindow
b _080D4966
_080D48DE:
ldrh r0, [r4, 0xC]
subs r0, 0x2
movs r2, 0
strh r0, [r4, 0xC]
lsls r0, 16
cmp r0, 0
bgt _080D4966
strh r2, [r4, 0xC]
movs r0, 0x1
strh r0, [r4, 0x8]
ldr r0, =gUnknown_02039DD4
ldrb r1, [r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r3
strh r2, [r0, 0xA]
b _080D4966
.pool
_080D4908:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x78
ble _080D4966
movs r0, 0
strh r0, [r4, 0xA]
movs r0, 0x2
strh r0, [r4, 0x8]
b _080D4966
_080D4920:
ldrh r0, [r4, 0xC]
adds r0, 0x2
movs r1, 0
strh r0, [r4, 0xC]
lsls r0, 16
asrs r0, 16
cmp r0, 0x27
ble _080D4966
movs r0, 0x28
strh r0, [r4, 0xC]
movs r2, 0xE
ldrsh r0, [r4, r2]
cmp r0, 0
beq _080D4946
movs r0, 0x6
strh r0, [r4, 0x8]
strh r1, [r4, 0x10]
strh r1, [r4, 0xE]
b _080D4966
_080D4946:
movs r0, 0x4
strh r0, [r4, 0x8]
b _080D496E
_080D494C:
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_819746C
movs r0, 0x5
strh r0, [r4, 0x8]
b _080D4966
_080D4960:
bl HideMapNamePopUpWindow
b _080D496E
_080D4966:
ldrh r1, [r4, 0xC]
movs r0, 0x12
bl SetGpuReg
_080D496E:
pop {r4}
pop {r0}
bx r0
thumb_func_end Task_MapNamePopUpWindow
thumb_func_start HideMapNamePopUpWindow
HideMapNamePopUpWindow: @ 80D4974
push {lr}
ldr r0, =Task_MapNamePopUpWindow
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
beq _080D49A4
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_819746C
bl RemoveMapNamePopUpWindow
movs r0, 0x12
movs r1, 0
bl SetGpuReg_ForcedBlank
ldr r0, =gUnknown_02039DD4
ldrb r0, [r0]
bl DestroyTask
_080D49A4:
pop {r0}
bx r0
.pool
thumb_func_end HideMapNamePopUpWindow
thumb_func_start ShowMapNamePopUpWindow
ShowMapNamePopUpWindow: @ 80D49B0
push {r4,r5,lr}
sub sp, 0x24
bl InBattlePyramid
lsls r0, 24
cmp r0, 0
beq _080D4A08
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xBD
lsls r0, 1
cmp r1, r0
bne _080D49DC
mov r4, sp
adds r4, 0xF
ldr r0, =gUnknown_0857F544
ldr r1, [r0, 0x1C]
b _080D49F2
.pool
_080D49DC:
mov r4, sp
adds r4, 0xF
ldr r1, =gUnknown_0857F544
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r2, =0x00000cb2
adds r0, r2
ldrh r0, [r0]
lsls r0, 2
adds r0, r1
ldr r1, [r0]
_080D49F2:
adds r0, r4, 0
bl StringCopy
b _080D4A18
.pool
_080D4A08:
mov r4, sp
adds r4, 0xF
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
adds r0, r4, 0
movs r2, 0
bl GetMapName
_080D4A18:
bl AddMapNamePopUpWindow
bl LoadMapNamePopUpWindowBg
movs r0, 0x7
adds r1, r4, 0
movs r2, 0x50
bl GetStringCenterAlignXOffset
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
add r1, sp, 0xC
movs r5, 0
movs r0, 0xFC
strb r0, [r1]
movs r0, 0x2
strb r0, [r1, 0x1]
adds r0, r1, 0
strb r5, [r0, 0x2]
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x3
str r1, [sp]
movs r1, 0xFF
str r1, [sp, 0x4]
str r5, [sp, 0x8]
movs r1, 0x7
add r2, sp, 0xC
adds r3, r4, 0
bl PrintTextOnWindow
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x3
bl CopyWindowToVram
add sp, 0x24
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end ShowMapNamePopUpWindow
thumb_func_start sub_80D4A78
sub_80D4A78: @ 80D4A78
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x1C
ldr r4, [sp, 0x3C]
lsls r0, 24
lsrs r7, r0, 24
lsls r1, 24
lsrs r1, 24
mov r10, r1
lsls r2, 24
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0x10]
lsls r4, 24
lsrs r4, 24
str r4, [sp, 0x14]
movs r5, 0
lsls r0, r1, 24
asrs r1, r0, 24
lsrs r3, r2, 24
str r3, [sp, 0xC]
movs r6, 0xFF
lsls r6, 24
adds r6, r2
mov r8, r6
str r0, [sp, 0x18]
subs r4, r1, 0x1
_080D4AB4:
ldr r0, =0x0000021d
adds r1, r5, r0
lsls r1, 16
lsrs r1, 16
lsls r2, r4, 24
lsrs r2, 24
movs r3, 0x1
str r3, [sp]
str r3, [sp, 0x4]
movs r6, 0xE
mov r9, r6
str r6, [sp, 0x8]
adds r0, r7, 0
mov r6, r8
lsrs r3, r6, 24
bl FillBgTilemapBufferRect
adds r4, 0x1
adds r5, 0x1
cmp r5, 0xB
ble _080D4AB4
ldr r1, =0x00000229
movs r0, 0x1
negs r0, r0
add r0, r10
lsls r0, 24
lsrs r0, 24
mov r8, r0
movs r5, 0x1
str r5, [sp]
str r5, [sp, 0x4]
mov r2, r9
str r2, [sp, 0x8]
adds r0, r7, 0
mov r2, r8
ldr r3, [sp, 0xC]
bl FillBgTilemapBufferRect
ldr r1, =0x0000022a
ldr r6, [sp, 0x10]
add r6, r10
lsls r6, 24
lsrs r6, 24
str r5, [sp]
str r5, [sp, 0x4]
mov r3, r9
str r3, [sp, 0x8]
adds r0, r7, 0
adds r2, r6, 0
ldr r3, [sp, 0xC]
bl FillBgTilemapBufferRect
ldr r1, =0x0000022b
ldr r4, [sp, 0xC]
adds r4, 0x1
lsls r4, 24
lsrs r4, 24
str r5, [sp]
str r5, [sp, 0x4]
mov r0, r9
str r0, [sp, 0x8]
adds r0, r7, 0
mov r2, r8
adds r3, r4, 0
bl FillBgTilemapBufferRect
movs r1, 0x8B
lsls r1, 2
str r5, [sp]
str r5, [sp, 0x4]
mov r2, r9
str r2, [sp, 0x8]
adds r0, r7, 0
adds r2, r6, 0
adds r3, r4, 0
bl FillBgTilemapBufferRect
ldr r1, =0x0000022d
ldr r4, [sp, 0xC]
adds r4, 0x2
lsls r4, 24
lsrs r4, 24
str r5, [sp]
str r5, [sp, 0x4]
mov r3, r9
str r3, [sp, 0x8]
adds r0, r7, 0
mov r2, r8
adds r3, r4, 0
bl FillBgTilemapBufferRect
ldr r1, =0x0000022e
str r5, [sp]
str r5, [sp, 0x4]
mov r0, r9
str r0, [sp, 0x8]
adds r0, r7, 0
adds r2, r6, 0
adds r3, r4, 0
bl FillBgTilemapBufferRect
movs r5, 0
ldr r1, [sp, 0xC]
ldr r2, [sp, 0x14]
adds r0, r1, r2
lsls r4, r0, 24
movs r6, 0x1
_080D4B8A:
ldr r3, =0x0000022f
adds r1, r5, r3
lsls r1, 16
lsrs r1, 16
subs r0, r5, 0x1
ldr r3, [sp, 0x18]
asrs r2, r3, 24
adds r2, r0
lsls r2, 24
lsrs r2, 24
str r6, [sp]
str r6, [sp, 0x4]
movs r0, 0xE
str r0, [sp, 0x8]
adds r0, r7, 0
lsrs r3, r4, 24
bl FillBgTilemapBufferRect
adds r5, 0x1
cmp r5, 0xB
ble _080D4B8A
add sp, 0x1C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D4A78
thumb_func_start LoadMapNamePopUpWindowBg
LoadMapNamePopUpWindowBg: @ 80D4BE0
push {r4,r5,lr}
sub sp, 0x8
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
cmp r1, 0x57
bls _080D4C0A
cmp r1, 0xC4
bls _080D4C08
adds r0, r1, 0
subs r0, 0x6D
lsls r0, 16
lsrs r1, r0, 16
b _080D4C0A
.pool
_080D4C08:
movs r1, 0
_080D4C0A:
ldr r0, =gUnknown_0857F464
adds r0, r1, r0
ldrb r4, [r0]
adds r0, r5, 0
movs r1, 0
bl GetWindowAttribute
lsls r0, 24
lsrs r0, 24
lsls r1, r4, 4
subs r1, r4
lsls r1, 6
ldr r2, =gMapPopUp_Outline_Table
adds r1, r2
movs r2, 0x80
lsls r2, 3
ldr r3, =0x0000021d
bl LoadBgTiles
ldr r1, =sub_80D4A78
adds r0, r5, 0
bl CallWindowFunction
adds r0, r5, 0
bl PutWindowTilemap
ldr r0, =gMapHeader
ldrb r0, [r0, 0x16]
cmp r0, 0xE
bne _080D4C6C
ldr r0, =gUnknown_0857F444
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
b _080D4C7A
.pool
_080D4C6C:
lsls r0, r4, 5
ldr r1, =gMapPopUp_Palette_Table
adds r0, r1
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
_080D4C7A:
lsls r1, r4, 4
subs r1, r4
lsls r1, 6
ldr r0, =gMapPopUp_Table
adds r1, r0
movs r0, 0x50
str r0, [sp]
movs r0, 0x18
str r0, [sp, 0x4]
adds r0, r5, 0
movs r2, 0
movs r3, 0
bl BlitBitmapToWindow
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end LoadMapNamePopUpWindowBg
.align 2, 0 @ Don't pad with nop.

View File

@ -1,474 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start walkrun_is_standing_still
walkrun_is_standing_still: @ 8098388
push {lr}
ldr r0, =gPlayerAvatar
ldrb r0, [r0, 0x3]
cmp r0, 0x1
beq _0809839C
movs r0, 0x1
b _0809839E
.pool
_0809839C:
movs r0, 0
_0809839E:
pop {r1}
bx r1
thumb_func_end walkrun_is_standing_still
thumb_func_start sub_80983A4
sub_80983A4: @ 80983A4
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl walkrun_is_standing_still
lsls r0, 24
cmp r0, 0
beq _080983BE
bl sub_808B864
adds r0, r4, 0
bl DestroyTask
_080983BE:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80983A4
thumb_func_start sub_80983C4
sub_80983C4: @ 80983C4
push {lr}
ldr r0, =sub_80983A4
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _080983E0
bl sub_808BCF4
movs r0, 0x1
b _080983E2
.pool
_080983E0:
movs r0, 0
_080983E2:
pop {r1}
bx r1
thumb_func_end sub_80983C4
thumb_func_start ScriptFreezeMapObjects
ScriptFreezeMapObjects: @ 80983E8
push {lr}
bl FreezeMapObjects
ldr r0, =sub_80983A4
movs r1, 0x50
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end ScriptFreezeMapObjects
thumb_func_start sub_8098400
sub_8098400: @ 8098400
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r0, r6, 2
adds r0, r6
lsls r0, 3
ldr r1, =gTasks
adds r5, r0, r1
movs r1, 0x8
ldrsh r0, [r5, r1]
cmp r0, 0
bne _0809842A
bl walkrun_is_standing_still
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x1
bne _0809842A
bl sub_808B864
strh r4, [r5, 0x8]
_0809842A:
movs r1, 0xA
ldrsh r0, [r5, r1]
cmp r0, 0
bne _08098452
ldr r2, =gMapObjects
ldr r0, =gSelectedMapObject
ldrb r1, [r0]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
adds r1, r0, r2
ldrb r0, [r1]
lsls r0, 30
cmp r0, 0
blt _08098452
adds r0, r1, 0
bl FreezeMapObject
movs r0, 0x1
strh r0, [r5, 0xA]
_08098452:
movs r1, 0x8
ldrsh r0, [r5, r1]
cmp r0, 0
beq _08098468
movs r1, 0xA
ldrsh r0, [r5, r1]
cmp r0, 0
beq _08098468
adds r0, r6, 0
bl DestroyTask
_08098468:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8098400
thumb_func_start sub_809847C
sub_809847C: @ 809847C
push {lr}
ldr r0, =sub_8098400
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _08098498
bl sub_808BCF4
movs r0, 0x1
b _0809849A
.pool
_08098498:
movs r0, 0
_0809849A:
pop {r1}
bx r1
thumb_func_end sub_809847C
thumb_func_start LockSelectedMapObject
LockSelectedMapObject: @ 80984A0
push {r4,r5,lr}
ldr r4, =gSelectedMapObject
ldrb r0, [r4]
bl FreezeMapObjectsExceptOne
ldr r0, =sub_8098400
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r5, r0, 24
ldr r2, =gMapObjects
ldrb r1, [r4]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
adds r1, r0, r2
ldrb r0, [r1]
lsls r0, 30
cmp r0, 0
blt _080984DE
adds r0, r1, 0
bl FreezeMapObject
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
movs r0, 0x1
strh r0, [r1, 0xA]
_080984DE:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end LockSelectedMapObject
thumb_func_start sub_80984F4
sub_80984F4: @ 80984F4
push {lr}
movs r0, 0xFF
movs r1, 0
movs r2, 0
bl GetFieldObjectIdByLocalIdAndMap
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gMapObjects
adds r0, r1
bl FieldObjectClearAnimIfSpecialAnimFinished
bl sub_80D338C
bl UnfreezeMapObjects
pop {r0}
bx r0
.pool
thumb_func_end sub_80984F4
thumb_func_start sub_8098524
sub_8098524: @ 8098524
push {r4,lr}
ldr r4, =gMapObjects
ldr r0, =gSelectedMapObject
ldrb r1, [r0]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
adds r1, r0, r4
ldrb r0, [r1]
lsls r0, 31
cmp r0, 0
beq _08098542
adds r0, r1, 0
bl FieldObjectClearAnimIfSpecialAnimFinished
_08098542:
movs r0, 0xFF
movs r1, 0
movs r2, 0
bl GetFieldObjectIdByLocalIdAndMap
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
adds r0, r4
bl FieldObjectClearAnimIfSpecialAnimFinished
bl sub_80D338C
bl UnfreezeMapObjects
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8098524
thumb_func_start sub_8098574
sub_8098574: @ 8098574
push {lr}
ldr r0, =gSelectedMapObject
ldrb r1, [r0]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gMapObjects
adds r0, r1
ldr r1, =gSpecialVar_Facing
ldrb r1, [r1]
bl FieldObjectFaceOppositeDirection
pop {r0}
bx r0
.pool
thumb_func_end sub_8098574
thumb_func_start sub_809859C
sub_809859C: @ 809859C
push {lr}
ldr r0, =gSelectedMapObject
ldrb r1, [r0]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gMapObjects
adds r0, r1
bl FieldObjectClearAnimIfSpecialAnimActive
pop {r0}
bx r0
.pool
thumb_func_end sub_809859C
thumb_func_start sub_80985BC
sub_80985BC: @ 80985BC
push {r4-r7,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r0, r6, 2
adds r0, r6
lsls r0, 3
ldr r1, =gTasks
adds r5, r0, r1
ldrb r7, [r5, 0xC]
movs r1, 0x8
ldrsh r0, [r5, r1]
cmp r0, 0
bne _080985E8
bl walkrun_is_standing_still
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x1
bne _080985E8
bl sub_808B864
strh r4, [r5, 0x8]
_080985E8:
movs r1, 0xA
ldrsh r0, [r5, r1]
cmp r0, 0
bne _0809860C
ldr r0, =gMapObjects
lsls r1, r7, 3
adds r1, r7
lsls r1, 2
adds r1, r0
ldrb r0, [r1]
lsls r0, 30
cmp r0, 0
blt _0809860C
adds r0, r1, 0
bl FreezeMapObject
movs r0, 0x1
strh r0, [r5, 0xA]
_0809860C:
movs r1, 0x8
ldrsh r0, [r5, r1]
cmp r0, 0
beq _08098622
movs r1, 0xA
ldrsh r0, [r5, r1]
cmp r0, 0
beq _08098622
adds r0, r6, 0
bl DestroyTask
_08098622:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80985BC
thumb_func_start sub_8098630
sub_8098630: @ 8098630
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
movs r0, 0
bl GetChosenApproachingTrainerMapObjectId
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gNoOfApproachingTrainers
ldrb r0, [r0]
cmp r0, 0x2
bne _080986E0
movs r0, 0x1
bl GetChosenApproachingTrainerMapObjectId
lsls r0, 24
lsrs r0, 24
adds r5, r0, 0
adds r0, r4, 0
adds r1, r5, 0
bl sub_8098074
ldr r7, =sub_80985BC
adds r0, r7, 0
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gTasks
mov r9, r0
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
mov r1, r9
adds r6, r0, r1
strh r4, [r6, 0xC]
ldr r2, =gMapObjects
mov r8, r2
lsls r0, r4, 3
adds r0, r4
lsls r0, 2
adds r1, r0, r2
ldrb r0, [r1]
lsls r0, 30
cmp r0, 0
blt _0809869A
adds r0, r1, 0
bl FreezeMapObject
movs r0, 0x1
strh r0, [r6, 0xA]
_0809869A:
adds r0, r7, 0
movs r1, 0x51
bl CreateTask
lsls r0, 24
lsrs r2, r0, 24
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
mov r1, r9
adds r4, r0, r1
strh r5, [r4, 0xC]
lsls r0, r5, 3
adds r0, r5
lsls r0, 2
mov r2, r8
adds r1, r0, r2
ldrb r0, [r1]
lsls r0, 30
cmp r0, 0
blt _0809871A
adds r0, r1, 0
bl FreezeMapObject
movs r0, 0x1
strh r0, [r4, 0xA]
b _0809871A
.pool
_080986E0:
adds r0, r4, 0
bl FreezeMapObjectsExceptOne
ldr r0, =sub_80985BC
movs r1, 0x50
bl CreateTask
lsls r0, 24
lsrs r2, r0, 24
ldr r1, =gTasks
lsls r0, r2, 2
adds r0, r2
lsls r0, 3
adds r5, r0, r1
strh r4, [r5, 0xC]
ldr r1, =gMapObjects
lsls r0, r4, 3
adds r0, r4
lsls r0, 2
adds r1, r0, r1
ldrb r0, [r1]
lsls r0, 30
cmp r0, 0
blt _0809871A
adds r0, r1, 0
bl FreezeMapObject
movs r0, 0x1
strh r0, [r5, 0xA]
_0809871A:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8098630
thumb_func_start sub_8098734
sub_8098734: @ 8098734
push {lr}
ldr r0, =sub_80985BC
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _08098750
bl sub_808BCF4
movs r0, 0x1
b _08098752
.pool
_08098750:
movs r0, 0
_08098752:
pop {r1}
bx r1
thumb_func_end sub_8098734
.align 2, 0 @ Don't pad with nop.

View File

@ -1,946 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_811F90C
sub_811F90C: @ 811F90C
ldr r1, =gUnknown_0203A124
str r0, [r1]
bx lr
.pool
thumb_func_end sub_811F90C
thumb_func_start sub_811F918
sub_811F918: @ 811F918
push {lr}
sub sp, 0x4
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldrb r0, [r0, 0x14]
lsrs r0, 3
bl GetWindowFrameTilesPal
ldr r3, =gUnknown_0203A124
ldr r2, [r3]
ldr r1, [r0]
str r1, [r2, 0x2C]
ldr r0, [r0, 0x4]
str r0, [r2, 0x30]
ldr r0, =0x000010b4
adds r2, r0
movs r1, 0
strb r1, [r2]
mov r0, sp
strh r1, [r0]
ldr r1, [r3]
adds r1, 0x34
ldr r2, =0x01000800
bl CpuSet
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end sub_811F918
thumb_func_start sub_811F960
sub_811F960: @ 811F960
push {r4-r7,lr}
ldr r0, =gUnknown_0203A124
ldr r1, [r0]
ldr r2, =0x000010b4
adds r0, r1, r2
ldrb r2, [r0]
lsls r0, r2, 8
adds r0, 0x34
adds r5, r1, r0
cmp r2, 0xD
beq _0811FA30
cmp r2, 0xD
bgt _0811F988
cmp r2, 0
beq _0811F98E
b _0811F9D8
.pool
_0811F988:
cmp r2, 0xE
beq _0811FA7C
b _0811F9D8
_0811F98E:
ldr r0, [r1, 0x2C]
adds r1, r5, 0
movs r2, 0x8
bl CpuFastSet
movs r4, 0
adds r7, r5, 0
adds r7, 0xE0
_0811F99E:
ldr r6, =gUnknown_0203A124
ldr r0, [r6]
ldr r0, [r0, 0x2C]
adds r0, 0x20
adds r4, 0x1
lsls r1, r4, 5
adds r1, r5, r1
movs r2, 0x8
bl CpuFastSet
lsls r4, 16
lsrs r4, 16
cmp r4, 0x5
bls _0811F99E
ldr r0, [r6]
ldr r0, [r0, 0x2C]
adds r0, 0x40
adds r1, r7, 0
movs r2, 0x8
bl CpuFastSet
ldr r1, [r6]
ldr r0, =0x000010b4
adds r1, r0
b _0811FA1E
.pool
_0811F9D8:
ldr r0, =gUnknown_0203A124
ldr r0, [r0]
ldr r0, [r0, 0x2C]
adds r0, 0x60
adds r1, r5, 0
movs r2, 0x8
bl CpuFastSet
movs r4, 0
adds r7, r5, 0
adds r7, 0xE0
_0811F9EE:
ldr r6, =gUnknown_0203A124
ldr r0, [r6]
ldr r0, [r0, 0x2C]
adds r0, 0x80
adds r4, 0x1
lsls r1, r4, 5
adds r1, r5, r1
movs r2, 0x8
bl CpuFastSet
lsls r4, 16
lsrs r4, 16
cmp r4, 0x5
bls _0811F9EE
ldr r0, [r6]
ldr r0, [r0, 0x2C]
adds r0, 0xA0
adds r1, r7, 0
movs r2, 0x8
bl CpuFastSet
ldr r1, [r6]
ldr r2, =0x000010b4
adds r1, r2
_0811FA1E:
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
b _0811FA88
.pool
_0811FA30:
ldr r0, [r1, 0x2C]
adds r0, 0xC0
adds r1, r5, 0
movs r2, 0x8
bl CpuFastSet
movs r4, 0
adds r7, r5, 0
adds r7, 0xE0
_0811FA42:
ldr r6, =gUnknown_0203A124
ldr r0, [r6]
ldr r0, [r0, 0x2C]
adds r0, 0xE0
adds r4, 0x1
lsls r1, r4, 5
adds r1, r5, r1
movs r2, 0x8
bl CpuFastSet
lsls r4, 16
lsrs r4, 16
cmp r4, 0x5
bls _0811FA42
ldr r0, [r6]
ldr r0, [r0, 0x2C]
movs r1, 0x80
lsls r1, 1
adds r0, r1
adds r1, r7, 0
movs r2, 0x8
bl CpuFastSet
ldr r1, [r6]
ldr r2, =0x000010b4
adds r1, r2
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
_0811FA7C:
movs r0, 0
b _0811FA8A
.pool
_0811FA88:
movs r0, 0x1
_0811FA8A:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_811F960
thumb_func_start sub_811FA90
sub_811FA90: @ 811FA90
push {lr}
bl sub_811F918
_0811FA96:
bl sub_811F960
lsls r0, 24
cmp r0, 0
bne _0811FA96
pop {r0}
bx r0
thumb_func_end sub_811FA90
thumb_func_start sub_811FAA4
sub_811FAA4: @ 811FAA4
push {r4-r7,lr}
lsls r1, 16
lsrs r5, r1, 16
lsls r2, 16
lsrs r6, r2, 16
ldr r2, =gUnknown_0203A124
ldr r3, [r2]
movs r1, 0
strb r1, [r3, 0x5]
ldr r1, [r2]
strb r0, [r1, 0x4]
movs r3, 0
adds r7, r2, 0
adds r4, r7, 0
movs r2, 0x1
_0811FAC2:
ldr r0, [r4]
adds r1, r0, 0x6
adds r1, r3
ldrb r0, [r0, 0x4]
asrs r0, r3
ands r0, r2
strb r0, [r1]
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
cmp r3, 0x3
bls _0811FAC2
lsls r0, r5, 16
asrs r0, 16
lsls r1, r6, 16
asrs r1, 16
ldr r3, [r7]
ldrh r2, [r3]
ldrh r3, [r3, 0x2]
bl sub_811FC80
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_811FAA4
thumb_func_start sub_811FAF8
sub_811FAF8: @ 811FAF8
push {r4-r7,lr}
movs r5, 0
ldr r4, =gUnknown_0203A124
_0811FAFE:
ldr r0, [r4]
ldrh r0, [r0]
adds r0, r5, r0
lsls r0, 16
lsrs r0, 16
bl FreeSpriteTilesByTag
ldr r0, [r4]
ldrh r0, [r0, 0x2]
adds r0, r5, r0
lsls r0, 16
lsrs r0, 16
bl FreeSpritePaletteByTag
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x1
bls _0811FAFE
movs r5, 0
ldr r6, =gUnknown_0203A124
_0811FB28:
ldr r0, [r6]
lsls r4, r5, 2
adds r0, 0xC
adds r0, r4
ldr r0, [r0]
cmp r0, 0
beq _0811FB9A
bl DestroySprite
ldr r0, [r6]
adds r0, 0xC
adds r0, r4
movs r1, 0
str r1, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x1
bls _0811FB28
movs r5, 0
ldr r6, =gUnknown_0203A124
_0811FB52:
ldr r0, [r6]
lsls r4, r5, 2
adds r0, 0x14
adds r0, r4
ldr r0, [r0]
cmp r0, 0
beq _0811FB9A
bl DestroySprite
ldr r0, [r6]
adds r0, 0x14
adds r0, r4
movs r7, 0
str r7, [r0]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x3
bls _0811FB52
ldr r4, =gUnknown_0203A124
ldr r0, [r4]
ldr r0, [r0, 0x24]
cmp r0, 0
beq _0811FB8A
bl DestroySprite
ldr r0, [r4]
str r7, [r0, 0x24]
_0811FB8A:
ldr r0, [r4]
ldr r0, [r0, 0x28]
cmp r0, 0
beq _0811FB9A
bl DestroySprite
ldr r0, [r4]
str r7, [r0, 0x28]
_0811FB9A:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_811FAF8
thumb_func_start sub_811FBA4
sub_811FBA4: @ 811FBA4
push {r4,r5,lr}
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
movs r0, 0x40
ands r0, r1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0
beq _0811FBDC
movs r0, 0x5
bl PlaySE
ldr r2, =gUnknown_0203A124
ldr r1, [r2]
ldrb r0, [r1, 0x5]
subs r0, 0x1
strb r0, [r1, 0x5]
lsls r0, 24
cmp r0, 0
bge _0811FC64
ldr r1, [r2]
movs r0, 0x5
strb r0, [r1, 0x5]
b _0811FC64
.pool
_0811FBDC:
movs r0, 0x80
ands r0, r1
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0
beq _0811FC0C
movs r0, 0x5
bl PlaySE
ldr r2, =gUnknown_0203A124
ldr r1, [r2]
ldrb r0, [r1, 0x5]
adds r0, 0x1
strb r0, [r1, 0x5]
lsls r0, 24
asrs r0, 24
cmp r0, 0x5
ble _0811FC64
ldr r0, [r2]
strb r5, [r0, 0x5]
b _0811FC64
.pool
_0811FC0C:
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _0811FC68
movs r0, 0x5
bl PlaySE
ldr r2, =gUnknown_0203A124
ldr r0, [r2]
movs r1, 0x5
ldrsb r1, [r0, r1]
cmp r1, 0x4
beq _0811FC40
cmp r1, 0x5
beq _0811FC76
adds r0, 0x6
adds r1, r0, r1
movs r2, 0
ldrb r0, [r1]
cmp r0, 0
bne _0811FC62
movs r2, 0x1
b _0811FC62
.pool
_0811FC40:
strb r4, [r0, 0x4]
movs r3, 0
adds r4, r2, 0
_0811FC46:
ldr r2, [r4]
adds r0, r2, 0x6
adds r0, r3
ldrb r0, [r0]
lsls r0, r3
ldrb r1, [r2, 0x4]
orrs r0, r1
strb r0, [r2, 0x4]
adds r0, r3, 0x1
lsls r0, 16
lsrs r3, r0, 16
cmp r3, 0x3
bls _0811FC46
b _0811FC76
_0811FC62:
strb r2, [r1]
_0811FC64:
movs r0, 0x1
b _0811FC78
_0811FC68:
movs r0, 0x2
ands r0, r1
cmp r0, 0
beq _0811FC64
movs r0, 0x5
bl PlaySE
_0811FC76:
movs r0, 0
_0811FC78:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_811FBA4
thumb_func_start sub_811FC80
sub_811FC80: @ 811FC80
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x50
mov r8, r0
mov r9, r1
adds r5, r2, 0
adds r6, r3, 0
lsls r0, 16
lsrs r0, 16
mov r8, r0
lsls r1, 16
lsrs r1, 16
mov r9, r1
lsls r5, 16
lsrs r5, 16
lsls r6, 16
lsrs r6, 16
ldr r4, =gUnknown_0203A124
ldr r0, [r4]
adds r0, 0x34
str r0, [sp, 0x18]
add r1, sp, 0x1C
movs r7, 0
movs r0, 0x80
lsls r0, 5
strh r0, [r1]
mov r0, sp
adds r0, 0x1E
strh r5, [r0]
add r1, sp, 0x20
ldr r0, =gPokenavConditionMarker_Gfx
str r0, [sp, 0x20]
movs r0, 0xC8
lsls r0, 2
strh r0, [r1, 0x4]
adds r0, r5, 0x1
strh r0, [r1, 0x6]
add r0, sp, 0x28
movs r1, 0
movs r2, 0x8
bl memset
add r2, sp, 0x18
mov r10, r2
mov r0, sp
mov r1, r10
movs r2, 0x18
bl memcpy
ldr r0, [r4]
ldr r0, [r0, 0x30]
str r0, [sp, 0x30]
add r0, sp, 0x34
strh r6, [r0]
add r1, sp, 0x38
ldr r0, =gPokenavConditionMarker_Pal
str r0, [sp, 0x38]
adds r0, r6, 0x1
strh r0, [r1, 0x4]
add r0, sp, 0x40
movs r1, 0
movs r2, 0x8
bl memset
add r4, sp, 0x30
mov r0, r10
adds r1, r4, 0
movs r2, 0x18
bl memcpy
strh r5, [r4]
strh r6, [r4, 0x2]
ldr r0, =gUnknown_0859EE7C
str r0, [r4, 0x4]
ldr r0, =gUnknown_0859EF14
str r0, [r4, 0x8]
str r7, [r4, 0xC]
ldr r0, =gDummySpriteAffineAnimTable
str r0, [r4, 0x10]
ldr r0, =TaskDummy7
str r0, [r4, 0x14]
mov r0, sp
bl LoadSpriteSheets
mov r0, r10
bl LoadSpritePalettes
movs r5, 0
mov r3, r8
lsls r3, 16
mov r8, r3
movs r0, 0x80
lsls r0, 14
add r0, r8
mov r10, r0
mov r1, r8
str r1, [sp, 0x48]
mov r2, r9
lsls r2, 16
mov r9, r2
movs r7, 0x80
lsls r7, 14
add r7, r9
mov r3, r9
str r3, [sp, 0x4C]
_0811FD58:
adds r0, r4, 0
mov r2, r10
asrs r1, r2, 16
asrs r2, r7, 16
movs r3, 0x1
bl CreateSprite
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x40
bne _0811FD70
b _0811FEFC
_0811FD70:
ldr r6, =gUnknown_0203A124
ldr r2, [r6]
lsls r0, r5, 2
adds r2, 0xC
adds r2, r0
lsls r0, r3, 4
adds r0, r3
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
str r0, [r2]
lsls r1, r5, 24
lsrs r1, 24
bl StartSpriteAnim
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x1
bls _0811FD58
ldr r0, [r6]
ldr r1, [r0, 0x10]
ldr r3, [sp, 0x4C]
asrs r0, r3, 16
adds r0, 0x60
strh r0, [r1, 0x22]
ldrh r0, [r4]
adds r0, 0x1
strh r0, [r4]
ldrh r0, [r4, 0x2]
adds r0, 0x1
strh r0, [r4, 0x2]
ldr r0, =gUnknown_0859EEDC
str r0, [r4, 0x8]
ldr r0, =sub_811FF40
str r0, [r4, 0x14]
ldr r0, =gUnknown_0859EE84
str r0, [r4, 0x4]
movs r5, 0
ldr r0, [sp, 0x48]
movs r1, 0x80
lsls r1, 14
adds r0, r1
mov r9, r0
_0811FDC8:
lsls r2, r5, 4
adds r2, 0x10
ldr r3, [sp, 0x4C]
asrs r3, 16
mov r8, r3
add r2, r8
lsls r2, 16
asrs r2, 16
adds r0, r4, 0
mov r3, r9
asrs r1, r3, 16
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x40
bne _0811FDEE
b _0811FF0C
_0811FDEE:
ldr r6, =gUnknown_0203A124
ldr r1, [r6]
lsls r0, r5, 2
adds r1, 0x14
adds r1, r0
lsls r0, r3, 4
adds r0, r3
lsls r0, 2
ldr r7, =gSprites
adds r0, r7
str r0, [r1]
strh r5, [r0, 0x2E]
adds r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
cmp r5, 0x3
bls _0811FDC8
ldr r0, =SpriteCallbackDummy
str r0, [r4, 0x14]
adds r0, r4, 0
movs r1, 0
movs r2, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x40
beq _0811FEA8
ldr r0, [r6]
lsls r1, r3, 4
adds r1, r3
lsls r1, 2
adds r1, r7
str r1, [r0, 0x28]
ldrb r3, [r1, 0x1]
movs r2, 0x3F
adds r0, r2, 0
ands r0, r3
strb r0, [r1, 0x1]
ldr r0, [r6]
ldr r1, [r0, 0x28]
ldrb r0, [r1, 0x3]
ands r2, r0
movs r0, 0x80
orrs r2, r0
strb r2, [r1, 0x3]
ldr r0, [r6]
ldr r0, [r0, 0x28]
movs r1, 0x9
bl StartSpriteAnim
ldr r1, [r6]
ldr r2, [r1, 0x28]
ldr r3, [sp, 0x48]
asrs r0, r3, 16
adds r0, 0x20
strh r0, [r2, 0x20]
ldr r2, [r1, 0x28]
mov r0, r8
adds r0, 0x50
strh r0, [r2, 0x22]
ldr r0, [r1, 0x28]
movs r1, 0x1
movs r2, 0x2
movs r3, 0
bl CalcCenterToCornerVec
b _0811FEAE
.pool
_0811FEA8:
ldr r1, [r6]
movs r0, 0
str r0, [r1, 0x28]
_0811FEAE:
ldr r0, =sub_811FF7C
str r0, [r4, 0x14]
ldr r0, [sp, 0x48]
movs r2, 0xC0
lsls r2, 12
adds r1, r0, r2
asrs r1, 16
adds r0, r4, 0
movs r2, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0x40
beq _0811FF20
ldr r0, =gUnknown_0203A124
ldr r2, [r0]
lsls r1, r3, 4
adds r1, r3
lsls r1, 2
ldr r0, =gSprites
adds r1, r0
str r1, [r2, 0x24]
ldr r3, [sp, 0x4C]
asrs r0, r3, 16
adds r0, 0x10
strh r0, [r1, 0x2E]
ldr r0, [r2, 0x24]
movs r1, 0x8
bl StartSpriteAnim
b _0811FF28
.pool
_0811FEFC:
ldr r0, =gUnknown_0203A124
ldr r0, [r0]
lsls r1, r5, 2
adds r0, 0xC
b _0811FF14
.pool
_0811FF0C:
ldr r0, =gUnknown_0203A124
ldr r0, [r0]
lsls r1, r5, 2
adds r0, 0x14
_0811FF14:
adds r0, r1
movs r1, 0
str r1, [r0]
b _0811FF28
.pool
_0811FF20:
ldr r0, =gUnknown_0203A124
ldr r1, [r0]
movs r0, 0
str r0, [r1, 0x24]
_0811FF28:
add sp, 0x50
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_811FC80
thumb_func_start TaskDummy7
TaskDummy7: @ 811FF3C
bx lr
thumb_func_end TaskDummy7
thumb_func_start sub_811FF40
sub_811FF40: @ 811FF40
push {lr}
adds r2, r0, 0
ldr r0, =gUnknown_0203A124
ldr r0, [r0]
movs r3, 0x2E
ldrsh r1, [r2, r3]
adds r0, 0x6
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
beq _0811FF6C
lsls r1, 1
adds r1, 0x1
lsls r1, 24
lsrs r1, 24
adds r0, r2, 0
bl StartSpriteAnim
b _0811FF76
.pool
_0811FF6C:
lsls r1, 25
lsrs r1, 24
adds r0, r2, 0
bl StartSpriteAnim
_0811FF76:
pop {r0}
bx r0
thumb_func_end sub_811FF40
thumb_func_start sub_811FF7C
sub_811FF7C: @ 811FF7C
ldr r1, =gUnknown_0203A124
ldr r1, [r1]
ldrb r1, [r1, 0x5]
lsls r1, 24
asrs r1, 24
lsls r1, 4
ldrh r2, [r0, 0x2E]
adds r1, r2
strh r1, [r0, 0x22]
bx lr
.pool
thumb_func_end sub_811FF7C
thumb_func_start sub_811FF94
sub_811FF94: @ 811FF94
push {lr}
lsls r0, 16
lsrs r0, 16
lsls r1, 16
lsrs r1, 16
cmp r2, 0
bne _0811FFA4
ldr r2, =gUnknown_0859E65C
_0811FFA4:
movs r3, 0x10
bl sub_811FFD4
pop {r1}
bx r1
.pool
thumb_func_end sub_811FF94
thumb_func_start sub_811FFB4
sub_811FFB4: @ 811FFB4
push {lr}
lsls r0, 16
lsrs r0, 16
lsls r1, 16
lsrs r1, 16
cmp r2, 0
bne _0811FFC4
ldr r2, =gUnknown_0859E65C
_0811FFC4:
movs r3, 0x1
bl sub_811FFD4
pop {r1}
bx r1
.pool
thumb_func_end sub_811FFB4
thumb_func_start sub_811FFD4
sub_811FFD4: @ 811FFD4
push {r4-r6,lr}
mov r6, r8
push {r6}
sub sp, 0x28
lsls r0, 16
lsls r1, 16
lsrs r1, 16
ldr r4, =gUnknown_0859E67C
str r4, [sp, 0x18]
movs r4, 0x80
add r5, sp, 0x18
lsrs r6, r0, 16
orrs r0, r4
str r0, [r5, 0x4]
str r2, [sp, 0x20]
ldr r0, =0xffff0000
mov r8, r0
add r4, sp, 0x20
ldr r0, [r4, 0x4]
mov r2, r8
ands r0, r2
orrs r0, r1
str r0, [r4, 0x4]
mov r0, sp
movs r2, 0
strh r6, [r0]
strh r1, [r0, 0x2]
ldr r0, =gUnknown_0859EF1C
str r0, [sp, 0x4]
ldr r0, =gUnknown_0859EFA4
str r0, [sp, 0x8]
str r2, [sp, 0xC]
ldr r0, =gDummySpriteAffineAnimTable
str r0, [sp, 0x10]
ldr r0, =TaskDummy7
str r0, [sp, 0x14]
lsls r3, 23
lsrs r3, 16
ldr r0, [r5, 0x4]
mov r1, r8
ands r0, r1
orrs r0, r3
str r0, [r5, 0x4]
adds r0, r5, 0
bl LoadSpriteSheet
adds r0, r4, 0
bl LoadSpritePalette
mov r0, sp
movs r1, 0
movs r2, 0
movs r3, 0
bl CreateSprite
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x40
bne _08120068
movs r0, 0
b _08120072
.pool
_08120068:
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
_08120072:
add sp, 0x28
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_811FFD4
thumb_func_start sub_8120084
sub_8120084: @ 8120084
push {lr}
lsls r0, 24
lsrs r0, 17
ldr r2, =gUnknown_0859E67C
adds r0, r2
movs r2, 0x80
movs r3, 0x10
bl RequestDma3Copy
pop {r0}
bx r0
.pool
thumb_func_end sub_8120084
.align 2, 0 @ Don't pad with nop.

View File

@ -410,7 +410,7 @@ _081B03A6:
b _081B048C
.pool
_081B03B8:
bl sub_80D2F04
bl LoadMonIconPalettes
b _081B0484
_081B03BE:
bl party_menu_add_per_mon_objects
@ -10793,7 +10793,7 @@ _081B5BD0:
sub_81B5BDC: @ 81B5BDC
push {r4,lr}
adds r4, r0, 0
bl sub_80D30DC
bl UpdateMonIconFrame
lsls r0, 24
lsrs r0, 24
cmp r0, 0
@ -10817,7 +10817,7 @@ _081B5C02:
thumb_func_start sub_81B5C08
sub_81B5C08: @ 81B5C08
push {lr}
bl sub_80D30DC
bl UpdateMonIconFrame
pop {r0}
bx r0
thumb_func_end sub_81B5C08

View File

@ -1,822 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start CreateMonIcon
@ int CreateMonIcon(u16 speciesId, int a2, u16 a3, u16 a4, u8 a5, u32 personality, int a7)
CreateMonIcon: @ 80D2CC4
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
sub sp, 0x30
adds r4, r0, 0
adds r6, r1, 0
ldr r0, [sp, 0x4C]
ldr r1, [sp, 0x50]
ldr r5, [sp, 0x54]
lsls r4, 16
lsrs r4, 16
lsls r2, 16
lsrs r2, 16
mov r8, r2
lsls r3, 16
lsrs r7, r3, 16
lsls r0, 24
lsrs r0, 24
mov r9, r0
ldr r0, =sMonIconOamData
str r0, [sp, 0x18]
adds r0, r4, 0
adds r2, r5, 0
bl GetMonIconPtr
str r0, [sp, 0x1C]
ldr r0, =sMonIconAnims
str r0, [sp, 0x20]
ldr r0, =sMonIconAffineAnims
str r0, [sp, 0x24]
str r6, [sp, 0x28]
ldr r0, =gMonIconPaletteIndices
adds r0, r4, r0
ldr r1, =0x0000dac0
adds r5, r1, 0
ldrb r0, [r0]
adds r1, r5, r0
add r0, sp, 0x2C
strh r1, [r0]
add r1, sp, 0x18
mov r0, sp
movs r2, 0x18
bl memcpy
movs r0, 0xCE
lsls r0, 1
cmp r4, r0
bls _080D2D2A
mov r0, sp
strh r5, [r0, 0x14]
_080D2D2A:
mov r0, r8
lsls r1, r0, 16
asrs r1, 16
lsls r2, r7, 16
asrs r2, 16
mov r0, sp
mov r3, r9
bl sub_80D31B4
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
lsls r0, r4, 4
adds r0, r4
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
bl sub_80D30DC
adds r0, r4, 0
add sp, 0x30
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end CreateMonIcon
thumb_func_start sub_80D2D78
sub_80D2D78: @ 80D2D78
push {r4-r7,lr}
sub sp, 0x18
adds r4, r2, 0
adds r5, r3, 0
ldr r6, [sp, 0x2C]
lsls r0, 16
lsrs r0, 16
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
lsls r6, 24
lsrs r6, 24
mov r3, sp
ldr r2, =sMonIconOamData
str r2, [sp]
movs r2, 0
str r2, [sp, 0x4]
ldr r2, =sMonIconAnims
str r2, [sp, 0x8]
ldr r2, =sMonIconAffineAnims
str r2, [sp, 0xC]
str r1, [sp, 0x10]
ldr r2, =gMonIconPaletteIndices
adds r2, r0, r2
ldr r7, =0x0000dac0
adds r1, r7, 0
ldrb r2, [r2]
adds r1, r2
strh r1, [r3, 0x14]
ldr r1, [sp, 0x30]
bl GetMonIconTiles
str r0, [sp, 0x4]
lsls r4, 16
asrs r4, 16
lsls r5, 16
asrs r5, 16
mov r0, sp
adds r1, r4, 0
adds r2, r5, 0
adds r3, r6, 0
bl sub_80D31B4
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
lsls r0, r4, 4
adds r0, r4
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
bl sub_80D30DC
adds r0, r4, 0
add sp, 0x18
pop {r4-r7}
pop {r1}
bx r1
.pool
thumb_func_end sub_80D2D78
thumb_func_start mon_icon_convert_unown_species_id
@ u16 mon_icon_convert_unown_species_id(u16 speciesId, u32 personality)
mon_icon_convert_unown_species_id: @ 80D2E08
push {lr}
lsls r0, 16
lsrs r2, r0, 16
cmp r2, 0xC9
bne _080D2E32
adds r0, r1, 0
bl GetUnownLetterByPersonality
lsls r0, 16
lsrs r0, 16
cmp r0, 0
bne _080D2E24
movs r0, 0xC9
b _080D2E2E
_080D2E24:
movs r1, 0xCE
lsls r1, 1
adds r0, r1
lsls r0, 16
lsrs r0, 16
_080D2E2E:
adds r1, r0, 0
b _080D2E40
_080D2E32:
movs r0, 0xCE
lsls r0, 1
adds r1, r2, 0
cmp r1, r0
bls _080D2E40
movs r1, 0x82
lsls r1, 1
_080D2E40:
adds r0, r1, 0
pop {r1}
bx r1
thumb_func_end mon_icon_convert_unown_species_id
thumb_func_start GetUnownLetterByPersonality
GetUnownLetterByPersonality: @ 80D2E48
push {lr}
adds r2, r0, 0
cmp r2, 0
beq _080D2E7E
movs r0, 0xC0
lsls r0, 18
ands r0, r2
lsrs r0, 18
movs r1, 0xC0
lsls r1, 10
ands r1, r2
lsrs r1, 12
orrs r0, r1
movs r1, 0xC0
lsls r1, 2
ands r1, r2
lsrs r1, 6
orrs r0, r1
movs r1, 0x3
ands r1, r2
orrs r0, r1
movs r1, 0x1C
bl __umodsi3
lsls r0, 16
lsrs r0, 16
b _080D2E80
_080D2E7E:
movs r0, 0
_080D2E80:
pop {r1}
bx r1
thumb_func_end GetUnownLetterByPersonality
thumb_func_start sub_80D2E84
sub_80D2E84: @ 80D2E84
push {r4,lr}
sub sp, 0x4
lsls r0, 16
lsrs r4, r0, 16
adds r0, r4, 0
mov r1, sp
bl MailSpeciesToSpecies
lsls r0, 16
lsrs r0, 16
cmp r0, 0xC9
bne _080D2EBA
mov r0, sp
ldrh r0, [r0]
cmp r0, 0
bne _080D2EAA
mov r1, sp
adds r0, 0xC9
b _080D2EB2
_080D2EAA:
mov r1, sp
movs r2, 0xCE
lsls r2, 1
adds r0, r2
_080D2EB2:
strh r0, [r1]
mov r0, sp
ldrh r0, [r0]
b _080D2ED2
_080D2EBA:
movs r0, 0xCE
lsls r0, 1
cmp r4, r0
bls _080D2EC6
movs r4, 0x82
lsls r4, 1
_080D2EC6:
adds r0, r4, 0
movs r1, 0
bl mon_icon_convert_unown_species_id
lsls r0, 16
lsrs r0, 16
_080D2ED2:
add sp, 0x4
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_80D2E84
thumb_func_start GetMonIconPtr
@ void *GetMonIconPtr(u16 speciesId, u32 personality, bool32)
GetMonIconPtr: @ 80D2EDC
push {r4,lr}
adds r4, r2, 0
lsls r0, 16
lsrs r0, 16
bl mon_icon_convert_unown_species_id
lsls r0, 16
lsrs r0, 16
adds r1, r4, 0
bl GetMonIconTiles
pop {r4}
pop {r1}
bx r1
thumb_func_end GetMonIconPtr
thumb_func_start sub_80D2EF8
sub_80D2EF8: @ 80D2EF8
push {lr}
bl sub_80D328C
pop {r0}
bx r0
thumb_func_end sub_80D2EF8
thumb_func_start sub_80D2F04
sub_80D2F04: @ 80D2F04
push {r4,r5,lr}
movs r4, 0
ldr r5, =gMonIconPaletteTable
_080D2F0A:
lsls r0, r4, 3
adds r0, r5
bl LoadSpritePalette
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x5
bls _080D2F0A
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D2F04
thumb_func_start sub_80D2F28
sub_80D2F28: @ 80D2F28
push {r4,lr}
lsls r0, 16
lsrs r1, r0, 16
movs r0, 0xCE
lsls r0, 1
cmp r1, r0
bls _080D2F3A
movs r1, 0x82
lsls r1, 1
_080D2F3A:
ldr r0, =gMonIconPaletteIndices
adds r0, r1, r0
ldrb r0, [r0]
ldr r1, =gMonIconPaletteTable
lsls r0, 3
adds r4, r0, r1
ldrh r0, [r4, 0x4]
bl IndexOfSpritePaletteTag
lsls r0, 24
lsrs r0, 24
cmp r0, 0xFF
bne _080D2F5A
adds r0, r4, 0
bl LoadSpritePalette
_080D2F5A:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D2F28
thumb_func_start sub_80D2F68
sub_80D2F68: @ 80D2F68
push {r4,lr}
lsls r0, 16
lsrs r0, 16
ldr r1, =gMonIconPaletteIndices
adds r0, r1
ldrb r0, [r0]
ldr r1, =gMonIconPaletteTable
lsls r0, 3
adds r4, r0, r1
ldrh r0, [r4, 0x4]
bl IndexOfSpritePaletteTag
lsls r0, 24
lsrs r0, 24
cmp r0, 0xFF
bne _080D2F8E
adds r0, r4, 0
bl LoadSpritePalette
_080D2F8E:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D2F68
thumb_func_start sub_80D2F9C
sub_80D2F9C: @ 80D2F9C
push {r4,r5,lr}
movs r4, 0
ldr r5, =gMonIconPaletteTable
_080D2FA2:
lsls r0, r4, 3
adds r0, r5
ldrh r0, [r0, 0x4]
bl FreeSpritePaletteByTag
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x5
bls _080D2FA2
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D2F9C
thumb_func_start sub_80D2FC0
sub_80D2FC0: @ 80D2FC0
push {lr}
lsls r0, 16
lsrs r1, r0, 16
movs r0, 0xCE
lsls r0, 1
cmp r1, r0
bls _080D2FD2
movs r1, 0x82
lsls r1, 1
_080D2FD2:
ldr r0, =gMonIconPaletteIndices
adds r0, r1, r0
ldrb r0, [r0]
ldr r1, =gMonIconPaletteTable
lsls r0, 3
adds r0, r1
ldrh r0, [r0, 0x4]
bl FreeSpritePaletteByTag
pop {r0}
bx r0
.pool
thumb_func_end sub_80D2FC0
thumb_func_start sub_80D2FF0
sub_80D2FF0: @ 80D2FF0
push {lr}
lsls r0, 16
lsrs r0, 16
ldr r1, =gMonIconPaletteIndices
adds r0, r1
ldrb r0, [r0]
ldr r1, =gMonIconPaletteTable
lsls r0, 3
adds r0, r1
ldrh r0, [r0, 0x4]
bl FreeSpritePaletteByTag
pop {r0}
bx r0
.pool
thumb_func_end sub_80D2FF0
thumb_func_start sub_80D3014
sub_80D3014: @ 80D3014
push {lr}
bl sub_80D30DC
pop {r0}
bx r0
thumb_func_end sub_80D3014
thumb_func_start GetMonIconTiles
@ void *GetMonIconTiles(u16 speciesId, bool32)
GetMonIconTiles: @ 80D3020
push {lr}
adds r3, r1, 0
lsls r0, 16
lsrs r0, 16
ldr r2, =gMonIconTable
lsls r1, r0, 2
adds r1, r2
ldr r2, [r1]
movs r1, 0xCD
lsls r1, 1
cmp r0, r1
bne _080D3042
cmp r3, 0x1
bne _080D3042
movs r0, 0x80
lsls r0, 3
adds r2, r0
_080D3042:
adds r0, r2, 0
pop {r1}
bx r1
.pool
thumb_func_end GetMonIconTiles
thumb_func_start sub_80D304C
sub_80D304C: @ 80D304C
push {r4-r6,lr}
lsls r0, 16
lsrs r4, r0, 16
cmp r4, 0xA0
bhi _080D3074
ldr r6, =gMonIconPaletteTable
movs r5, 0x5
_080D305A:
ldr r0, [r6]
adds r1, r4, 0
movs r2, 0x20
bl LoadPalette
adds r0, r4, 0
adds r0, 0x10
lsls r0, 16
lsrs r4, r0, 16
adds r6, 0x8
subs r5, 0x1
cmp r5, 0
bge _080D305A
_080D3074:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D304C
thumb_func_start sub_80D3080
sub_80D3080: @ 80D3080
push {lr}
lsls r0, 16
lsrs r1, r0, 16
movs r0, 0xCE
lsls r0, 1
cmp r1, r0
bls _080D3092
movs r1, 0x82
lsls r1, 1
_080D3092:
ldr r0, =gMonIconPaletteIndices
adds r0, r1, r0
ldrb r0, [r0]
pop {r1}
bx r1
.pool
thumb_func_end sub_80D3080
thumb_func_start sub_80D30A0
sub_80D30A0: @ 80D30A0
lsls r0, 16
lsrs r0, 16
ldr r1, =gMonIconPaletteIndices
adds r0, r1
ldrb r0, [r0]
bx lr
.pool
thumb_func_end sub_80D30A0
thumb_func_start GetValidMonIconPalettePtr
GetValidMonIconPalettePtr: @ 80D30B0
push {lr}
lsls r0, 16
lsrs r2, r0, 16
movs r0, 0xCE
lsls r0, 1
cmp r2, r0
bls _080D30C2
movs r2, 0x82
lsls r2, 1
_080D30C2:
ldr r1, =gMonIconPaletteTable
ldr r0, =gMonIconPaletteIndices
adds r0, r2, r0
ldrb r0, [r0]
lsls r0, 3
adds r0, r1
ldr r0, [r0]
pop {r1}
bx r1
.pool
thumb_func_end GetValidMonIconPalettePtr
thumb_func_start sub_80D30DC
sub_80D30DC: @ 80D30DC
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
adds r4, r0, 0
movs r7, 0
adds r6, r4, 0
adds r6, 0x2C
ldrb r2, [r6]
movs r0, 0x3F
mov r9, r0
ands r0, r2
cmp r0, 0
bne _080D3190
movs r1, 0x2A
adds r1, r4
mov r8, r1
ldrb r1, [r1]
ldr r0, [r4, 0x8]
lsls r1, 2
adds r1, r0
adds r5, r4, 0
adds r5, 0x2B
ldrb r0, [r5]
ldr r1, [r1]
lsls r0, 2
adds r0, r1
movs r1, 0
ldrsh r3, [r0, r1]
movs r0, 0x2
negs r0, r0
cmp r3, r0
beq _080D3126
adds r0, 0x1
cmp r3, r0
bne _080D312A
b _080D31A4
_080D3126:
strb r7, [r5]
b _080D31A4
_080D312A:
ldr r2, =sSpriteImageSizes
ldrb r1, [r4, 0x3]
lsrs r1, 6
lsls r1, 1
ldrb r0, [r4, 0x1]
lsrs r0, 6
lsls r0, 3
adds r1, r0
adds r1, r2
ldrh r2, [r1]
adds r1, r2, 0
muls r1, r3
ldr r0, [r4, 0xC]
adds r0, r1
ldrh r1, [r4, 0x4]
lsls r1, 22
lsrs r1, 17
ldr r3, =0x06010000
adds r1, r3
bl RequestSpriteCopy
mov r0, r8
ldrb r1, [r0]
ldr r0, [r4, 0x8]
lsls r1, 2
adds r1, r0
ldrb r0, [r5]
ldr r1, [r1]
lsls r0, 2
adds r0, r1
ldr r0, [r0]
lsls r0, 10
lsrs r0, 26
mov r1, r9
ands r1, r0
ldrb r2, [r6]
movs r0, 0x40
negs r0, r0
ands r0, r2
orrs r0, r1
strb r0, [r6]
ldrb r0, [r5]
adds r0, 0x1
strb r0, [r5]
ldrb r7, [r5]
b _080D31A4
.pool
_080D3190:
lsls r0, r2, 26
lsrs r0, 26
subs r0, 0x1
movs r1, 0x3F
ands r0, r1
movs r1, 0x40
negs r1, r1
ands r1, r2
orrs r1, r0
strb r1, [r6]
_080D31A4:
adds r0, r7, 0
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80D30DC
thumb_func_start sub_80D31B4
sub_80D31B4: @ 80D31B4
push {r4-r6,lr}
mov r6, r9
mov r5, r8
push {r5,r6}
sub sp, 0x38
mov r9, r0
adds r4, r1, 0
adds r5, r2, 0
mov r8, r3
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
mov r0, r8
lsls r0, 24
lsrs r0, 24
mov r8, r0
movs r0, 0
str r0, [sp, 0x30]
ldr r2, =sSpriteImageSizes
mov r0, r9
ldr r6, [r0]
ldrb r1, [r6, 0x3]
lsrs r1, 6
lsls r1, 1
ldrb r0, [r6, 0x1]
lsrs r0, 6
lsls r0, 3
adds r1, r0
adds r1, r2
ldrh r2, [r1]
ldr r1, =0xffff0000
add r3, sp, 0x30
ldr r0, [r3, 0x4]
ands r0, r1
orrs r0, r2
str r0, [r3, 0x4]
add r1, sp, 0x18
ldr r0, =0x0000ffff
strh r0, [r1]
mov r0, r9
ldrh r2, [r0, 0x14]
mov r0, sp
adds r0, 0x1A
strh r2, [r0]
str r6, [sp, 0x1C]
mov r2, r9
ldr r0, [r2, 0x8]
str r0, [sp, 0x20]
str r3, [sp, 0x24]
ldr r0, [r2, 0xC]
str r0, [sp, 0x28]
ldr r0, [r2, 0x10]
str r0, [sp, 0x2C]
mov r0, sp
movs r2, 0x18
bl memcpy
lsls r4, 16
asrs r4, 16
lsls r5, 16
asrs r5, 16
mov r0, sp
adds r1, r4, 0
adds r2, r5, 0
mov r3, r8
bl CreateSprite
lsls r0, 24
lsrs r0, 24
ldr r6, =gSprites
lsls r3, r0, 4
adds r3, r0
lsls r3, 2
adds r4, r3, r6
adds r5, r4, 0
adds r5, 0x2C
ldrb r1, [r5]
movs r2, 0x40
orrs r1, r2
strb r1, [r5]
adds r4, 0x3F
ldrb r2, [r4]
movs r1, 0x5
negs r1, r1
ands r1, r2
strb r1, [r4]
adds r6, 0xC
adds r3, r6
mov r2, r9
ldr r1, [r2, 0x4]
str r1, [r3]
add sp, 0x38
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r6}
pop {r1}
bx r1
.pool
thumb_func_end sub_80D31B4
thumb_func_start sub_80D328C
sub_80D328C: @ 80D328C
push {lr}
sub sp, 0x8
movs r1, 0
str r1, [sp]
ldr r3, =sSpriteImageSizes
ldrb r2, [r0, 0x3]
lsrs r2, 6
lsls r2, 1
ldrb r1, [r0, 0x1]
lsrs r1, 6
lsls r1, 3
adds r2, r1
adds r2, r3
ldrh r3, [r2]
ldr r2, =0xffff0000
ldr r1, [sp, 0x4]
ands r1, r2
orrs r1, r3
str r1, [sp, 0x4]
mov r1, sp
str r1, [r0, 0xC]
bl DestroySprite
add sp, 0x8
pop {r0}
bx r0
.pool
thumb_func_end sub_80D328C
thumb_func_start sub_80D32C8
sub_80D32C8: @ 80D32C8
mov r12, r0
adds r0, 0x2A
movs r3, 0
strb r1, [r0]
mov r2, r12
adds r2, 0x2C
ldrb r1, [r2]
movs r0, 0x40
negs r0, r0
ands r0, r1
strb r0, [r2]
mov r0, r12
adds r0, 0x2B
strb r3, [r0]
bx lr
thumb_func_end sub_80D32C8
.align 2, 0 @ Don't pad with nop.

View File

@ -7034,7 +7034,7 @@ _080CAEFA:
thumb_func_start sub_80CAF04
sub_80CAF04: @ 80CAF04
push {r4-r6,lr}
bl sub_80D2F04
bl LoadMonIconPalettes
movs r2, 0
ldr r3, =gUnknown_02039D08
ldr r5, =0x00000b08

View File

@ -1,452 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start npc_before_player_of_type
npc_before_player_of_type: @ 8135424
push {r4,r5,lr}
adds r5, r0, 0
lsls r5, 24
lsrs r5, 24
ldr r4, =gUnknown_0203AB40
adds r1, r4, 0x2
adds r0, r4, 0
bl GetXYCoordsOneStepInFrontOfPlayer
bl PlayerGetZCoord
strb r0, [r4, 0x4]
ldrh r0, [r4]
ldrh r1, [r4, 0x2]
ldrb r2, [r4, 0x4]
bl GetFieldObjectIdByXYZ
lsls r0, 24
lsrs r0, 24
ldr r2, =gMapObjects
lsls r1, r0, 3
adds r1, r0
lsls r1, 2
adds r2, r1, r2
ldrb r0, [r2, 0x5]
cmp r0, r5
bne _08135470
ldr r1, =gSpecialVar_LastTalked
ldrb r0, [r2, 0x8]
strh r0, [r1]
movs r0, 0x1
b _08135472
.pool
_08135470:
movs r0, 0
_08135472:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end npc_before_player_of_type
thumb_func_start oei_task_add
oei_task_add: @ 8135478
push {lr}
ldr r0, =gUnknown_0203AB40
adds r1, r0, 0x2
bl GetXYCoordsOneStepInFrontOfPlayer
ldr r0, =task08_080C9820
movs r1, 0x8
bl CreateTask
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
.pool
thumb_func_end oei_task_add
thumb_func_start task08_080C9820
task08_080C9820: @ 813549C
push {r4-r6,lr}
lsls r0, 24
lsrs r5, r0, 24
adds r6, r5, 0
bl ScriptContext2_Enable
ldr r1, =gPlayerAvatar
movs r0, 0x1
strb r0, [r1, 0x6]
ldrb r1, [r1, 0x5]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gMapObjects
adds r4, r0, r1
adds r0, r4, 0
bl FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive
lsls r0, 24
cmp r0, 0
beq _081354D2
adds r0, r4, 0
bl FieldObjectClearAnimIfSpecialAnimFinished
lsls r0, 24
cmp r0, 0
beq _0813551E
_081354D2:
ldr r0, =gMapHeader
ldrb r0, [r0, 0x17]
cmp r0, 0x5
bne _08135504
movs r0, 0x3B
bl FieldEffectStart
ldr r0, =gTasks
lsls r1, r5, 2
adds r1, r5
lsls r1, 3
adds r1, r0
ldr r0, =sub_8135578
b _0813551C
.pool
_08135504:
bl sub_808C114
adds r0, r4, 0
movs r1, 0x39
bl FieldObjectSetSpecialAnim
ldr r0, =gTasks
lsls r1, r6, 2
adds r1, r6
lsls r1, 3
adds r1, r0
ldr r0, =sub_813552C
_0813551C:
str r0, [r1]
_0813551E:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end task08_080C9820
thumb_func_start sub_813552C
sub_813552C: @ 813552C
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
ldr r0, =gPlayerAvatar
ldrb r1, [r0, 0x5]
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gMapObjects
adds r0, r1
bl FieldObjectCheckIfSpecialAnimFinishedOrInactive
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
bne _08135560
movs r0, 0x3B
bl FieldEffectStart
ldr r0, =gTasks
lsls r1, r4, 2
adds r1, r4
lsls r1, 3
adds r1, r0
ldr r0, =sub_8135578
str r0, [r1]
_08135560:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813552C
thumb_func_start sub_8135578
sub_8135578: @ 8135578
push {r4-r7,lr}
lsls r0, 24
lsrs r7, r0, 24
movs r0, 0x6
bl FieldEffectActiveListContains
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
bne _081355FC
bl player_get_direction_lower_nybble
ldr r6, =gFieldEffectArguments
lsls r0, 24
lsrs r0, 24
str r0, [r6, 0x4]
cmp r0, 0x1
bne _0813559E
str r4, [r6, 0x8]
_0813559E:
ldr r1, [r6, 0x4]
cmp r1, 0x2
bne _081355A8
movs r0, 0x1
str r0, [r6, 0x8]
_081355A8:
cmp r1, 0x3
bne _081355B0
movs r0, 0x2
str r0, [r6, 0x8]
_081355B0:
cmp r1, 0x4
bne _081355B8
movs r0, 0x3
str r0, [r6, 0x8]
_081355B8:
ldr r5, =gPlayerAvatar
ldrb r0, [r5, 0x5]
lsls r4, r0, 3
adds r4, r0
lsls r4, 2
ldr r0, =gMapObjects
adds r4, r0
bl GetPlayerAvatarGraphicsIdByCurrentState
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
adds r0, r4, 0
bl FieldObjectSetGraphicsId
ldrb r1, [r5, 0x4]
lsls r0, r1, 4
adds r0, r1
lsls r0, 2
ldr r1, =gSprites
adds r0, r1
ldrb r1, [r6, 0x8]
bl StartSpriteAnim
movs r0, 0x6
bl FieldEffectActiveListRemove
ldr r1, =gTasks
lsls r0, r7, 2
adds r0, r7
lsls r0, 3
adds r0, r1
ldr r1, =sub_813561C
str r1, [r0]
_081355FC:
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_8135578
thumb_func_start sub_813561C
sub_813561C: @ 813561C
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
lsls r0, 3
adds r0, r1
ldrh r1, [r0, 0x18]
lsls r1, 16
ldrh r0, [r0, 0x1A]
orrs r1, r0
bl _call_via_r1
ldr r1, =gPlayerAvatar
movs r0, 0
strb r0, [r1, 0x6]
adds r0, r4, 0
bl DestroyTask
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_813561C
thumb_func_start sub_8135654
sub_8135654: @ 8135654
push {r4,lr}
bl ShouldDoBrailleStrengthEffect
lsls r0, 24
cmp r0, 0
beq _0813568C
ldr r4, =gSpecialVar_Result
bl GetCursorSelectionMonId
lsls r0, 24
lsrs r0, 24
strh r0, [r4]
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =sub_8179834
b _081356A8
.pool
_0813568C:
movs r0, 0x56
bl npc_before_player_of_type
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _0813569E
movs r0, 0
b _081356AC
_0813569E:
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =sub_81356C4
_081356A8:
str r0, [r1]
movs r0, 0x1
_081356AC:
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end sub_8135654
thumb_func_start sub_81356C4
sub_81356C4: @ 81356C4
push {lr}
bl GetCursorSelectionMonId
ldr r1, =gFieldEffectArguments
lsls r0, 24
lsrs r0, 24
str r0, [r1]
ldr r0, =Route111_EventScript_2907F0
bl ScriptContext1_SetupScript
pop {r0}
bx r0
.pool
thumb_func_end sub_81356C4
thumb_func_start oei_rocksmash
oei_rocksmash: @ 81356E4
push {lr}
bl oei_task_add
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r2, =sub_8135714
lsrs r0, r2, 16
strh r0, [r1, 0x18]
strh r2, [r1, 0x1A]
movs r0, 0x13
bl IncrementGameStat
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end oei_rocksmash
thumb_func_start sub_8135714
sub_8135714: @ 8135714
push {lr}
movs r0, 0x83
bl PlaySE
movs r0, 0x25
bl FieldEffectActiveListRemove
bl EnableBothScriptContexts
pop {r0}
bx r0
thumb_func_end sub_8135714
thumb_func_start sub_813572C
sub_813572C: @ 813572C
push {lr}
bl sub_80FE314
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _0813573E
movs r0, 0
b _0813574C
_0813573E:
ldr r1, =gUnknown_03005DB0
ldr r0, =FieldCallback_Teleport
str r0, [r1]
ldr r1, =gUnknown_0203CEEC
ldr r0, =hm2_dig
str r0, [r1]
movs r0, 0x1
_0813574C:
pop {r1}
bx r1
.pool
thumb_func_end sub_813572C
thumb_func_start hm2_dig
hm2_dig: @ 8135760
push {lr}
bl Overworld_ResetStateAfterDigEscRope
movs r0, 0x26
bl FieldEffectStart
bl GetCursorSelectionMonId
ldr r1, =gFieldEffectArguments
lsls r0, 24
lsrs r0, 24
str r0, [r1]
pop {r0}
bx r0
.pool
thumb_func_end hm2_dig
thumb_func_start sub_8135780
sub_8135780: @ 8135780
push {lr}
bl oei_task_add
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldr r2, =sub_81357BC
lsrs r0, r2, 16
strh r0, [r1, 0x18]
strh r2, [r1, 0x1A]
bl ShouldDoBrailleDigEffect
lsls r0, 24
cmp r0, 0
bne _081357AC
movs r0, 0x1
bl SetPlayerAvatarTransitionFlags
_081357AC:
movs r0, 0
pop {r1}
bx r1
.pool
thumb_func_end sub_8135780
thumb_func_start sub_81357BC
sub_81357BC: @ 81357BC
push {r4,lr}
movs r0, 0x26
bl FieldEffectActiveListRemove
bl ShouldDoBrailleDigEffect
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0
beq _081357D6
bl DoBrailleDigEffect
b _081357EE
_081357D6:
ldr r0, =task08_080A1C44
movs r1, 0x8
bl CreateTask
lsls r0, 24
lsrs r0, 24
ldr r2, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
strh r4, [r1, 0x8]
_081357EE:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_81357BC
.align 2, 0 @ Don't pad with nop.

View File

@ -17828,7 +17828,7 @@ _0801BD1A:
bl CopyBgTilemapBufferToVram
b _0801BD86
_0801BD34:
bl sub_80D2F04
bl LoadMonIconPalettes
b _0801BD86
_0801BD3A:
movs r0, 0x1
@ -17991,7 +17991,7 @@ _0801BE56:
.pool
_0801BE94:
bl sub_801C61C
bl sub_80D2F9C
bl FreeMonIconPalettes
b _0801BEDA
_0801BE9E:
ldr r0, =gUnknown_02022C60

File diff suppressed because it is too large Load Diff

View File

@ -1,577 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start ScriptMovement_StartObjectMovementScript
ScriptMovement_StartObjectMovementScript: @ 80D32E8
push {r4,lr}
sub sp, 0x4
adds r4, r3, 0
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
lsls r2, 24
lsrs r2, 24
mov r3, sp
bl TryGetFieldObjectIdByLocalIdAndMap
lsls r0, 24
cmp r0, 0
beq _080D330A
movs r0, 0x1
b _080D3332
_080D330A:
ldr r0, =sub_80D3660
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _080D331C
movs r0, 0x32
bl sub_80D33AC
_080D331C:
bl sub_80D33F4
lsls r0, 24
lsrs r0, 24
mov r1, sp
ldrb r1, [r1]
adds r2, r4, 0
bl sub_80D3408
lsls r0, 24
lsrs r0, 24
_080D3332:
add sp, 0x4
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end ScriptMovement_StartObjectMovementScript
thumb_func_start ScriptMovement_IsObjectMovementFinished
ScriptMovement_IsObjectMovementFinished: @ 80D3340
push {r4,lr}
sub sp, 0x4
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
lsls r2, 24
lsrs r2, 24
mov r3, sp
bl TryGetFieldObjectIdByLocalIdAndMap
lsls r0, 24
cmp r0, 0
bne _080D3382
bl sub_80D33F4
lsls r0, 24
lsrs r4, r0, 24
mov r0, sp
ldrb r1, [r0]
adds r0, r4, 0
bl sub_80D3474
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x10
beq _080D3382
adds r0, r4, 0
bl sub_80D3584
lsls r0, 24
lsrs r0, 24
b _080D3384
_080D3382:
movs r0, 0x1
_080D3384:
add sp, 0x4
pop {r4}
pop {r1}
bx r1
thumb_func_end ScriptMovement_IsObjectMovementFinished
thumb_func_start sub_80D338C
sub_80D338C: @ 80D338C
push {r4,lr}
bl sub_80D33F4
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0xFF
beq _080D33A6
adds r0, r4, 0
bl sub_80D361C
adds r0, r4, 0
bl DestroyTask
_080D33A6:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80D338C
thumb_func_start sub_80D33AC
sub_80D33AC: @ 80D33AC
push {r4,r5,lr}
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
ldr r0, =sub_80D3660
bl CreateTask
lsls r0, 24
lsrs r0, 24
movs r2, 0x1
lsls r1, r0, 2
adds r1, r0
lsls r3, r1, 3
ldr r5, =gTasks + 0x8
ldr r0, =0x0000ffff
adds r4, r0, 0
_080D33CC:
lsls r0, r2, 1
adds r0, r3
adds r0, r5
ldrh r1, [r0]
orrs r1, r4
strh r1, [r0]
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0xF
bls _080D33CC
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D33AC
thumb_func_start sub_80D33F4
sub_80D33F4: @ 80D33F4
push {lr}
ldr r0, =sub_80D3660
bl FindTaskIdByFunc
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
.pool
thumb_func_end sub_80D33F4
thumb_func_start sub_80D3408
sub_80D3408: @ 80D3408
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
mov r9, r2
lsls r0, 24
lsrs r5, r0, 24
adds r7, r5, 0
lsls r1, 24
lsrs r6, r1, 24
mov r8, r6
adds r0, r5, 0
adds r1, r6, 0
bl sub_80D3474
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x10
beq _080D3444
adds r0, r5, 0
adds r1, r4, 0
bl sub_80D3584
lsls r0, 24
cmp r0, 0
beq _080D3464
adds r0, r5, 0
adds r1, r4, 0
adds r2, r6, 0
b _080D345A
_080D3444:
adds r0, r7, 0
movs r1, 0xFF
bl sub_80D3474
lsls r0, 24
lsrs r4, r0, 24
cmp r4, 0x10
beq _080D3464
adds r0, r7, 0
adds r1, r4, 0
mov r2, r8
_080D345A:
mov r3, r9
bl sub_80D35DC
movs r0, 0
b _080D3466
_080D3464:
movs r0, 0x1
_080D3466:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80D3408
thumb_func_start sub_80D3474
sub_80D3474: @ 80D3474
push {lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r3, r1, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r1, r0
adds r1, 0x2
movs r2, 0
_080D348C:
ldrb r0, [r1]
cmp r0, r3
bne _080D349C
adds r0, r2, 0
b _080D34AA
.pool
_080D349C:
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
adds r1, 0x1
cmp r2, 0xF
bls _080D348C
movs r0, 0x10
_080D34AA:
pop {r1}
bx r1
thumb_func_end sub_80D3474
thumb_func_start sub_80D34B0
sub_80D34B0: @ 80D34B0
push {lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r3, r1, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r1, r0
adds r1, 0x2
str r1, [r2]
movs r0, 0
cmp r0, r3
bcs _080D34DC
_080D34CE:
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
adds r1, 0x1
cmp r0, r3
bcc _080D34CE
str r1, [r2]
_080D34DC:
pop {r0}
bx r0
.pool
thumb_func_end sub_80D34B0
thumb_func_start sub_80D34E4
sub_80D34E4: @ 80D34E4
push {r4,lr}
sub sp, 0x4
adds r4, r2, 0
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
lsls r4, 24
lsrs r4, 24
mov r2, sp
bl sub_80D34B0
ldr r0, [sp]
strb r4, [r0]
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80D34E4
thumb_func_start sub_80D3508
sub_80D3508: @ 80D3508
push {r4,lr}
sub sp, 0x4
adds r4, r2, 0
lsls r0, 24
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
mov r2, sp
bl sub_80D34B0
ldr r0, [sp]
ldrb r0, [r0]
strb r0, [r4]
add sp, 0x4
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_80D3508
thumb_func_start sub_80D352C
sub_80D352C: @ 80D352C
lsls r0, 24
lsrs r0, 24
lsls r1, 24
ldr r2, =gBitTable
lsrs r1, 22
adds r1, r2
ldr r2, [r1]
mvns r2, r2
lsls r2, 16
lsrs r2, 16
ldr r3, =gTasks
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r3
ldrh r0, [r1, 0x8]
ands r2, r0
strh r2, [r1, 0x8]
bx lr
.pool
thumb_func_end sub_80D352C
thumb_func_start sub_80D355C
sub_80D355C: @ 80D355C
lsls r0, 24
lsrs r0, 24
lsls r1, 24
ldr r3, =gTasks
lsls r2, r0, 2
adds r2, r0
lsls r2, 3
adds r2, r3
ldr r0, =gBitTable
lsrs r1, 22
adds r1, r0
ldr r0, [r1]
ldrh r1, [r2, 0x8]
orrs r0, r1
strh r0, [r2, 0x8]
bx lr
.pool
thumb_func_end sub_80D355C
thumb_func_start sub_80D3584
sub_80D3584: @ 80D3584
push {lr}
lsls r0, 24
lsrs r0, 24
lsls r1, 24
ldr r3, =gTasks
lsls r2, r0, 2
adds r2, r0
lsls r2, 3
adds r2, r3
ldr r0, =gBitTable
lsrs r1, 22
adds r1, r0
ldr r0, [r1]
ldrh r1, [r2, 0x8]
ands r0, r1
cmp r0, 0
bne _080D35B4
movs r0, 0
b _080D35B6
.pool
_080D35B4:
movs r0, 0x1
_080D35B6:
pop {r1}
bx r1
thumb_func_end sub_80D3584
thumb_func_start npc_obj_offscreen_culling_and_flag_update
npc_obj_offscreen_culling_and_flag_update: @ 80D35BC
lsls r0, 24
ldr r2, =gUnknown_02039D90
lsrs r0, 22
adds r0, r2
str r1, [r0]
bx lr
.pool
thumb_func_end npc_obj_offscreen_culling_and_flag_update
thumb_func_start sub_80D35CC
sub_80D35CC: @ 80D35CC
lsls r0, 24
ldr r1, =gUnknown_02039D90
lsrs r0, 22
adds r0, r1
ldr r0, [r0]
bx lr
.pool
thumb_func_end sub_80D35CC
thumb_func_start sub_80D35DC
sub_80D35DC: @ 80D35DC
push {r4-r6,lr}
mov r6, r8
push {r6}
adds r5, r0, 0
adds r4, r1, 0
adds r6, r2, 0
mov r8, r3
lsls r5, 24
lsrs r5, 24
lsls r4, 24
lsrs r4, 24
lsls r6, 24
lsrs r6, 24
adds r0, r5, 0
adds r1, r4, 0
bl sub_80D352C
adds r0, r4, 0
mov r1, r8
bl npc_obj_offscreen_culling_and_flag_update
adds r0, r5, 0
adds r1, r4, 0
adds r2, r6, 0
bl sub_80D34E4
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
thumb_func_end sub_80D35DC
thumb_func_start sub_80D361C
sub_80D361C: @ 80D361C
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks + 0x8
adds r1, r0
adds r4, r1, 0x2
movs r5, 0
_080D3630:
ldrb r0, [r4]
cmp r0, 0xFF
beq _080D3646
adds r1, r0, 0
lsls r0, r1, 3
adds r0, r1
lsls r0, 2
ldr r1, =gMapObjects
adds r0, r1
bl npc_sync_anim_pause_bits
_080D3646:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
adds r4, 0x1
cmp r5, 0xF
bls _080D3630
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D361C
thumb_func_start sub_80D3660
sub_80D3660: @ 80D3660
push {r4-r7,lr}
sub sp, 0x4
lsls r0, 24
lsrs r7, r0, 24
movs r5, 0
mov r6, sp
_080D366C:
adds r0, r7, 0
adds r1, r5, 0
mov r2, sp
bl sub_80D3508
ldrb r0, [r6]
cmp r0, 0xFF
beq _080D3690
adds r4, r0, 0
adds r0, r5, 0
bl sub_80D35CC
adds r3, r0, 0
adds r0, r7, 0
adds r1, r5, 0
adds r2, r4, 0
bl sub_80D36A4
_080D3690:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0xF
bls _080D366C
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_80D3660
thumb_func_start sub_80D36A4
sub_80D36A4: @ 80D36A4
push {r4-r7,lr}
mov r7, r8
push {r7}
adds r5, r3, 0
lsls r0, 24
lsrs r7, r0, 24
lsls r1, 24
lsrs r6, r1, 24
mov r8, r6
lsls r2, 24
lsrs r2, 24
lsls r0, r2, 3
adds r0, r2
lsls r0, 2
ldr r1, =gMapObjects
adds r4, r0, r1
adds r0, r4, 0
bl FieldObjectIsSpecialAnimActive
lsls r0, 24
cmp r0, 0
beq _080D36DC
adds r0, r4, 0
bl FieldObjectClearAnimIfSpecialAnimFinished
lsls r0, 24
cmp r0, 0
beq _080D370E
_080D36DC:
ldrb r1, [r5]
cmp r1, 0xFE
bne _080D36F8
adds r0, r7, 0
adds r1, r6, 0
bl sub_80D355C
adds r0, r4, 0
bl FreezeMapObject
b _080D370E
.pool
_080D36F8:
adds r0, r4, 0
bl FieldObjectSetSpecialAnim
lsls r0, 24
cmp r0, 0
bne _080D370E
adds r5, 0x1
mov r0, r8
adds r1, r5, 0
bl npc_obj_offscreen_culling_and_flag_update
_080D370E:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_80D36A4
.align 2, 0 @ Don't pad with nop.

View File

@ -246,7 +246,7 @@ _08077310:
movs r1, 0x1
movs r2, 0xE0
bl sub_809882C
bl sub_80D2F04
bl LoadMonIconPalettes
ldr r2, =gUnknown_0203229C
ldr r0, [r2]
adds r0, 0x69

View File

@ -1890,7 +1890,7 @@ DewfordTown_EventScript_271E8B:: @ 8271E8B
DewfordTown_Hall_EventScript_271E8B:: @ 8271E8B
dodailyevents
setvar VAR_0x8004, 0
special sub_8122998
special BufferTrendyPhraseString
return
DewfordTown_EventScript_271E95:: @ 8271E95

View File

@ -223,7 +223,7 @@ gFieldEffectScript_SandDisguisePlaceholder:: @ 82DBC09
field_eff_end
gFieldEffectScript_UseRockSmash:: @ 82DBC0F
field_eff_callnative oei_rocksmash
field_eff_callnative FldEff_UseRockSmash
field_eff_end
gFieldEffectScript_Unknown40:: @ 82DBC15
@ -231,7 +231,7 @@ gFieldEffectScript_Unknown40:: @ 82DBC15
field_eff_end
gFieldEffectScript_Unknown38:: @ 82DBC1B
field_eff_callnative sub_8135780
field_eff_callnative FldEff_UseDig
field_eff_end
gFieldEffectScript_Unknown39:: @ 82DBC21

View File

@ -1,69 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gMapPopUp_Table:: @ 857C684
.incbin "graphics/interface/map_popup/wood.4bpp"
.incbin "graphics/interface/map_popup/marble.4bpp"
.incbin "graphics/interface/map_popup/stone.4bpp"
.incbin "graphics/interface/map_popup/brick.4bpp"
.incbin "graphics/interface/map_popup/underwater.4bpp"
.incbin "graphics/interface/map_popup/stone2.4bpp"
gMapPopUp_Outline_Table:: @ 857DD04
.incbin "graphics/interface/map_popup/wood_outline.4bpp"
.incbin "graphics/interface/map_popup/marble_outline.4bpp"
.incbin "graphics/interface/map_popup/stone_outline.4bpp"
.incbin "graphics/interface/map_popup/brick_outline.4bpp"
.incbin "graphics/interface/map_popup/underwater_outline.4bpp"
.incbin "graphics/interface/map_popup/stone2_outline.4bpp"
gMapPopUp_Palette_Table:: @ 857F384
.incbin "graphics/interface/map_popup/wood.gbapal"
.incbin "graphics/interface/map_popup/marble.gbapal"
.incbin "graphics/interface/map_popup/stone.gbapal"
.incbin "graphics/interface/map_popup/brick.gbapal"
.incbin "graphics/interface/map_popup/underwater.gbapal"
.incbin "graphics/interface/map_popup/stone2.gbapal"
gUnknown_0857F444:: @ 857F444
.incbin "graphics/interface/map_popup/857F444.gbapal"
gUnknown_0857F464:: @ 857F464
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x05, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x05, 0x02, 0x05, 0x05, 0x05, 0x02, 0x02, 0x02, 0x01
gUnknown_0857F4CC:: @ 857F4CC
.string "PYRAMID FLOOR 1$"
gUnknown_0857F4DC:: @ 857F4DC
.string "PYRAMID FLOOR 2$"
gUnknown_0857F4EC:: @ 857F4EC
.string "PYRAMID FLOOR 3$"
gUnknown_0857F4FC:: @ 857F4FC
.string "PYRAMID FLOOR 4$"
gUnknown_0857F50C:: @ 857F50C
.string "PYRAMID FLOOR 5$"
gUnknown_0857F51C:: @ 857F51C
.string "PYRAMID FLOOR 6$"
gUnknown_0857F52C:: @ 857F52C
.string "PYRAMID FLOOR 7$"
gUnknown_0857F53C:: @ 857F53C
.string "PYRAMID$"
gUnknown_0857F544:: @ 857F544
.4byte gUnknown_0857F4CC
.4byte gUnknown_0857F4DC
.4byte gUnknown_0857F4EC
.4byte gUnknown_0857F4FC
.4byte gUnknown_0857F50C
.4byte gUnknown_0857F51C
.4byte gUnknown_0857F52C
.4byte gUnknown_0857F53C

View File

@ -1,157 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gUnknown_0859E65C:: @ 859E65C
.incbin "graphics/misc/mon_markings.gbapal"
gUnknown_0859E67C:: @ 859E67C
.incbin "graphics/misc/mon_markings.4bpp"
gUnknown_0859EE7C:: @ 859EE7C
.2byte 0, 0xC000, 0, 0
gUnknown_0859EE84:: @ 859EE84
.2byte 0, 0, 0, 0
gUnknown_0859EE8C:: @ 859EE8C
.2byte 0, 5, -1, 0
gUnknown_0859EE94:: @ 859EE94
.2byte 1, 5, -1, 0
gUnknown_0859EE9C:: @ 859EE9C
.2byte 2, 5, -1, 0
gUnknown_0859EEA4:: @ 859EEA4
.2byte 3, 5, -1, 0
gUnknown_0859EEAC:: @ 859EEAC
.2byte 4, 5, -1, 0
gUnknown_0859EEB4:: @ 859EEB4
.2byte 5, 5, -1, 0
gUnknown_0859EEBC:: @ 859EEBC
.2byte 6, 5, -1, 0
gUnknown_0859EEC4:: @ 859EEC4
.2byte 7, 5, -1, 0
gUnknown_0859EECC:: @ 859EECC
.2byte 8, 5, -1, 0
gUnknown_0859EED4:: @ 859EED4
.2byte 9, 5, -1, 0
gUnknown_0859EEDC:: @ 859EEDC
.4byte gUnknown_0859EE8C
.4byte gUnknown_0859EE94
.4byte gUnknown_0859EE9C
.4byte gUnknown_0859EEA4
.4byte gUnknown_0859EEAC
.4byte gUnknown_0859EEB4
.4byte gUnknown_0859EEBC
.4byte gUnknown_0859EEC4
.4byte gUnknown_0859EECC
.4byte gUnknown_0859EED4
gUnknown_0859EF04:: @ 859EF04
.2byte 0, 5, -1, 0
gUnknown_0859EF0C:: @ 859EF0C
.2byte 64, 5, -1, 0
gUnknown_0859EF14:: @ 859EF14
.4byte gUnknown_0859EF04
.4byte gUnknown_0859EF0C
gUnknown_0859EF1C:: @ 859EF1C
.2byte 0x4000
.2byte 0x4000
.2byte 0
.2byte 0
gUnknown_0859EF24:: @ 859EF24
obj_image_anim_frame 0, 5
obj_image_anim_end
gUnknown_0859EF2C:: @ 859EF2C
obj_image_anim_frame 4, 5
obj_image_anim_end
gUnknown_0859EF34:: @ 859EF34
obj_image_anim_frame 8, 5
obj_image_anim_end
gUnknown_0859EF3C:: @ 859EF3C
obj_image_anim_frame 12, 5
obj_image_anim_end
gUnknown_0859EF44:: @ 859EF44
obj_image_anim_frame 16, 5
obj_image_anim_end
gUnknown_0859EF4C:: @ 859EF4C
obj_image_anim_frame 20, 5
obj_image_anim_end
gUnknown_0859EF54:: @ 859EF54
obj_image_anim_frame 24, 5
obj_image_anim_end
gUnknown_0859EF5C:: @ 859EF5C
obj_image_anim_frame 28, 5
obj_image_anim_end
gUnknown_0859EF64:: @ 859EF64
obj_image_anim_frame 32, 5
obj_image_anim_end
gUnknown_0859EF6C:: @ 859EF6C
obj_image_anim_frame 36, 5
obj_image_anim_end
gUnknown_0859EF74:: @ 859EF74
obj_image_anim_frame 40, 5
obj_image_anim_end
gUnknown_0859EF7C:: @ 859EF7C
obj_image_anim_frame 44, 5
obj_image_anim_end
gUnknown_0859EF84:: @ 859EF84
obj_image_anim_frame 48, 5
obj_image_anim_end
gUnknown_0859EF8C:: @ 859EF8C
obj_image_anim_frame 52, 5
obj_image_anim_end
gUnknown_0859EF94:: @ 859EF94
obj_image_anim_frame 56, 5
obj_image_anim_end
gUnknown_0859EF9C:: @ 859EF9C
obj_image_anim_frame 60, 5
obj_image_anim_end
gUnknown_0859EFA4:: @ 859EFA4
.4byte gUnknown_0859EF24
.4byte gUnknown_0859EF2C
.4byte gUnknown_0859EF34
.4byte gUnknown_0859EF3C
.4byte gUnknown_0859EF44
.4byte gUnknown_0859EF4C
.4byte gUnknown_0859EF54
.4byte gUnknown_0859EF5C
.4byte gUnknown_0859EF64
.4byte gUnknown_0859EF6C
.4byte gUnknown_0859EF74
.4byte gUnknown_0859EF7C
.4byte gUnknown_0859EF84
.4byte gUnknown_0859EF8C
.4byte gUnknown_0859EF94
.4byte gUnknown_0859EF9C

View File

@ -433,14 +433,14 @@ gUnknown_08615D7E:: @ 8615D7E
gUnknown_08615D9C:: @ 8615D9C
.4byte sub_80D3718, 0x00000007
.4byte SetUpFieldMove_Flash, 0x0000000d
.4byte sub_8135654, 0x0000000d
.4byte SetUpFieldMove_RockSmash, 0x0000000d
.4byte SetUpFieldMove_Strength, 0x0000000d
.4byte sub_81B5820, 0x00000008
.4byte sub_81B5884, 0x0000000d
.4byte sub_81B5974, 0x0000000d
.4byte hm_prepare_waterfall, 0x0000000d
.4byte SetUpFieldMove_Teleport, 0x0000000d
.4byte sub_813572C, 0x0000000d
.4byte SetUpFieldMove_Dig, 0x0000000d
.4byte sub_80FA004, 0x0000000d
.4byte SetUpFieldMove_SoftBoiled, 0x00000010
.4byte SetUpFieldMove_SoftBoiled, 0x00000010

View File

@ -1,285 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_0858E8B0:: @ 858E8B0
.2byte 0x0006, 0x0007
.byte 0x05, 0x01
.align 2
.2byte 0x0009, 0x000f
.byte 0x05, 0x02
.align 2
.2byte 0x0003, 0x0013
.byte 0x05, 0x01
.align 2
.2byte 0x0002, 0x0006
.byte 0x04, 0x01
.align 2
.2byte 0x0009, 0x000c
.byte 0x04, 0x00
.align 2
.2byte 0x0006, 0x0017
.byte 0x04, 0x00
.align 2
.2byte 0x000c, 0x0016
.byte 0x04, 0x00
.align 2
.2byte 0x0006, 0x0003
.byte 0x03, 0x02
.align 2
gUnknown_0858E8F0:: @ 858E8F0
.2byte 0x000e, 0x0005
.byte 0x04, 0x01
.align 2
.2byte 0x000a, 0x0006
.byte 0x01, 0x02
.align 2
.2byte 0x0006, 0x0006
.byte 0x03, 0x01
.align 2
.2byte 0x000e, 0x0008
.byte 0x04, 0x01
.align 2
.2byte 0x0003, 0x000a
.byte 0x02, 0x03
.align 2
.2byte 0x0009, 0x000e
.byte 0x00, 0x01
.align 2
.2byte 0x0003, 0x000f
.byte 0x06, 0x00
.align 2
.2byte 0x0002, 0x0011
.byte 0x01, 0x02
.align 2
.2byte 0x000c, 0x0012
.byte 0x06, 0x03
.align 2
.2byte 0x0005, 0x0012
.byte 0x03, 0x01
.align 2
.2byte 0x000a, 0x0013
.byte 0x02, 0x02
.align 2
gUnknown_0858E948:: @ 858E948
.incbin "graphics/misc/rotating_gate_1.4bpp"
.align 2
gUnknown_0858EB48:: @ 858EB48
.incbin "graphics/misc/rotating_gate_2.4bpp"
.align 2
gUnknown_0858F348:: @ 858F348
.incbin "graphics/misc/rotating_gate_3.4bpp"
.align 2
gUnknown_0858FB48:: @ 858FB48
.incbin "graphics/misc/rotating_gate_4.4bpp"
.align 2
gUnknown_08590348:: @ 8590348
.incbin "graphics/misc/rotating_gate_5.4bpp"
.align 2
gUnknown_08590548:: @ 8590548
.incbin "graphics/misc/rotating_gate_6.4bpp"
.align 2
gUnknown_08590D48:: @ 8590D48
.incbin "graphics/misc/rotating_gate_7.4bpp"
.align 2
gUnknown_08591548:: @ 8591548
.incbin "graphics/misc/rotating_gate_8.4bpp"
.align 2
gOamData_8591D48:: @ 8591D48
.2byte 0x0100, 0xc000, 0x2800
.align 2
gOamData_8591D50:: @ 8591D50
.2byte 0x0100, 0x8000, 0x2800
.align 2
gUnknown_08591D58:: @ 8591D58
obj_tiles gUnknown_0858E948, 0x0200, 0x1300
obj_tiles gUnknown_0858EB48, 0x0800, 0x1301
obj_tiles gUnknown_0858F348, 0x0800, 0x1302
obj_tiles gUnknown_0858FB48, 0x0800, 0x1303
obj_tiles gUnknown_08590348, 0x0200, 0x1304
obj_tiles gUnknown_08590548, 0x0800, 0x1305
obj_tiles gUnknown_08590D48, 0x0800, 0x1306
obj_tiles gUnknown_08591548, 0x0800, 0x1307
null_obj_tiles
.align 2
gSpriteAnim_8591DA0:: @ 8591DA0
.2byte 0x0000, 0x0000, 0xffff, 0x0000
.align 2
gSpriteAnim_8591DA8:: @ 8591DA8
.2byte 0x0000, 0x0000, 0xffff, 0x0000
.align 2
gSpriteAnimTable_8591DB0:: @ 8591DB0
.4byte gSpriteAnim_8591DA0
.align 2
gSpriteAnimTable_8591DB4:: @ 8591DB4
.4byte gSpriteAnim_8591DA8
.align 2
gSpriteAffineAnim_8591DB8:: @ 8591DB8
.2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591DC8:: @ 8591DC8
.2byte 0x0100, 0x0100, 0x00c0, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591DD8:: @ 8591DD8
.2byte 0x0100, 0x0100, 0x0080, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591DE8:: @ 8591DE8
.2byte 0x0100, 0x0100, 0x0040, 0x0000, 0x7ffe, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591DF8:: @ 8591DF8
.2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x10fc, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591E10:: @ 8591E10
.2byte 0x0100, 0x0100, 0x00c0, 0x0000, 0x0000, 0x0000, 0x10fc, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591E28:: @ 8591E28
.2byte 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, 0x10fc, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591E40:: @ 8591E40
.2byte 0x0100, 0x0100, 0x0040, 0x0000, 0x0000, 0x0000, 0x10fc, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591E58:: @ 8591E58
.2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591E70:: @ 8591E70
.2byte 0x0100, 0x0100, 0x0040, 0x0000, 0x0000, 0x0000, 0x1004, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591E88:: @ 8591E88
.2byte 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, 0x1004, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591EA0:: @ 8591EA0
.2byte 0x0100, 0x0100, 0x00c0, 0x0000, 0x0000, 0x0000, 0x1004, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591EB8:: @ 8591EB8
.2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x08f8, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591ED0:: @ 8591ED0
.2byte 0x0100, 0x0100, 0x00c0, 0x0000, 0x0000, 0x0000, 0x08f8, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591EE8:: @ 8591EE8
.2byte 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, 0x08f8, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591F00:: @ 8591F00
.2byte 0x0100, 0x0100, 0x0040, 0x0000, 0x0000, 0x0000, 0x08f8, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591F18:: @ 8591F18
.2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0808, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591F30:: @ 8591F30
.2byte 0x0100, 0x0100, 0x0040, 0x0000, 0x0000, 0x0000, 0x0808, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591F48:: @ 8591F48
.2byte 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, 0x0808, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnim_8591F60:: @ 8591F60
.2byte 0x0100, 0x0100, 0x00c0, 0x0000, 0x0000, 0x0000, 0x0808, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000
.align 2
gSpriteAffineAnimTable_8591F78:: @ 8591F78
.4byte gSpriteAffineAnim_8591DB8
.4byte gSpriteAffineAnim_8591DC8
.4byte gSpriteAffineAnim_8591DD8
.4byte gSpriteAffineAnim_8591DE8
.4byte gSpriteAffineAnim_8591E58
.4byte gSpriteAffineAnim_8591EA0
.4byte gSpriteAffineAnim_8591E88
.4byte gSpriteAffineAnim_8591E70
.4byte gSpriteAffineAnim_8591DF8
.4byte gSpriteAffineAnim_8591E10
.4byte gSpriteAffineAnim_8591E28
.4byte gSpriteAffineAnim_8591E40
.4byte gSpriteAffineAnim_8591F18
.4byte gSpriteAffineAnim_8591F60
.4byte gSpriteAffineAnim_8591F48
.4byte gSpriteAffineAnim_8591F30
.4byte gSpriteAffineAnim_8591EB8
.4byte gSpriteAffineAnim_8591ED0
.4byte gSpriteAffineAnim_8591EE8
.4byte gSpriteAffineAnim_8591F00
.align 2
gUnknown_08591FC8:: @ 8591FC8
spr_template 0x1300, 0xffff, gOamData_8591D48, gSpriteAnimTable_8591DB0, NULL, gSpriteAffineAnimTable_8591F78, sub_80FBAE4
.align 2
gUnknown_08591FE0:: @ 8591FE0
spr_template 0x1300, 0xffff, gOamData_8591D50, gSpriteAnimTable_8591DB4, NULL, gSpriteAffineAnimTable_8591F78, sub_80FBAE4
gUnknown_08591FF8:: @ 8591FF8
.byte 0xff, 0xff, 0xff, 0xff, 0x27, 0x26, 0x12, 0x13, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
gUnknown_08592008:: @ 8592008
.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x17, 0x16, 0x22, 0x23, 0xff, 0xff, 0xff, 0xff
gUnknown_08592018:: @ 8592018
.byte 0xff, 0x11, 0xff, 0xff, 0xff, 0x10, 0xff, 0xff, 0xff, 0x24, 0xff, 0xff, 0xff, 0x25, 0xff, 0xff
gUnknown_08592028:: @ 8592028
.byte 0xff, 0xff, 0x21, 0xff, 0xff, 0xff, 0x20, 0xff, 0xff, 0xff, 0x14, 0xff, 0xff, 0xff, 0x15, 0xff
gUnknown_08592038:: @ 8592038
.byte 0x00, 0xff, 0x00, 0x00, 0x01, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00
gUnknown_08592058:: @ 8592058
.byte 0xff, 0xff, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00
gUnknown_08592078:: @ 8592078
.byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00
.byte 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00
.byte 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00

View File

@ -5,7 +5,7 @@ DewfordTown_Hall_EventScript_1FD4D0:: @ 81FD4D0
lock
faceplayer
call DewfordTown_Hall_EventScript_271E8B
special sub_81229C8
special TrendyPhraseIsOld
compare VAR_RESULT, 1
goto_eq DewfordTown_Hall_EventScript_1FD4EF
msgbox DewfordTown_Hall_Text_1FD818, 4
@ -87,7 +87,7 @@ DewfordTown_Hall_EventScript_1FD590:: @ 81FD590
DewfordTown_Hall_EventScript_1FD5A0:: @ 81FD5A0
lockall
call DewfordTown_Hall_EventScript_271E8B
special sub_8122A30
special GetDewfordHallPaintingNameIndex
switch VAR_RESULT
case 0, DewfordTown_Hall_EventScript_1FD607
case 4, DewfordTown_Hall_EventScript_1FD607
@ -133,7 +133,7 @@ DewfordTown_Hall_EventScript_1FD63B:: @ 81FD63B
DewfordTown_Hall_EventScript_1FD647:: @ 81FD647
call DewfordTown_Hall_EventScript_271E8B
special sub_8122A30
special GetDewfordHallPaintingNameIndex
switch VAR_RESULT
case 0, DewfordTown_Hall_EventScript_1FD6AD
case 1, DewfordTown_Hall_EventScript_1FD6AD

View File

@ -4,7 +4,7 @@ FortreeCity_Gym_MapScripts:: @ 82165AB
.byte 0
FortreeCity_Gym_MapScript1_2165B6: @ 82165B6
special sub_80FBE90
special RotatingGate_InitPuzzle
end
FortreeCity_Gym_MapScript2_2165BA: @ 82165BA

View File

@ -4,7 +4,7 @@ Route110_TrickHousePuzzle6_MapScripts:: @ 826DDA7
.byte 0
Route110_TrickHousePuzzle6_MapScript1_26DDB2: @ 826DDB2
special sub_80FBE90
special RotatingGate_InitPuzzle
end
Route110_TrickHousePuzzle6_MapScript2_26DDB6: @ 826DDB6

View File

@ -137,10 +137,10 @@ gSpecials:: @ 81DBA64
def_special TV_PutNameRaterShowOnTheAirIfNicnkameChanged
def_special TV_CopyNicknameToStringVar1AndEnsureTerminated
def_special TV_CheckMonOTIDEqualsPlayerID
def_special sub_8122998
def_special sub_81229C8
def_special BufferTrendyPhraseString
def_special TrendyPhraseIsOld
def_special sub_811EF6C
def_special sub_8122A30
def_special GetDewfordHallPaintingNameIndex
def_special sub_80D6EDC
def_special CalculatePlayerPartyCount
def_special CountPartyNonEggMons
@ -212,7 +212,7 @@ gSpecials:: @ 81DBA64
def_special SubtractMoneyFromVar0x8005
def_special sub_80F972C
def_special sp0C8_whiteout_maybe
def_special sub_80FBE90
def_special RotatingGate_InitPuzzle
def_special RotatingGate_InitPuzzleAndGraphics
def_special SetSSTidalFlag
def_special ResetSSTidalFlag

View File

@ -47,7 +47,7 @@ extern s16 gBattleAnimArgs[ANIM_ARGS_COUNT];
extern u8 gAnimMoveTurn;
extern u8 gBattleAnimAttacker;
extern u8 gBattleAnimTarget;
extern u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT];
extern u16 gAnimBattlerSpecies[MAX_BATTLERS_COUNT];
extern u8 gUnknown_02038440;
void ClearBattleAnimationVars(void);
@ -61,7 +61,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible);
bool8 IsContest(void);
s8 BattleAnimAdjustPanning(s8 pan);
s8 BattleAnimAdjustPanning2(s8 pan);
s16 sub_80A52EC(s16 a);
s16 KeepPanInRange(s16 a);
s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan);
// battle_anim_80FE840.s

View File

@ -63,6 +63,10 @@ enum
ACRO_TRANS_WHEELIE_LOWERING_MOVING,
};
// Exported RAM declarations
extern bool8 gUnusedBikeCameraAheadPanback;
// Exported ROM declarations
void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys);
void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys);
bool8 RS_IsRunningDisallowed(u8 tile);

View File

@ -2,6 +2,10 @@
#define GUARD_BRAILLE_PUZZLES_H
bool8 ShouldDoBrailleFlyEffect(void);
bool8 ShouldDoBrailleStrengthEffect(void);
bool8 ShouldDoBrailleDigEffect(void);
void DoBrailleDigEffect(void);
void sub_8179918(void);
void sub_8179834(void);
#endif // GUARD_BRAILLE_PUZZLES_H

View File

@ -35,5 +35,6 @@ bool32 sub_811F8D8(u16 word);
void InitializeEasyChatWordArray(u16 *words, u16 length);
void ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 length1, u16 length2);
bool8 ECWord_CheckIfOutsideOfValidRange(u16 word);
u16 sub_811EE38(u16 group);
#endif // GUARD_EASYCHAT_H

View File

@ -388,6 +388,7 @@ extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88[];
extern const u8 FieryPath_EventScript_2908FD[];
extern const u8 EventScript_290CAE[];
extern const u8 EventScript_2926F8[];
extern const u8 Route111_EventScript_2907F0[];
//player pc
extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_1F863F[];

View File

@ -6,22 +6,19 @@
struct CameraObject
{
void (*callback)(struct CameraObject *);
u32 unk4;
u32 spriteId;
s32 unk8;
s32 unkC;
s32 x;
s32 y;
};
extern struct CameraObject gUnknown_03005DD0;
// Exported RAM declarations
extern struct CameraObject gUnknown_03005DD0;
extern u16 gUnknown_03005DEC;
extern u16 gUnknown_03005DE8;
// Exported ROM declarations
void DrawWholeMapView(void);
void CurrentMapDrawMetatileAt(int x, int y);
void sub_8089C08(s16 *a0, s16 *a1);

View File

@ -91,6 +91,8 @@ void sub_808F23C(const struct MapObject *mapObject, u8 movementType);
void sub_808F208(const struct MapObject *mapObject);
void npc_coords_shift_still(struct MapObject *pObject);
void FieldObjectMoveDestCoords(struct MapObject *pObject, u32 unk_19, s16 *pInt, s16 *pInt1);
u8 AddCameraObject(u8 linkedSpriteId);
void UpdateFieldObjectsForCameraUpdate(s16 x, s16 y);
// Exported data declarations

View File

@ -27,6 +27,9 @@ void sub_8098044(u8);
void UnfreezeMapObjects(void);
void FreezeMapObjectsExceptOne(u8 mapObjectId);
void sub_8097B78(u8, u8);
void sub_8098074(u8 var1, u8 var2);
void FreezeMapObjects(void);
bool8 FreezeMapObject(struct MapObject *mapObject);
#endif //GUARD_FIELD_MAP_OBJ_HELPERS_H

View File

@ -39,5 +39,7 @@ void sub_808BCF4(void);
void sub_808D074(u8);
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8);
void sub_808C114(void);
u8 GetPlayerAvatarGraphicsIdByCurrentState();
#endif // GUARD_FIELD_PLAYER_AVATAR_H

View File

@ -16,5 +16,7 @@ s32 GetMapBorderIdAt(s16, s16);
bool32 CanCameraMoveInDirection(u8);
u16 GetBehaviorByMetatileId(u16 metatileId);
void sav1_camera_get_focus_coords(u16 *x, u16 *y);
u8 MapGridGetMetatileLayerTypeAt(s32 x, s32 y);
u8 CameraMove(s32 deltaX, s32 deltaY);
#endif //GUARD_FIELDMAP_H

View File

@ -2873,4 +2873,8 @@ extern const u8 gBerryPalette_Enigma[];
//credits
extern const u8 gCreditsCopyrightEnd_Gfx[];
//pokenav condition marker
extern const u8 gPokenavConditionMarker_Gfx[];
extern const u16 gPokenavConditionMarker_Pal[];
#endif //GUARD_GRAPHICS_H

View File

@ -7,5 +7,5 @@
// Exported ROM declarations
void HideMapNamePopUpWindow(void);
void ShowMapNamePopup(void);
#endif //GUARD_MAP_NAME_POPUP_H

View File

@ -81,5 +81,8 @@ void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress);
void RemoveStartMenuWindow(void);
void sub_8197948(u8 initialCursorPos);
void sub_819A344(u8 a0, u8 *dest, u8 color);
void RemoveMapNamePopUpWindow(void);
u8 GetMapNamePopUpWindowId(void);
u8 AddMapNamePopUpWindow(void);
#endif // GUARD_MENU_H

24
include/mon_markings.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef POKEEMERALD_MON_MARKINGS_H
#define POKEEMERALD_MON_MARKINGS_H
struct PokemonMarkMenu
{
/*0x0000*/ u16 baseTileTag;
/*0x0002*/ u16 basePaletteTag;
/*0x0004*/ u8 markings; // bit flags
/*0x0005*/ s8 cursorPos;
/*0x0006*/ bool8 markingsArray[4];
/*0x000A*/ u8 cursorBaseY;
/*0x000B*/ bool8 spriteSheetLoadRequired;
/*0x000C*/ struct Sprite *menuWindowSprites[2]; // upper and lower halves of menu window
/*0x0014*/ struct Sprite *menuMarkingSprites[4];
/*0x0024*/ struct Sprite *unkSprite;
/*0x0028*/ struct Sprite *menuTextSprite;
/*0x002C*/ const u8 *frameTiles;
/*0x0030*/ const u16 *framePalette;
/*0x0034*/ u8 menuWindowSpriteTiles[0x1000];
/*0x1034*/ u8 filler1030[0x80];
/*0x10B4*/ u8 tileLoadState;
}; // 10b8
#endif //POKEEMERALD_MON_MARKINGS_H

View File

@ -15,9 +15,15 @@ struct LinkPlayerMapObject
u8 mode;
};
// Exported RAM declarations
extern struct WarpData gUnknown_020322DC;
extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
extern u16 *gBGTilemapBuffers1;
extern u16 *gBGTilemapBuffers2;
extern u16 *gBGTilemapBuffers3;
// Exported ROM declarations
extern const struct UCoords32 gUnknown_08339D64[];
void DoWhiteOut(void);

View File

@ -1,15 +1,20 @@
#ifndef GUARD_POKEMON_ICON_H
#define GUARD_POKEMON_ICON_H
const u8 *GetMonIconTiles(u16 species, bool32);
const u8 *GetMonIconPtr(u16 speciesId, u32 personality, u32 frameNo);
const u16 *GetValidMonIconPalettePtr(u16 speciesId);
u16 GetUnownLetterByPersonality(u32 personality);
u16 sub_80D2E84(u16 speciesId);
void sub_80D2F04(void);
void sub_80D2F68(u16 iconId);
u8 sub_80D2D78(u16 iconId, void callback(struct Sprite *), u16 x, u16 y, u16 a4, u8 a5);
void sub_80D2FF0(u16 iconId);
void LoadMonIconPalettes(void);
void LoadMonIconPalette(u16 species);
void FreeMonIconPalettes(void);
u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, bool32 extra);
void FreeMonIconPalette(u16 species);
void sub_80D2EF8(struct Sprite *sprite);
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, int a7);
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 extra);
u8 UpdateMonIconFrame(struct Sprite *sprite);
void LoadMonIconPalette(u16 species);
void sub_80D328C(struct Sprite *sprite);
#endif // GUARD_POKEMON_ICON_H

8
include/rotating_gate.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef GUARD_ROTATING_GATE_H
#define GUARD_ROTATING_GATE_H
void RotatingGatePuzzleCameraUpdate(s16, s16);
void RotatingGate_InitPuzzleAndGraphics();
u32 CheckForRotatingGatePuzzleCollision(u8, s16, s16);
#endif // GUARD_ROTATING_GATE_H

View File

@ -5,11 +5,11 @@
struct TilesPal
{
const u32 *tiles;
const u8 *tiles;
const u16 *pal;
};
extern const u32 gTextWindowFrame1_Gfx[];
extern const u8 gTextWindowFrame1_Gfx[];
extern const u16 gTextWindowFrame1_Pal[];
const struct TilesPal* GetWindowFrameTilesPal(u8 id);

View File

@ -89,14 +89,14 @@ SECTIONS {
src/overworld.o(.text);
asm/fieldmap.o(.text);
src/metatile_behavior.o(.text);
asm/field_camera.o(.text);
src/field_camera.o(.text);
src/field_door.o(.text);
asm/field_player_avatar.o(.text);
src/field_map_obj.o(.text);
asm/field_ground_effect.o(.text);
src/field_map_obj_helpers.o(.text);
src/field_message_box.o(.text);
asm/map_obj_lock.o(.text);
src/map_obj_lock.o(.text);
src/text_window.o(.text);
src/script.o(.text);
src/scrcmd.o(.text);
@ -130,11 +130,10 @@ SECTIONS {
src/pokemon_storage_system.o(.text);
asm/pokemon_storage_system.o(.text);
src/pokemon_icon.o(.text);
asm/pokemon_icon.o(.text);
asm/script_movement.o(.text);
src/script_movement.o(.text);
asm/fldeff_cut.o(.text);
src/mail_data.o(.text);
asm/map_name_popup.o(.text);
src/map_name_popup.o(.text);
src/item_menu_icons.o(.text);
asm/battle_anim_80D51AC.o(.text);
src/item.o(.text);
@ -155,18 +154,18 @@ SECTIONS {
src/pokemon_size_record.o(.text);
asm/fldeff_80F9BCC.o(.text);
src/field_special_scene.o(.text);
asm/rotating_gate.o(.text);
src/rotating_gate.o(.text);
src/safari_zone.o(.text);
asm/contest_link_80FC4F4.o(.text);
src/item_use.o(.text);
asm/battle_anim_80FE840.o(.text);
src/bike.o(.text);
asm/easy_chat.o(.text);
asm/mon_markings.o(.text);
src/mon_markings.o(.text);
asm/mauville_old_man.o(.text);
src/mail.o(.text);
asm/menu_helpers.o(.text);
asm/dewford_trend.o(.text);
src/dewford_trend.o(.text);
src/heal_location.o(.text);
src/region_map.o(.text);
asm/cute_sketch.o(.text);
@ -177,7 +176,7 @@ SECTIONS {
asm/trader.o(.text);
src/starter_choose.o(.text);
src/wallclock.o(.text);
asm/rom6.o(.text);
src/rom6.o(.text);
src/pokeblock.o(.text);
src/fldeff_flash.o(.text);
asm/post_battle_event_funcs.o(.text);
@ -204,7 +203,7 @@ SECTIONS {
src/mystery_event_script.o(.text);
asm/field_effect_helpers.o(.text);
asm/contest_ai.o(.text);
asm/battle_anim_sound_tasks.o(.text);
src/battle_anim_sound_tasks.o(.text);
src/battle_controller_safari.o(.text);
src/fldeff_sweetscent.o(.text);
asm/battle_anim_815A0D4.o(.text);
@ -433,7 +432,7 @@ SECTIONS {
data/pokemon_storage_system.o(.rodata);
src/pokemon_icon.o(.rodata);
data/fldeff_cut.o(.rodata);
data/map_name_popup.o(.rodata);
src/map_name_popup.o(.rodata);
src/item_menu_icons.o(.rodata);
data/item_menu_icons.o(.rodata);
data/contest.o(.rodata);
@ -451,12 +450,12 @@ SECTIONS {
src/pokemon_size_record.o(.rodata)
data/field_effect_misc.o(.rodata);
data/field_special_scene.o(.rodata);
data/rotating_gate.o(.rodata);
src/rotating_gate.o(.rodata);
data/item_use.o(.rodata);
data/battle_anim_80FE840.o(.rodata);
src/bike.o(.rodata);
data/easy_chat.o(.rodata);
data/mon_markings.o(.rodata);
src/mon_markings.o(.rodata);
data/mauville_old_man.o(.rodata);
src/mail.o(.rodata);
data/menu_helpers.o(.rodata);

View File

@ -123,7 +123,7 @@ EWRAM_DATA static u8 sAnimBackgroundFadeState = 0;
EWRAM_DATA static u16 sAnimMoveIndex = 0; // set but unused.
EWRAM_DATA u8 gBattleAnimAttacker = 0;
EWRAM_DATA u8 gBattleAnimTarget = 0;
EWRAM_DATA u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u16 gAnimBattlerSpecies[MAX_BATTLERS_COUNT] = {0};
EWRAM_DATA u8 gUnknown_02038440 = 0;
// const rom data
@ -228,15 +228,15 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (GetBattlerSide(i) != 0)
gAnimSpeciesByBanks[i] = GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES);
gAnimBattlerSpecies[i] = GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES);
else
gAnimSpeciesByBanks[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES);
gAnimBattlerSpecies[i] = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES);
}
}
else
{
for (i = 0; i < 4; i++)
gAnimSpeciesByBanks[i] = gContestResources->field_18->field_0;
gAnimBattlerSpecies[i] = gContestResources->field_18->field_0;
}
if (!isMoveAnim)
@ -1318,16 +1318,16 @@ s8 BattleAnimAdjustPanning2(s8 pan)
return pan;
}
s16 sub_80A52EC(s16 a)
s16 KeepPanInRange(s16 panArg)
{
s16 var = a;
s16 pan = panArg;
if (var > 63)
var = 63;
else if (var < -64)
var = -64;
if (pan > PAN_SIDE_OPPONENT)
pan = PAN_SIDE_OPPONENT;
else if (pan < PAN_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
return var;
return pan;
}
s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan)

View File

@ -0,0 +1,438 @@
#include "global.h"
#include "battle.h"
#include "constants/battle_anim.h"
#include "constants/species.h"
#include "battle_anim.h"
#include "task.h"
#include "sound.h"
#include "contest.h"
// this file's functions
static void sub_8158B98(u8 taskId);
static void sub_8158C04(u8 taskId);
static void sub_8158D08(u8 taskId);
static void sub_8158FF4(u8 taskId);
static void sub_815913C(u8 taskId);
static void sub_8159308(u8 taskId);
// task start
void sub_8158B30(u8 taskId)
{
s8 pan1, pan2, panIncrement;
gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[1] = gBattleAnimArgs[1];
pan1 = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
pan2 = BattleAnimAdjustPanning(PAN_SIDE_OPPONENT);
panIncrement = CalculatePanIncrement(pan1, pan2, 2);
gTasks[taskId].data[2] = pan1;
gTasks[taskId].data[3] = pan2;
gTasks[taskId].data[4] = panIncrement;
gTasks[taskId].data[10] = 10;
gTasks[taskId].func = sub_8158B98;
}
static void sub_8158B98(u8 taskId)
{
s16 pan = gTasks[taskId].data[2];
s8 panIncrement = gTasks[taskId].data[4];
if (++gTasks[taskId].data[11] == 111)
{
gTasks[taskId].data[10] = 5;
gTasks[taskId].data[11] = 0;
gTasks[taskId].func = sub_8158C04;
}
else
{
if (++gTasks[taskId].data[10] == 11)
{
gTasks[taskId].data[10] = 0;
PlaySE12WithPanning(gTasks[taskId].data[0], pan);
}
pan += panIncrement;
gTasks[taskId].data[2] = KeepPanInRange(pan);
}
}
static void sub_8158C04(u8 taskId)
{
if (++gTasks[taskId].data[10] == 6)
{
s8 pan;
gTasks[taskId].data[10] = 0;
pan = BattleAnimAdjustPanning(PAN_SIDE_OPPONENT);
PlaySE12WithPanning(gTasks[taskId].data[1], pan);
if (++gTasks[taskId].data[11] == 2)
DestroyAnimSoundTask(taskId);
}
}
// task end
// task start
void sub_8158C58(u8 taskId)
{
u16 songId = gBattleAnimArgs[0];
s8 targetPan = gBattleAnimArgs[2];
s8 panIncrement = gBattleAnimArgs[3];
u8 r10 = gBattleAnimArgs[4];
u8 r7 = gBattleAnimArgs[5];
u8 r9 = gBattleAnimArgs[6];
s8 sourcePan = BattleAnimAdjustPanning(gBattleAnimArgs[1]);
targetPan = BattleAnimAdjustPanning(targetPan);
panIncrement = CalculatePanIncrement(sourcePan, targetPan, panIncrement);
gTasks[taskId].data[0] = songId;
gTasks[taskId].data[1] = sourcePan;
gTasks[taskId].data[2] = targetPan;
gTasks[taskId].data[3] = panIncrement;
gTasks[taskId].data[4] = r10;
gTasks[taskId].data[5] = r7;
gTasks[taskId].data[6] = r9;
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11] = sourcePan;
gTasks[taskId].data[12] = r9;
gTasks[taskId].func = sub_8158D08;
sub_8158D08(taskId);
}
static void sub_8158D08(u8 taskId)
{
if (gTasks[taskId].data[12]++ == gTasks[taskId].data[6])
{
gTasks[taskId].data[12] = 0;
PlaySE12WithPanning(gTasks[taskId].data[0], gTasks[taskId].data[11]);
if (--gTasks[taskId].data[4] == 0)
{
DestroyAnimSoundTask(taskId);
return;
}
}
if (gTasks[taskId].data[10]++ == gTasks[taskId].data[5])
{
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11] += gTasks[taskId].data[3];
gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11]);
}
}
// task end
// task start
void sub_8158D8C(u8 taskId)
{
u16 species = 0;
s8 pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->field_0;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task
}
else
{
u8 battlerId;
// get wanted battler
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
battlerId = gBattleAnimAttacker;
else if (gBattleAnimArgs[0] == ANIM_TARGET)
battlerId = gBattleAnimTarget;
else if (gBattleAnimArgs[0] == ANIM_ATK_PARTNER)
battlerId = BATTLE_PARTNER(gBattleAnimAttacker);
else
battlerId = BATTLE_PARTNER(gBattleAnimTarget);
// check if battler is visible
if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battlerId))
{
DestroyAnimVisualTask(taskId);
return;
}
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
else
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
}
if (species != SPECIES_NONE)
PlayCry3(species, pan, 3);
DestroyAnimVisualTask(taskId);
}
// task end
// task start
void sub_8158E9C(u8 taskId)
{
u16 species = 0;
s8 pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->field_0;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task
}
else
{
u8 battlerId;
// get wanted battler
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
battlerId = gBattleAnimAttacker;
else if (gBattleAnimArgs[0] == ANIM_TARGET)
battlerId = gBattleAnimTarget;
else if (gBattleAnimArgs[0] == ANIM_ATK_PARTNER)
battlerId = BATTLE_PARTNER(gBattleAnimAttacker);
else
battlerId = BATTLE_PARTNER(gBattleAnimTarget);
// check if battler is visible
if ((gBattleAnimArgs[0] == ANIM_TARGET || gBattleAnimArgs[0] == ANIM_DEF_PARTNER) && !IsBattlerSpriteVisible(battlerId))
{
DestroyAnimVisualTask(taskId);
return;
}
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
else
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
}
gTasks[taskId].data[0] = gBattleAnimArgs[1];
gTasks[taskId].data[1] = species;
gTasks[taskId].data[2] = pan;
if (species != SPECIES_NONE)
{
if (gBattleAnimArgs[1] == 0xFF)
PlayCry3(species, pan, 9);
else
PlayCry3(species, pan, 7);
gTasks[taskId].func = sub_8158FF4;
}
else
{
DestroyAnimVisualTask(taskId);
}
}
static void sub_8158FF4(u8 taskId)
{
u16 species = gTasks[taskId].data[1];
s8 pan = gTasks[taskId].data[2];
if (gTasks[taskId].data[9] < 2)
{
gTasks[taskId].data[9]++;
}
else
{
if (gTasks[taskId].data[0] == 0xFF)
{
if (!IsCryPlaying())
{
PlayCry3(species, pan, 10);
DestroyAnimVisualTask(taskId);
}
}
else
{
if (!IsCryPlaying())
{
PlayCry3(species, pan, 8);
DestroyAnimVisualTask(taskId);
}
}
}
}
// task end
void sub_8159078(u8 taskId)
{
if (gTasks[taskId].data[9] < 2)
{
gTasks[taskId].data[9]++;
}
else
{
if (!IsCryPlaying())
DestroyAnimVisualTask(taskId);
}
}
// task start
void sub_81590B8(u8 taskId)
{
u16 species;
s8 pan;
gTasks[taskId].data[10] = gBattleAnimArgs[0];
pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
if (IsContest())
species = gContestResources->field_18->field_0;
else
species = gAnimBattlerSpecies[gBattleAnimAttacker];
gTasks[taskId].data[1] = species;
gTasks[taskId].data[2] = pan;
if (species != SPECIES_NONE)
gTasks[taskId].func = sub_815913C;
else
DestroyAnimVisualTask(taskId);
}
static void sub_815913C(u8 taskId)
{
u16 species = gTasks[taskId].data[1];
s8 pan = gTasks[taskId].data[2];
switch (gTasks[taskId].data[9])
{
case 2:
PlayCry6(species, pan, 4);
gTasks[taskId].data[9]++;
break;
case 1:
case 3:
case 4:
gTasks[taskId].data[9]++;
break;
case 5:
if (IsCryPlaying())
break;
case 0:
StopCryAndClearCrySongs();
gTasks[taskId].data[9]++;
break;
default:
if (gTasks[taskId].data[10] == 0)
PlayCry6(species, pan, 6);
else
PlayCry3(species, pan, 6);
DestroyAnimVisualTask(taskId);
break;
}
}
// task end
void sub_8159210(u8 taskId)
{
u16 songId = gBattleAnimArgs[0];
s8 pan = BattleAnimAdjustPanning(gBattleAnimArgs[1]);
PlaySE1WithPanning(songId, pan);
DestroyAnimVisualTask(taskId);
}
void sub_8159244(u8 taskId)
{
u16 songId = gBattleAnimArgs[0];
s8 pan = BattleAnimAdjustPanning(gBattleAnimArgs[1]);
PlaySE2WithPanning(songId, pan);
DestroyAnimVisualTask(taskId);
}
void sub_8159278(u8 taskId)
{
s8 targetPan = gBattleAnimArgs[1];
s8 panIncrement = gBattleAnimArgs[2];
u16 r9 = gBattleAnimArgs[3];
s8 sourcePan = BattleAnimAdjustPanning(gBattleAnimArgs[0]);
targetPan = BattleAnimAdjustPanning(targetPan);
panIncrement = CalculatePanIncrement(sourcePan, targetPan, panIncrement);
gTasks[taskId].data[1] = sourcePan;
gTasks[taskId].data[2] = targetPan;
gTasks[taskId].data[3] = panIncrement;
gTasks[taskId].data[5] = r9;
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11] = sourcePan;
gTasks[taskId].func = sub_8159308;
sub_8159308(taskId);
}
#ifdef NONMATCHING
void sub_8159308(u8 taskId)
{
s16 panIncrement = gTasks[taskId].data[3];
if (gTasks[taskId].data[10]++ == gTasks[taskId].data[5])
{
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[11] += panIncrement;
gTasks[taskId].data[11] = KeepPanInRange(gTasks[taskId].data[11]);
}
gUnknown_02038440 = gTasks[taskId].data[11];
if (gTasks[taskId].data[11] == gTasks[taskId].data[2])
DestroyAnimVisualTask(taskId);
}
#else
ASM_DIRECT
void sub_8159308(u8 taskId)
{
asm_unified(" push {r4,r5,lr}\n\
lsls r0, 24\n\
lsrs r0, 24\n\
adds r5, r0, 0\n\
ldr r1, =gTasks\n\
lsls r0, r5, 2\n\
adds r0, r5\n\
lsls r0, 3\n\
adds r4, r0, r1\n\
ldrh r2, [r4, 0xE]\n\
ldrh r0, [r4, 0x1C]\n\
adds r1, r0, 0x1\n\
strh r1, [r4, 0x1C]\n\
lsls r0, 16\n\
asrs r0, 16\n\
movs r3, 0x12\n\
ldrsh r1, [r4, r3]\n\
cmp r0, r1\n\
bne _08159342\n\
movs r0, 0\n\
strh r0, [r4, 0x1C]\n\
ldrh r1, [r4, 0x1E]\n\
adds r0, r2, r1\n\
strh r0, [r4, 0x1E]\n\
movs r2, 0x1E\n\
ldrsh r0, [r4, r2]\n\
bl KeepPanInRange\n\
strh r0, [r4, 0x1E]\n\
_08159342:\n\
ldr r1, =gUnknown_02038440\n\
ldrh r0, [r4, 0x1E]\n\
strb r0, [r1]\n\
movs r3, 0x1E\n\
ldrsh r1, [r4, r3]\n\
movs r2, 0xC\n\
ldrsh r0, [r4, r2]\n\
cmp r1, r0\n\
bne _0815935A\n\
adds r0, r5, 0\n\
bl DestroyAnimVisualTask\n\
_0815935A:\n\
pop {r4,r5}\n\
pop {r0}\n\
bx r0\n\
.pool");
}
#endif

View File

@ -12,7 +12,6 @@
extern bool8 gBikeCyclingChallenge;
extern u8 gBikeCollisions;
extern bool8 gUnknown_02037348;
extern u8 sub_8093514(u8 direction);
extern u8 sub_808B980(u8 direction);
@ -989,7 +988,7 @@ bool8 player_should_look_direction_be_enforced_upon_movement(void)
void GetOnOffBike(u8 transitionFlags)
{
gUnknown_02037348 = FALSE;
gUnusedBikeCameraAheadPanback = FALSE;
if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
{

View File

@ -1305,12 +1305,12 @@ void sub_8128060(u8 taskId)
void ConfigureCameraObjectForPlacingDecoration(struct PlaceDecorationGraphicsDataBuffer *data, u8 decor)
{
sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data[0];
gUnknown_03005DD0.unk4 = gpu_pal_decompress_alloc_tag_and_upload(data, decor);
gSprites[gUnknown_03005DD0.unk4].oam.priority = 1;
gSprites[gUnknown_03005DD0.unk4].callback = sub_81292D0;
gSprites[gUnknown_03005DD0.unk4].pos1.x = gUnknown_085A7250[data->decoration->shape].x;
gSprites[gUnknown_03005DD0.unk4].pos1.y = gUnknown_085A7250[data->decoration->shape].y;
sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.spriteId].data[0];
gUnknown_03005DD0.spriteId = gpu_pal_decompress_alloc_tag_and_upload(data, decor);
gSprites[gUnknown_03005DD0.spriteId].oam.priority = 1;
gSprites[gUnknown_03005DD0.spriteId].callback = sub_81292D0;
gSprites[gUnknown_03005DD0.spriteId].pos1.x = gUnknown_085A7250[data->decoration->shape].x;
gSprites[gUnknown_03005DD0.spriteId].pos1.y = gUnknown_085A7250[data->decoration->shape].y;
}
void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphicsDataBuffer *data)
@ -1332,7 +1332,7 @@ void SetUpPlacingDecorationPlayerAvatar(u8 taskId, struct PlaceDecorationGraphic
}
gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1;
DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]);
sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4;
sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.spriteId;
}
void sub_812826C(u8 taskId)
@ -2251,9 +2251,9 @@ bool8 sub_81299AC(u8 taskId)
void SetUpPuttingAwayDecorationPlayerAvatar(void)
{
player_get_direction_lower_nybble();
sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.unk4].data[0];
sDecor_CameraSpriteObjectIdx1 = gSprites[gUnknown_03005DD0.spriteId].data[0];
sub_812A39C();
gUnknown_03005DD0.unk4 = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0);
gUnknown_03005DD0.spriteId = CreateSprite(&gUnknown_085A7404, 0x78, 0x50, 0);
if (gSaveBlock2Ptr->playerGender == MALE)
{
sDecor_CameraSpriteObjectIdx2 = AddPseudoFieldObject(0xC1, SpriteCallbackDummy, 0x88, 0x48, 0);
@ -2264,7 +2264,7 @@ void SetUpPuttingAwayDecorationPlayerAvatar(void)
}
gSprites[sDecor_CameraSpriteObjectIdx2].oam.priority = 1;
DestroySprite(&gSprites[sDecor_CameraSpriteObjectIdx1]);
sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.unk4;
sDecor_CameraSpriteObjectIdx1 = gUnknown_03005DD0.spriteId;
gSprites[sDecor_CameraSpriteObjectIdx1].oam.priority = 1;
}

340
src/dewford_trend.c Normal file
View File

@ -0,0 +1,340 @@
#include "global.h"
#include "dewford_trend.h"
#include "easy_chat.h"
#include "constants/easy_chat.h"
#include "event_data.h"
#include "link.h"
#include "malloc.h"
#include "random.h"
#include "text.h"
#include "tv.h"
// static functions
static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c);
static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c);
static void sub_8122B28(struct EasyChatPair *s);
static bool8 SB1ContainsWords(u16 *a);
static bool8 IsEasyChatPairEqual(u16 *words1, u16 *words2);
static s16 GetEqualEasyChatPairIndex(struct EasyChatPair *s, struct EasyChatPair *a, u16 b);
// text
void InitDewfordTrend(void)
{
u16 i;
for (i = 0; i < 5; i++)
{
gSaveBlock1Ptr->easyChatPairs[i].words[0] = sub_811EE38(EC_GROUP_CONDITIONS);
if (Random() & 1)
gSaveBlock1Ptr->easyChatPairs[i].words[1] = sub_811EE38(EC_GROUP_LIFESTYLE);
else
gSaveBlock1Ptr->easyChatPairs[i].words[1] = sub_811EE38(EC_GROUP_HOBBIES);
gSaveBlock1Ptr->easyChatPairs[i].unk1_6 = Random() & 1;
sub_8122B28(&(gSaveBlock1Ptr->easyChatPairs[i]));
}
sub_8122804(gSaveBlock1Ptr->easyChatPairs, 5, 0);
}
void UpdateDewfordTrendPerDay(u16 a)
{
u16 i;
if (a != 0)
{
u32 sp0 = a * 5;
for (i = 0; i < 5; i++)
{
u32 r4;
u32 r2 = sp0;
struct EasyChatPair *r5 = &(gSaveBlock1Ptr->easyChatPairs[i]);
if (r5->unk1_6 == 0)
{
if (r5->unk0_0 >= (u16)r2)
{
r5->unk0_0 -= r2;
if (r5->unk0_0 == 0)
r5->unk1_6 = 1;
continue;
}
r2 -= r5->unk0_0;
r5->unk0_0 = 0;
r5->unk1_6 = 1;
}
r4 = r5->unk0_0 + r2;
if ((u16)r4 > r5->unk0_7)
{
u32 sp4 = r4 % r5->unk0_7;
r4 = r4 / r5->unk0_7;
r5->unk1_6 = r4 ^ 1;
if (r5->unk1_6)
r5->unk0_0 = sp4;
else
r5->unk0_0 = r5->unk0_7 - sp4;
}
else
{
r5->unk0_0 = r4;
if (r5->unk0_0 == r5->unk0_7)
r5->unk1_6 = 0;
}
}
sub_8122804(gSaveBlock1Ptr->easyChatPairs, 5, 0);
}
}
bool8 sub_81226D8(u16 *a)
{
struct EasyChatPair s = {0};
u16 i;
if (!SB1ContainsWords(a))
{
if (!FlagGet(FLAG_SYS_POPWORD_INPUT))
{
FlagSet(FLAG_SYS_POPWORD_INPUT);
if (!FlagGet(FLAG_SYS_MIX_RECORD))
{
gSaveBlock1Ptr->easyChatPairs[0].words[0] = a[0];
gSaveBlock1Ptr->easyChatPairs[0].words[1] = a[1];
return TRUE;
}
}
s.words[0] = a[0];
s.words[1] = a[1];
s.unk1_6 = 1;
sub_8122B28(&s);
for (i = 0; i < 5; i++)
{
if (sub_8122A58(&s, &(gSaveBlock1Ptr->easyChatPairs[i]), 0))
{
u16 r3 = 4;
while (r3 > i)
{
gSaveBlock1Ptr->easyChatPairs[r3] = gSaveBlock1Ptr->easyChatPairs[r3 - 1];
r3--;
}
gSaveBlock1Ptr->easyChatPairs[i] = s;
if(i == 4)
sub_80EDC60(a);
return (i == 0);
}
}
gSaveBlock1Ptr->easyChatPairs[4] = s;
sub_80EDC60(a);
}
return FALSE;
}
static void sub_8122804(struct EasyChatPair *s, u16 b, u8 c)
{
u16 h;
for (h = 0; h < b; h++)
{
u16 i;
for (i = h + 1; i < b; i++)
{
if (sub_8122A58(&s[i], &s[h], c))
{
struct EasyChatPair temp;
temp = s[i];
s[i] = s[h];
s[h] = temp;
}
}
}
}
void sub_812287C(void *a, u32 b, u8 unused)
{
u16 i, j, r3, players;
struct EasyChatPair *buffer1, *buffer2, *src, *dst, *foo_of_buffer2;
buffer1 = Alloc(0x100);
if(buffer1 != NULL)
{
buffer2 = Alloc(0x100);
if(buffer2 == NULL)
{
Free(buffer1);
}
else
{
players = GetLinkPlayerCount();
for (i = 0; i < players; i++)
memcpy(&(buffer1[i * 5]), (u8 *)a + i * b, 40);
src = buffer1;
dst = buffer2;
r3 = 0;
for (i = 0; i < players; i++)
{
for (j = 0; j < 5; j++)
{
s16 foo = GetEqualEasyChatPairIndex(buffer2, src, r3);
if (foo < 0)
{
*(dst++) = *src;
r3++;
}
else
{
foo_of_buffer2 = (struct EasyChatPair *)((u32)buffer2 + (foo * 8)); //required to do this to reverse the order of register operands in add ASM statement
if (foo_of_buffer2->unk0_0 < src->unk0_0)
{
*foo_of_buffer2 = *src;
}
}
src++;
}
}
sub_8122804(buffer2, r3, 2);
src = buffer2;
dst = gSaveBlock1Ptr->easyChatPairs;
for (i = 0; i < 5; i++)
*(dst++) = *(src++);
Free(buffer1);
Free(buffer2);
}
}
}
void BufferTrendyPhraseString(void)
{
struct EasyChatPair *s = &gSaveBlock1Ptr->easyChatPairs[gSpecialVar_0x8004];
ConvertEasyChatWordsToString(gStringVar1, s->words, 2, 1);
}
void TrendyPhraseIsOld(void)
{
u16 result = 0;
if (gSaveBlock1Ptr->easyChatPairs[0].unk0_0 - gSaveBlock1Ptr->easyChatPairs[1].unk0_0 < 2)
{
asm("":::"r2"); //Force the compiler to store address of gSaveBlock1 in r3 instead of r2
if (!gSaveBlock1Ptr->easyChatPairs[0].unk1_6 && gSaveBlock1Ptr->easyChatPairs[1].unk1_6)
result = 1;
}
gSpecialVar_Result = result;
}
void GetDewfordHallPaintingNameIndex(void)
{
gSpecialVar_Result = (gSaveBlock1Ptr->easyChatPairs[0].words[0] + gSaveBlock1Ptr->easyChatPairs[0].words[1]) & 7;
}
static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c)
{
switch (c)
{
case 0:
if (a->unk0_0 > b->unk0_0)
return 1;
if (a->unk0_0 < b->unk0_0)
return 0;
if (a->unk0_7 > b->unk0_7)
return 1;
if (a->unk0_7 < b->unk0_7)
return 0;
break;
case 1:
if (a->unk0_7 > b->unk0_7)
return 1;
if (a->unk0_7 < b->unk0_7)
return 0;
if (a->unk0_0 > b->unk0_0)
return 1;
if (a->unk0_0 < b->unk0_0)
return 0;
break;
case 2:
if (a->unk0_0 > b->unk0_0)
return 1;
if (a->unk0_0 < b->unk0_0)
return 0;
if (a->unk0_7 > b->unk0_7)
return 1;
if (a->unk0_7 < b->unk0_7)
return 0;
if (a->unk2 > b->unk2)
return 1;
if (a->unk2 < b->unk2)
return 0;
if (a->words[0] > b->words[0])
return 1;
if (a->words[0] < b->words[0])
return 0;
if (a->words[1] > b->words[1])
return 1;
if (a->words[1] < b->words[1])
return 0;
return 1;
}
return Random() & 1;
}
static void sub_8122B28(struct EasyChatPair *s)
{
u16 r4;
r4 = Random() % 98;
if (r4 > 50)
{
r4 = Random() % 98;
if (r4 > 80)
r4 = Random() % 98;
}
s->unk0_7 = r4 + 30;
s->unk0_0 = (Random() % (r4 + 1)) + 30;
s->unk2 = Random();
}
static bool8 SB1ContainsWords(u16 *a)
{
u16 i;
for (i = 0; i < 5; i++)
{
if (IsEasyChatPairEqual(a, gSaveBlock1Ptr->easyChatPairs[i].words) != 0)
return TRUE;
}
return FALSE;
}
static bool8 IsEasyChatPairEqual(u16 *words1, u16 *words2)
{
u16 i;
for (i = 0; i < 2; i++)
{
if (*(words1++) != *(words2++))
return FALSE;
}
return TRUE;
}
static s16 GetEqualEasyChatPairIndex(struct EasyChatPair*s, struct EasyChatPair *a, u16 b)
{
s16 i;
for (i = 0; i < b; i++)
{
if (IsEasyChatPairEqual(a->words, s->words))
return i;
s++;
}
return -1;
}

View File

@ -1,9 +1,18 @@
// Includes
#include "global.h"
#include "berry.h"
#include "bike.h"
#include "field_camera.h"
#include "field_player_avatar.h"
#include "fieldmap.h"
#include "field_map_obj.h"
#include "gpu_regs.h"
#include "menu.h"
#include "overworld.h"
#include "rotating_gate.h"
#include "sprite.h"
#include "text.h"
// Static type declarations
struct FieldCameraUnknownStruct
{
u8 unk0;
@ -13,16 +22,474 @@ struct FieldCameraUnknownStruct
bool8 unk4;
};
// Static RAM declarations
// static functions
static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData);
static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData);
static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapData *mapData);
static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapData *mapData);
static s32 MapPosToBgTilemapOffset(struct FieldCameraUnknownStruct *a, s32 x, s32 y);
static void DrawWholeMapViewInternal(int x, int y, const struct MapData *mapData);
static void DrawMetatileAt(const struct MapData *mapData, u16, int, int);
static void DrawMetatile(s32 a, u16 *b, u16 c);
static void CameraPanningCB_PanAhead(void);
IWRAM_DATA struct FieldCameraUnknownStruct gUnknown_03000E20;
IWRAM_DATA s16 gUnknown_03000E28;
IWRAM_DATA s16 gUnknown_03000E2A;
IWRAM_DATA u8 gUnknown_03000E2C;
IWRAM_DATA void (*gUnknown_03000E30)(void);
// IWRAM bss vars
static IWRAM_DATA struct FieldCameraUnknownStruct gUnknown_03000E20;
static IWRAM_DATA s16 gUnknown_03000E28;
static IWRAM_DATA s16 gUnknown_03000E2A;
static IWRAM_DATA u8 gUnknown_03000E2C;
static IWRAM_DATA void (*gUnknown_03000E30)(void);
// Static ROM declarations
// text
static void move_tilemap_camera_to_upper_left_corner_(struct FieldCameraUnknownStruct *a)
{
a->unk2 = 0;
a->unk3 = 0;
a->unk0 = 0;
a->unk1 = 0;
a->unk4 = TRUE;
}
// .rodata
static void tilemap_move_something(struct FieldCameraUnknownStruct *a, u32 b, u32 c)
{
a->unk2 += b;
a->unk2 %= 32;
a->unk3 += c;
a->unk3 %= 32;
}
static void coords8_add(struct FieldCameraUnknownStruct *a, u32 b, u32 c)
{
a->unk0 += b;
a->unk1 += c;
}
void move_tilemap_camera_to_upper_left_corner(void)
{
move_tilemap_camera_to_upper_left_corner_(&gUnknown_03000E20);
}
void FieldUpdateBgTilemapScroll(void)
{
u32 r4, r5;
r5 = gUnknown_03000E20.unk0 + gUnknown_03000E28;
r4 = gUnknown_03000E2A + gUnknown_03000E20.unk1 + 8;
SetGpuReg(REG_OFFSET_BG1HOFS, r5);
SetGpuReg(REG_OFFSET_BG1VOFS, r4);
SetGpuReg(REG_OFFSET_BG2HOFS, r5);
SetGpuReg(REG_OFFSET_BG2VOFS, r4);
SetGpuReg(REG_OFFSET_BG3HOFS, r5);
SetGpuReg(REG_OFFSET_BG3VOFS, r4);
}
void sub_8089C08(s16 *a, s16 *b)
{
*a = gUnknown_03000E20.unk0 + gUnknown_03000E28;
*b = gUnknown_03000E20.unk1 + gUnknown_03000E2A + 8;
}
void DrawWholeMapView(void)
{
DrawWholeMapViewInternal(gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y, gMapHeader.mapData);
gUnknown_03000E20.unk4 = TRUE;
}
static void DrawWholeMapViewInternal(int x, int y, const struct MapData *mapData)
{
u8 i;
u8 j;
u32 r6;
u8 temp;
for (i = 0; i < 32; i += 2)
{
temp = gUnknown_03000E20.unk3 + i;
if (temp >= 32)
temp -= 32;
r6 = temp * 32;
for (j = 0; j < 32; j += 2)
{
temp = gUnknown_03000E20.unk2 + j;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapData, r6 + temp, x + j / 2, y + i / 2);
}
}
}
static void RedrawMapSlicesForCameraUpdate(struct FieldCameraUnknownStruct *a, int x, int y)
{
const struct MapData *mapData = gMapHeader.mapData;
if (x > 0)
RedrawMapSliceWest(a, mapData);
if (x < 0)
RedrawMapSliceEast(a, mapData);
if (y > 0)
RedrawMapSliceNorth(a, mapData);
if (y < 0)
RedrawMapSliceSouth(a, mapData);
a->unk4 = TRUE;
}
static void RedrawMapSliceNorth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData)
{
u8 i;
u8 temp;
u32 r7;
temp = a->unk3 + 28;
if (temp >= 32)
temp -= 32;
r7 = temp * 32;
for (i = 0; i < 32; i += 2)
{
temp = a->unk2 + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapData, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y + 14);
}
}
static void RedrawMapSliceSouth(struct FieldCameraUnknownStruct *a, const struct MapData *mapData)
{
u8 i;
u8 temp;
u32 r7 = a->unk3 * 32;
for (i = 0; i < 32; i += 2)
{
temp = a->unk2 + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapData, r7 + temp, gSaveBlock1Ptr->pos.x + i / 2, gSaveBlock1Ptr->pos.y);
}
}
static void RedrawMapSliceEast(struct FieldCameraUnknownStruct *a, const struct MapData *mapData)
{
u8 i;
u8 temp;
u32 r6 = a->unk2;
for (i = 0; i < 32; i += 2)
{
temp = a->unk3 + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapData, temp * 32 + r6, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y + i / 2);
}
}
static void RedrawMapSliceWest(struct FieldCameraUnknownStruct *a, const struct MapData *mapData)
{
u8 i;
u8 temp;
u8 r5 = a->unk2 + 28;
if (r5 >= 32)
r5 -= 32;
for (i = 0; i < 32; i += 2)
{
temp = a->unk3 + i;
if (temp >= 32)
temp -= 32;
DrawMetatileAt(mapData, temp * 32 + r5, gSaveBlock1Ptr->pos.x + 14, gSaveBlock1Ptr->pos.y + i / 2);
}
}
void CurrentMapDrawMetatileAt(int a, int b)
{
int offset = MapPosToBgTilemapOffset(&gUnknown_03000E20, a, b);
if (offset >= 0)
{
DrawMetatileAt(gMapHeader.mapData, offset, a, b);
gUnknown_03000E20.unk4 = TRUE;
}
}
void DrawDoorMetatileAt(int x, int y, u16 *arr)
{
int offset = MapPosToBgTilemapOffset(&gUnknown_03000E20, x, y);
if (offset >= 0)
{
DrawMetatile(1, arr, offset);
gUnknown_03000E20.unk4 = TRUE;
}
}
static void DrawMetatileAt(const struct MapData *mapData, u16 b, int c, int d)
{
u16 metatileId = MapGridGetMetatileIdAt(c, d);
u16 *metatiles;
if (metatileId > 1024)
metatileId = 0;
if (metatileId < 512)
metatiles = mapData->primaryTileset->metatiles;
else
{
metatiles = mapData->secondaryTileset->metatiles;
metatileId -= 512;
}
DrawMetatile(MapGridGetMetatileLayerTypeAt(c, d), metatiles + metatileId * 8, b);
}
static void DrawMetatile(s32 a, u16 *b, u16 c)
{
switch (a)
{
case 2:
gBGTilemapBuffers3[c] = b[0];
gBGTilemapBuffers3[c + 1] = b[1];
gBGTilemapBuffers3[c + 0x20] = b[2];
gBGTilemapBuffers3[c + 0x21] = b[3];
gBGTilemapBuffers1[c] = 0;
gBGTilemapBuffers1[c + 1] = 0;
gBGTilemapBuffers1[c + 0x20] = 0;
gBGTilemapBuffers1[c + 0x21] = 0;
gBGTilemapBuffers2[c] = b[4];
gBGTilemapBuffers2[c + 1] = b[5];
gBGTilemapBuffers2[c + 0x20] = b[6];
gBGTilemapBuffers2[c + 0x21] = b[7];
break;
case 1:
gBGTilemapBuffers3[c] = b[0];
gBGTilemapBuffers3[c + 1] = b[1];
gBGTilemapBuffers3[c + 0x20] = b[2];
gBGTilemapBuffers3[c + 0x21] = b[3];
gBGTilemapBuffers1[c] = b[4];
gBGTilemapBuffers1[c + 1] = b[5];
gBGTilemapBuffers1[c + 0x20] = b[6];
gBGTilemapBuffers1[c + 0x21] = b[7];
gBGTilemapBuffers2[c] = 0;
gBGTilemapBuffers2[c + 1] = 0;
gBGTilemapBuffers2[c + 0x20] = 0;
gBGTilemapBuffers2[c + 0x21] = 0;
break;
case 0:
gBGTilemapBuffers3[c] = 0x3014;
gBGTilemapBuffers3[c + 1] = 0x3014;
gBGTilemapBuffers3[c + 0x20] = 0x3014;
gBGTilemapBuffers3[c + 0x21] = 0x3014;
gBGTilemapBuffers1[c] = b[0];
gBGTilemapBuffers1[c + 1] = b[1];
gBGTilemapBuffers1[c + 0x20] = b[2];
gBGTilemapBuffers1[c + 0x21] = b[3];
gBGTilemapBuffers2[c] = b[4];
gBGTilemapBuffers2[c + 1] = b[5];
gBGTilemapBuffers2[c + 0x20] = b[6];
gBGTilemapBuffers2[c + 0x21] = b[7];
break;
}
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
schedule_bg_copy_tilemap_to_vram(3);
}
static s32 MapPosToBgTilemapOffset(struct FieldCameraUnknownStruct *a, s32 x, s32 y)
{
x -= gSaveBlock1Ptr->pos.x;
x *= 2;
if (x >= 32 || x < 0)
return -1;
x = x + a->unk2;
if (x >= 32)
x -= 32;
y = (y - gSaveBlock1Ptr->pos.y) * 2;
if (y >= 32 || y < 0)
return -1;
y = y + a->unk3;
if (y >= 32)
y -= 32;
return y * 32 + x;
}
static void CameraUpdateCallback(struct CameraObject *a)
{
if (a->spriteId != 0)
{
a->unk8 = gSprites[a->spriteId].data[2];
a->unkC = gSprites[a->spriteId].data[3];
}
}
void ResetCameraUpdateInfo(void)
{
gUnknown_03005DD0.unk8 = 0;
gUnknown_03005DD0.unkC = 0;
gUnknown_03005DD0.x = 0;
gUnknown_03005DD0.y = 0;
gUnknown_03005DD0.spriteId = 0;
gUnknown_03005DD0.callback = NULL;
}
u32 InitCameraUpdateCallback(u8 a)
{
if (gUnknown_03005DD0.spriteId != 0)
DestroySprite(&gSprites[gUnknown_03005DD0.spriteId]);
gUnknown_03005DD0.spriteId = AddCameraObject(a);
gUnknown_03005DD0.callback = CameraUpdateCallback;
return 0;
}
void CameraUpdate(void)
{
int deltaX;
int deltaY;
int r0;
int r1;
int r7;
int r8;
if (gUnknown_03005DD0.callback != NULL)
gUnknown_03005DD0.callback(&gUnknown_03005DD0);
r7 = gUnknown_03005DD0.unk8;
r8 = gUnknown_03005DD0.unkC;
deltaX = 0;
deltaY = 0;
r1 = gUnknown_03005DD0.x;
r0 = gUnknown_03005DD0.y;
if (r1 == 0 && r7 != 0)
{
if (r7 > 0)
deltaX = 1;
else
deltaX = -1;
}
if (r0 == 0 && r8 != 0)
{
if (r8 > 0)
deltaY = 1;
else
deltaY = -1;
}
if (r1 != 0 && r1 == -r7)
{
if (r7 > 0)
deltaX = 1;
else
deltaX = -1;
}
if (r0 != 0 && r0 == -r8)
{
if (r8 > 0)
deltaX = 1;
else
deltaX = -1;
}
gUnknown_03005DD0.x += r7;
gUnknown_03005DD0.x = gUnknown_03005DD0.x - 16 * (gUnknown_03005DD0.x / 16);
gUnknown_03005DD0.y += r8;
gUnknown_03005DD0.y = gUnknown_03005DD0.y - 16 * (gUnknown_03005DD0.y / 16);
if (deltaX != 0 || deltaY != 0)
{
CameraMove(deltaX, deltaY);
UpdateFieldObjectsForCameraUpdate(deltaX, deltaY);
RotatingGatePuzzleCameraUpdate(deltaX, deltaY);
ResetBerryTreeSparkleFlags();
tilemap_move_something(&gUnknown_03000E20, deltaX * 2, deltaY * 2);
RedrawMapSlicesForCameraUpdate(&gUnknown_03000E20, deltaX * 2, deltaY * 2);
}
coords8_add(&gUnknown_03000E20, r7, r8);
gUnknown_03005DEC -= r7;
gUnknown_03005DE8 -= r8;
}
void camera_move_and_redraw(int a, int b) //unused
{
CameraMove(a, b);
UpdateFieldObjectsForCameraUpdate(a, b);
DrawWholeMapView();
gUnknown_03005DEC -= a * 16;
gUnknown_03005DE8 -= b * 16;
}
void SetCameraPanningCallback(void (*a)(void))
{
gUnknown_03000E30 = a;
}
void SetCameraPanning(s16 a, s16 b)
{
gUnknown_03000E28 = a;
gUnknown_03000E2A = b + 32;
}
void InstallCameraPanAheadCallback(void)
{
gUnknown_03000E30 = CameraPanningCB_PanAhead;
gUnknown_03000E2C = 0;
gUnknown_03000E28 = 0;
gUnknown_03000E2A = 32;
}
void UpdateCameraPanning(void)
{
if (gUnknown_03000E30 != NULL)
gUnknown_03000E30();
//Update sprite offset of overworld objects
gSpriteCoordOffsetX = gUnknown_03005DEC - gUnknown_03000E28;
gSpriteCoordOffsetY = gUnknown_03005DE8 - gUnknown_03000E2A - 8;
}
static void CameraPanningCB_PanAhead(void)
{
u8 var;
if (gUnusedBikeCameraAheadPanback == FALSE)
{
InstallCameraPanAheadCallback();
}
else
{
// this code is never reached.
if (gPlayerAvatar.tileTransitionState == T_TILE_TRANSITION)
{
gUnknown_03000E2C ^= 1;
if (gUnknown_03000E2C == 0)
return;
}
else
{
gUnknown_03000E2C = 0;
}
var = player_get_direction_upper_nybble();
if (var == 2)
{
if (gUnknown_03000E2A > -8)
gUnknown_03000E2A -= 2;
}
else if (var == 1)
{
if (gUnknown_03000E2A < 72)
gUnknown_03000E2A += 2;
}
else if (gUnknown_03000E2A < 32)
{
gUnknown_03000E2A += 2;
}
else if (gUnknown_03000E2A > 32)
{
gUnknown_03000E2A -= 2;
}
}
}
// .text

View File

@ -912,7 +912,7 @@ void re_escape_rope(u8 taskId)
DisplayItemMessageOnField(taskId, gStringVar4, task08_080A1C44);
}
bool8 sub_80FE314(void)
bool8 CanUseEscapeRopeOnCurrMap(void)
{
if (gMapHeader.flags & 2)
return TRUE;
@ -922,7 +922,7 @@ bool8 sub_80FE314(void)
void ItemUseOutOfBattle_EscapeRope(u8 taskId)
{
if (sub_80FE314() == TRUE)
if (CanUseEscapeRopeOnCurrMap() == TRUE)
{
gUnknown_0203A0F4 = re_escape_rope;
SetUpItemUseOnFieldCallback(taskId);

View File

@ -403,11 +403,11 @@ static bool8 MailReadBuildGraphics(void)
switch (sMailRead->animsActive)
{
case 1:
sub_80D2F68(icon);
LoadMonIconPalette(icon);
sMailRead->monIconSprite = sub_80D2D78(icon, SpriteCallbackDummy, 0x60, 0x80, 0, 0);
break;
case 2:
sub_80D2F68(icon);
LoadMonIconPalette(icon);
sMailRead->monIconSprite = sub_80D2D78(icon, SpriteCallbackDummy, 0x28, 0x80, 0, 0);
break;
}
@ -540,7 +540,7 @@ static void CB2_ExitMailReadFreeVars(void)
{
case 1:
case 2:
sub_80D2FF0(sub_80D2E84(sMailRead->mail->species));
FreeMonIconPalette(sub_80D2E84(sMailRead->mail->species));
sub_80D2EF8(&gSprites[sMailRead->monIconSprite]);
}
memset(sMailRead, 0, sizeof(*sMailRead));

474
src/map_name_popup.c Normal file
View File

@ -0,0 +1,474 @@
#include "global.h"
#include "constants/region_map_sections.h"
#include "constants/weather.h"
#include "bg.h"
#include "event_data.h"
#include "gpu_regs.h"
#include "international_string_util.h"
#include "menu.h"
#include "map_name_popup.h"
#include "palette.h"
#include "region_map.h"
#include "rom_818CFC8.h"
#include "start_menu.h"
#include "string_util.h"
#include "task.h"
#include "text.h"
// enums
enum MapPopUp_Themes
{
MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_MARBLE,
MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_BRICK,
MAPPOPUP_THEME_UNDERWATER,
MAPPOPUP_THEME_STONE2,
};
// static functions
static void Task_MapNamePopUpWindow(u8 taskId);
static void ShowMapNamePopUpWindow(void);
static void LoadMapNamePopUpWindowBg(void);
// EWRAM
static EWRAM_DATA u8 mapNamePopupTaskId = 0;
// .rodata
static const u8 gMapPopUp_Table[][960] =
{
INCBIN_U8("graphics/interface/map_popup/wood.4bpp"),
INCBIN_U8("graphics/interface/map_popup/marble.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone.4bpp"),
INCBIN_U8("graphics/interface/map_popup/brick.4bpp"),
INCBIN_U8("graphics/interface/map_popup/underwater.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone2.4bpp"),
};
static const u8 gMapPopUp_Outline_Table[][960] =
{
INCBIN_U8("graphics/interface/map_popup/wood_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/marble_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/brick_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/underwater_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone2_outline.4bpp"),
};
static const u16 gMapPopUp_Palette_Table[][16] =
{
INCBIN_U16("graphics/interface/map_popup/wood.gbapal"),
INCBIN_U16("graphics/interface/map_popup/marble_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/stone_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/brick_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/underwater_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/stone2_outline.gbapal"),
};
static const u16 gUnknown_0857F444[16] = INCBIN_U16("graphics/interface/map_popup/857F444.gbapal");
static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] =
{
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_BRICK,
MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK,
MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER,
MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_UNDERWATER,
MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER,
MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER,
MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2,
MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_MARBLE,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2,
MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_MARBLE
};
static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
static const u8 gText_PyramidFloor2[] = _("PYRAMID FLOOR 2");
static const u8 gText_PyramidFloor3[] = _("PYRAMID FLOOR 3");
static const u8 gText_PyramidFloor4[] = _("PYRAMID FLOOR 4");
static const u8 gText_PyramidFloor5[] = _("PYRAMID FLOOR 5");
static const u8 gText_PyramidFloor6[] = _("PYRAMID FLOOR 6");
static const u8 gText_PyramidFloor7[] = _("PYRAMID FLOOR 7");
static const u8 gText_Pyramid[] = _("PYRAMID");
static const u8 * const gBattlePyramid_MapHeaderStrings[] =
{
gText_PyramidFloor1,
gText_PyramidFloor2,
gText_PyramidFloor3,
gText_PyramidFloor4,
gText_PyramidFloor5,
gText_PyramidFloor6,
gText_PyramidFloor7,
gText_Pyramid,
};
// text
bool8 sub_80D47D4(void)
{
HideStartMenu();
ShowMapNamePopup();
return 1;
}
void ShowMapNamePopup(void)
{
if (FlagGet(FLAG_SPECIAL_FLAG_0x4000) != TRUE)
{
if (!FuncIsActiveTask(Task_MapNamePopUpWindow))
{
mapNamePopupTaskId = CreateTask(Task_MapNamePopUpWindow, 90);
SetGpuReg(REG_OFFSET_BG0VOFS, 40);
gTasks[mapNamePopupTaskId].data[0] = 6;
gTasks[mapNamePopupTaskId].data[2] = 40;
}
else
{
if (gTasks[mapNamePopupTaskId].data[0] != 2)
gTasks[mapNamePopupTaskId].data[0] = 2;
gTasks[mapNamePopupTaskId].data[3] = 1;
}
}
}
static void Task_MapNamePopUpWindow(u8 taskId)
{
struct Task *task = &gTasks[taskId];
switch (task->data[0])
{
case 6:
task->data[4]++;
if (task->data[4] > 30)
{
task->data[0] = 0;
task->data[4] = 0;
ShowMapNamePopUpWindow();
}
break;
case 0:
task->data[2] -= 2;
if (task->data[2] <= 0 )
{
task->data[2] = 0;
task->data[0] = 1;
gTasks[mapNamePopupTaskId].data[1] = 0;
}
break;
case 1:
task->data[1]++;
if (task->data[1] > 120 )
{
task->data[1] = 0;
task->data[0] = 2;
}
break;
case 2:
task->data[2] += 2;
if (task->data[2] > 39)
{
task->data[2] = 40;
if (task->data[3])
{
task->data[0] = 6;
task->data[4] = 0;
task->data[3] = 0;
}
else
{
task->data[0] = 4;
return;
}
}
break;
case 4:
sub_819746C(GetMapNamePopUpWindowId(), TRUE);
task->data[0] = 5;
break;
case 5:
HideMapNamePopUpWindow();
return;
}
SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]);
}
void HideMapNamePopUpWindow(void)
{
if (FuncIsActiveTask(Task_MapNamePopUpWindow))
{
sub_819746C(GetMapNamePopUpWindowId(), TRUE);
RemoveMapNamePopUpWindow();
SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0);
DestroyTask(mapNamePopupTaskId);
}
}
static void ShowMapNamePopUpWindow(void)
{
u8 mapDisplayHeader[24];
u8 *withoutPrefixPtr;
u8 x;
const u8* mapDisplayHeaderSource;
if(InBattlePyramid())
{
if(gMapHeader.mapDataId == 0x17A)
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7];
}
else
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->battlePyramidWildHeaderId];
}
StringCopy(withoutPrefixPtr, mapDisplayHeaderSource);
}
else
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
GetMapName(withoutPrefixPtr, gMapHeader.regionMapSectionId, 0);
}
AddMapNamePopUpWindow();
LoadMapNamePopUpWindowBg();
x = GetStringCenterAlignXOffset(7, withoutPrefixPtr, 80);
mapDisplayHeader[0] = EXT_CTRL_CODE_BEGIN;
mapDisplayHeader[1] = EXT_CTRL_CODE_HIGHLIGHT;
mapDisplayHeader[2] = TEXT_COLOR_TRANSPARENT;
PrintTextOnWindow(GetMapNamePopUpWindowId(), 7, mapDisplayHeader, x, 3, 0xFF, NULL);
CopyWindowToVram(GetMapNamePopUpWindowId(), 3);
}
#ifdef NONMATCHING
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
{
s32 i;
for(i=0; i<=11; i++)
{
FillBgTilemapBufferRect(bg, 0x21D + i, x + i - 1, y - 1, 1, 1, 0xE);
}
FillBgTilemapBufferRect(bg, 0x229 + i, x - 1, y, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22A + i, deltaX + x, y, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22B + i, x - 1, y + 1 , 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22C + i, deltaX + x, y + 1, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22D + i, x - 1, y + 2, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22E + i, deltaX + x, y + 2, 1, 1, 0xE);
for(i=0; i<=11; i++)
{
FillBgTilemapBufferRect(bg, 0x22F + i, x + i - 1, y + deltaY, 1, 1, 0xE);
}
}
#else
ASM_DIRECT
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
{
asm("\n\
.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, 0x1C\n\
ldr r4, [sp, 0x3C]\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r10, r1\n\
lsls r2, 24\n\
lsls r3, 24\n\
lsrs r3, 24\n\
str r3, [sp, 0x10]\n\
lsls r4, 24\n\
lsrs r4, 24\n\
str r4, [sp, 0x14]\n\
movs r5, 0\n\
lsls r0, r1, 24\n\
asrs r1, r0, 24\n\
lsrs r3, r2, 24\n\
str r3, [sp, 0xC]\n\
movs r6, 0xFF\n\
lsls r6, 24\n\
adds r6, r2\n\
mov r8, r6\n\
str r0, [sp, 0x18]\n\
subs r4, r1, 0x1\n\
_080D4AB4:\n\
ldr r0, =0x0000021d\n\
adds r1, r5, r0\n\
lsls r1, 16\n\
lsrs r1, 16\n\
lsls r2, r4, 24\n\
lsrs r2, 24\n\
movs r3, 0x1\n\
str r3, [sp]\n\
str r3, [sp, 0x4]\n\
movs r6, 0xE\n\
mov r9, r6\n\
str r6, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r6, r8\n\
lsrs r3, r6, 24\n\
bl FillBgTilemapBufferRect\n\
adds r4, 0x1\n\
adds r5, 0x1\n\
cmp r5, 0xB\n\
ble _080D4AB4\n\
ldr r1, =0x00000229\n\
movs r0, 0x1\n\
negs r0, r0\n\
add r0, r10\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
movs r5, 0x1\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r2, r9\n\
str r2, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r2, r8\n\
ldr r3, [sp, 0xC]\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022a\n\
ldr r6, [sp, 0x10]\n\
add r6, r10\n\
lsls r6, 24\n\
lsrs r6, 24\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r3, r9\n\
str r3, [sp, 0x8]\n\
adds r0, r7, 0\n\
adds r2, r6, 0\n\
ldr r3, [sp, 0xC]\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022b\n\
ldr r4, [sp, 0xC]\n\
adds r4, 0x1\n\
lsls r4, 24\n\
lsrs r4, 24\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r0, r9\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r2, r8\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
movs r1, 0x8B\n\
lsls r1, 2\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r2, r9\n\
str r2, [sp, 0x8]\n\
adds r0, r7, 0\n\
adds r2, r6, 0\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022d\n\
ldr r4, [sp, 0xC]\n\
adds r4, 0x2\n\
lsls r4, 24\n\
lsrs r4, 24\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r3, r9\n\
str r3, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r2, r8\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022e\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r0, r9\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
adds r2, r6, 0\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
movs r5, 0\n\
ldr r1, [sp, 0xC]\n\
ldr r2, [sp, 0x14]\n\
adds r0, r1, r2\n\
lsls r4, r0, 24\n\
movs r6, 0x1\n\
_080D4B8A:\n\
ldr r3, =0x0000022f\n\
adds r1, r5, r3\n\
lsls r1, 16\n\
lsrs r1, 16\n\
subs r0, r5, 0x1\n\
ldr r3, [sp, 0x18]\n\
asrs r2, r3, 24\n\
adds r2, r0\n\
lsls r2, 24\n\
lsrs r2, 24\n\
str r6, [sp]\n\
str r6, [sp, 0x4]\n\
movs r0, 0xE\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
lsrs r3, r4, 24\n\
bl FillBgTilemapBufferRect\n\
adds r5, 0x1\n\
cmp r5, 0xB\n\
ble _080D4B8A\n\
add sp, 0x1C\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\
.syntax divided");
}
#endif // NONMATCHING
static void LoadMapNamePopUpWindowBg(void)
{
u8 popupWindowId;
u16 regionMapSectionId;
u8 popUpThemeId;
popupWindowId = GetMapNamePopUpWindowId();
regionMapSectionId = gMapHeader.regionMapSectionId;
if(regionMapSectionId > MAPSEC_DYNAMIC)
{
if(regionMapSectionId > MAPSEC_SPECIAL_AREA)
regionMapSectionId -= (MAPSEC_SPECIAL_AREA - MAPSEC_DYNAMIC);
else
regionMapSectionId = 0; //discard kanto region sections
}
popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId];
LoadBgTiles(GetWindowAttribute(popupWindowId, 0), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D);
CallWindowFunction(popupWindowId, sub_80D4A78);
PutWindowTilemap(popupWindowId);
if(gMapHeader.weather == WEATHER_BUBBLES)
LoadPalette(&gUnknown_0857F444, 0xE0, 0x20);
else
LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20);
BlitBitmapToWindow(popupWindowId, &(gMapPopUp_Table[popUpThemeId][0]), 0, 0, 80, 24);
}

187
src/map_obj_lock.c Normal file
View File

@ -0,0 +1,187 @@
#include "global.h"
#include "event_data.h"
#include "field_map_obj.h"
#include "field_map_obj_helpers.h"
#include "field_player_avatar.h"
#include "map_obj_lock.h"
#include "script_movement.h"
#include "task.h"
#include "trainer_see.h"
bool8 walkrun_is_standing_still(void)
{
if (gPlayerAvatar.tileTransitionState == T_TILE_TRANSITION)
return FALSE;
else
return TRUE;
}
static void sub_80983A4(u8 taskId)
{
if (walkrun_is_standing_still())
{
sub_808B864();
DestroyTask(taskId);
}
}
bool8 sub_80983C4(void)
{
if (FuncIsActiveTask(sub_80983A4))
{
return FALSE;
}
else
{
sub_808BCF4();
return TRUE;
}
}
void ScriptFreezeMapObjects(void)
{
FreezeMapObjects();
CreateTask(sub_80983A4, 80);
}
static void sub_8098400(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (!task->data[0] && walkrun_is_standing_still() == TRUE)
{
sub_808B864();
task->data[0] = 1;
}
if (!task->data[1] && !gMapObjects[gSelectedMapObject].mapobj_bit_1)
{
FreezeMapObject(&gMapObjects[gSelectedMapObject]);
task->data[1] = 1;
}
if (task->data[0] && task->data[1])
DestroyTask(taskId);
}
bool8 sub_809847C(void)
{
if (FuncIsActiveTask(sub_8098400))
{
return FALSE;
}
else
{
sub_808BCF4();
return TRUE;
}
}
void LockSelectedMapObject(void)
{
u8 taskId;
FreezeMapObjectsExceptOne(gSelectedMapObject);
taskId = CreateTask(sub_8098400, 80);
if (!gMapObjects[gSelectedMapObject].mapobj_bit_1)
{
FreezeMapObject(&gMapObjects[gSelectedMapObject]);
gTasks[taskId].data[1] = 1;
}
}
void sub_80984F4(void)
{
u8 objectId = GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0);
FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[objectId]);
sub_80D338C();
UnfreezeMapObjects();
}
void sub_8098524(void)
{
u8 objectId;
if (gMapObjects[gSelectedMapObject].active)
FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[gSelectedMapObject]);
objectId = GetFieldObjectIdByLocalIdAndMap(0xFF, 0, 0);
FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[objectId]);
sub_80D338C();
UnfreezeMapObjects();
}
void sub_8098574(void)
{
FieldObjectFaceOppositeDirection(&gMapObjects[gSelectedMapObject], gSpecialVar_Facing);
}
void sub_809859C(void)
{
FieldObjectClearAnimIfSpecialAnimActive(&gMapObjects[gSelectedMapObject]);
}
static void sub_80985BC(u8 taskId)
{
struct Task *task = &gTasks[taskId];
u8 mapObjectId = task->data[2];
if (!task->data[0] && walkrun_is_standing_still() == TRUE)
{
sub_808B864();
task->data[0] = 1;
}
if (!task->data[1] && !gMapObjects[mapObjectId].mapobj_bit_1)
{
FreezeMapObject(&gMapObjects[mapObjectId]);
task->data[1] = 1;
}
if (task->data[0] && task->data[1])
DestroyTask(taskId);
}
void sub_8098630(void)
{
u8 trainerObjectId1, trainerObjectId2, taskId;
trainerObjectId1 = GetChosenApproachingTrainerMapObjectId(0);
if(gNoOfApproachingTrainers == 2)
{
trainerObjectId2 = GetChosenApproachingTrainerMapObjectId(1);
sub_8098074(trainerObjectId1, trainerObjectId2);
taskId = CreateTask(sub_80985BC, 80);
gTasks[taskId].data[2] = trainerObjectId1;
if(!gMapObjects[trainerObjectId1].mapobj_bit_1)
{
FreezeMapObject(&gMapObjects[trainerObjectId1]);
gTasks[taskId].data[1] = 1;
}
taskId = CreateTask(sub_80985BC, 81);
gTasks[taskId].data[2] = trainerObjectId2;
if(!gMapObjects[trainerObjectId2].mapobj_bit_1)
{
FreezeMapObject(&gMapObjects[trainerObjectId2]);
gTasks[taskId].data[1] = 1;
}
}
else
{
FreezeMapObjectsExceptOne(trainerObjectId1);
taskId = CreateTask(sub_80985BC, 80);
gTasks[taskId].data[2] = trainerObjectId1;
if(!gMapObjects[trainerObjectId1].mapobj_bit_1)
{
FreezeMapObject(&gMapObjects[trainerObjectId1]);
gTasks[taskId].data[1] = 1;
}
}
}
bool8 sub_8098734(void)
{
if (FuncIsActiveTask(sub_80985BC))
{
return FALSE;
}
else
{
sub_808BCF4();
return TRUE;
}
}

611
src/mon_markings.c Normal file
View File

@ -0,0 +1,611 @@
#include "global.h"
#include "dma3.h"
#include "graphics.h"
#include "main.h"
#include "menu_indicators.h"
#include "mon_markings.h"
#include "constants/songs.h"
#include "sound.h"
#include "sprite.h"
#include "text_window.h"
#define MENU_TEXT_SPRITE_X_OFFSET 32
// static functions
static void sub_811FC80(s16, s16, u16, u16);
static void TaskDummy7(struct Sprite *);
static void sub_811FF40(struct Sprite *);
static void sub_811FF7C(struct Sprite *);
static struct Sprite *sub_811FFD4(u16, u16, const u16 *, u16);
// .rodata
static const u16 gUnknown_0859E65C[] = INCBIN_U16("graphics/misc/mon_markings.gbapal");
static const u8 gUnknown_0859E67C[] = INCBIN_U8("graphics/misc/mon_markings.4bpp");
static const struct OamData gUnknown_0859EE7C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct OamData gUnknown_0859EE84 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 0,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd gUnknown_0859EE8C[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EE94[] =
{
ANIMCMD_FRAME(1, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EE9C[] =
{
ANIMCMD_FRAME(2, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EEA4[] =
{
ANIMCMD_FRAME(3, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EEAC[] =
{
ANIMCMD_FRAME(4, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EEB4[] =
{
ANIMCMD_FRAME(5, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EEBC[] =
{
ANIMCMD_FRAME(6, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EEC4[] =
{
ANIMCMD_FRAME(7, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EECC[] =
{
ANIMCMD_FRAME(8, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EED4[] =
{
ANIMCMD_FRAME(9, 5),
ANIMCMD_END,
};
static const union AnimCmd *const gUnknown_0859EEDC[] =
{
gUnknown_0859EE8C,
gUnknown_0859EE94,
gUnknown_0859EE9C,
gUnknown_0859EEA4,
gUnknown_0859EEAC,
gUnknown_0859EEB4,
gUnknown_0859EEBC,
gUnknown_0859EEC4,
gUnknown_0859EECC,
gUnknown_0859EED4,
};
static const union AnimCmd gUnknown_0859EF04[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF0C[] =
{
ANIMCMD_FRAME(64, 5),
ANIMCMD_END,
};
static const union AnimCmd *const gUnknown_0859EF14[] =
{
gUnknown_0859EF04,
gUnknown_0859EF0C,
};
static const struct OamData gUnknown_0859EF1C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd gUnknown_0859EF24[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF2C[] =
{
ANIMCMD_FRAME(4, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF34[] =
{
ANIMCMD_FRAME(8, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF3C[] =
{
ANIMCMD_FRAME(12, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF44[] =
{
ANIMCMD_FRAME(16, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF4C[] =
{
ANIMCMD_FRAME(20, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF54[] =
{
ANIMCMD_FRAME(24, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF5C[] =
{
ANIMCMD_FRAME(28, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF64[] =
{
ANIMCMD_FRAME(32, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF6C[] =
{
ANIMCMD_FRAME(36, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF74[] =
{
ANIMCMD_FRAME(40, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF7C[] =
{
ANIMCMD_FRAME(44, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF84[] =
{
ANIMCMD_FRAME(48, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF8C[] =
{
ANIMCMD_FRAME(52, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF94[] =
{
ANIMCMD_FRAME(56, 5),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0859EF9C[] =
{
ANIMCMD_FRAME(60, 5),
ANIMCMD_END,
};
static const union AnimCmd *const gUnknown_0859EFA4[] =
{
gUnknown_0859EF24,
gUnknown_0859EF2C,
gUnknown_0859EF34,
gUnknown_0859EF3C,
gUnknown_0859EF44,
gUnknown_0859EF4C,
gUnknown_0859EF54,
gUnknown_0859EF5C,
gUnknown_0859EF64,
gUnknown_0859EF6C,
gUnknown_0859EF74,
gUnknown_0859EF7C,
gUnknown_0859EF84,
gUnknown_0859EF8C,
gUnknown_0859EF94,
gUnknown_0859EF9C,
};
static EWRAM_DATA struct PokemonMarkMenu *sMenu = NULL;
void sub_811F90C(struct PokemonMarkMenu *ptr)
{
sMenu = ptr;
}
void sub_811F918(void)
{
const struct TilesPal *frame = GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType);
sMenu->frameTiles = frame->tiles;
sMenu->framePalette = frame->pal;
sMenu->tileLoadState = 0;
CpuFill16(0, sMenu->menuWindowSpriteTiles, sizeof(sMenu->menuWindowSpriteTiles));
}
bool8 sub_811F960(void)
{
u16 i;
u8 *dest = sMenu->menuWindowSpriteTiles + sMenu->tileLoadState * 0x100;
switch (sMenu->tileLoadState)
{
case 0:
CpuFastCopy(sMenu->frameTiles, dest, TILE_SIZE_4BPP);
for (i = 0; i < 6; i++)
{
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP, dest + TILE_SIZE_4BPP * (i + 1), TILE_SIZE_4BPP);
}
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 2, dest + TILE_SIZE_4BPP * 7, TILE_SIZE_4BPP);
sMenu->tileLoadState++;
break;
default:
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 3, dest, TILE_SIZE_4BPP);
for (i = 0; i < 6; i++)
{
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 4, dest + TILE_SIZE_4BPP * (i + 1), TILE_SIZE_4BPP);
}
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 5, dest + TILE_SIZE_4BPP * 7, TILE_SIZE_4BPP);
sMenu->tileLoadState++;
break;
case 13:
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 6, dest, TILE_SIZE_4BPP);
for (i = 0; i < 6; i++)
{
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 7, dest + TILE_SIZE_4BPP * (i + 1), TILE_SIZE_4BPP);
}
CpuFastCopy(sMenu->frameTiles + TILE_SIZE_4BPP * 8, dest + TILE_SIZE_4BPP * 7, TILE_SIZE_4BPP);
sMenu->tileLoadState++;
return FALSE;
case 14:
return FALSE;
}
return TRUE;
}
void sub_811FA90(void)
{
sub_811F918();
while (sub_811F960());
}
void sub_811FAA4(u8 markings, s16 x, s16 y)
{
u16 i;
sMenu->cursorPos = 0;
sMenu->markings = markings;
for (i = 0; i < 4; i++)
sMenu->markingsArray[i] = (sMenu->markings >> i) & 1;
sub_811FC80(x, y, sMenu->baseTileTag, sMenu->basePaletteTag);
}
void sub_811FAF8(void)
{
u16 i;
for (i = 0; i < 2; i++)
{
FreeSpriteTilesByTag(sMenu->baseTileTag + i);
FreeSpritePaletteByTag(sMenu->basePaletteTag + i);
}
for (i = 0; i < 2; i++)
{
if (!sMenu->menuWindowSprites[i])
return;
DestroySprite(sMenu->menuWindowSprites[i]);
sMenu->menuWindowSprites[i] = NULL;
}
for (i = 0; i < 4; i++)
{
if (!sMenu->menuMarkingSprites[i])
return;
DestroySprite(sMenu->menuMarkingSprites[i]);
sMenu->menuMarkingSprites[i] = NULL;
}
if (sMenu->unkSprite)
{
DestroySprite(sMenu->unkSprite);
sMenu->unkSprite = NULL;
}
if (sMenu->menuTextSprite)
{
DestroySprite(sMenu->menuTextSprite);
sMenu->menuTextSprite = NULL;
}
}
bool8 sub_811FBA4(void)
{
u16 i;
if (gMain.newKeys & DPAD_UP)
{
s8 pos;
PlaySE(SE_SELECT);
pos = --sMenu->cursorPos;
if (pos < 0)
sMenu->cursorPos = 5;
return TRUE;
}
if (gMain.newKeys & DPAD_DOWN)
{
s8 pos;
PlaySE(SE_SELECT);
pos = ++sMenu->cursorPos;
if (pos > 5)
sMenu->cursorPos = 0;
return TRUE;
}
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
switch (sMenu->cursorPos)
{
case 4:
sMenu->markings = 0;
for (i = 0; i < 4; i++)
sMenu->markings |= sMenu->markingsArray[i] << i;
return FALSE;
case 5:
return FALSE;
}
sMenu->markingsArray[sMenu->cursorPos] = !sMenu->markingsArray[sMenu->cursorPos];
return TRUE;
}
if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
return FALSE;
}
return TRUE;
}
static void sub_811FC80(s16 x, s16 y, u16 baseTileTag, u16 basePaletteTag)
{
u16 i;
u8 spriteId;
struct SpriteSheet sheets[] =
{
{ sMenu->menuWindowSpriteTiles, 0x1000, baseTileTag },
{ gPokenavConditionMarker_Gfx, 0x320, baseTileTag + 1 },
{ NULL, 0 }
};
struct SpritePalette palettes[] =
{
{ sMenu->framePalette, basePaletteTag },
{ gPokenavConditionMarker_Pal, basePaletteTag + 1},
{ NULL, 0 }
};
struct SpriteTemplate sprTemplate =
{
baseTileTag,
basePaletteTag,
&gUnknown_0859EE7C,
gUnknown_0859EF14,
NULL,
gDummySpriteAffineAnimTable,
TaskDummy7,
};
LoadSpriteSheets(sheets);
LoadSpritePalettes(palettes);
for (i = 0; i < 2; i++)
{
spriteId = CreateSprite(&sprTemplate, x + 32, y + 32, 1);
if (spriteId != 64)
{
sMenu->menuWindowSprites[i] = &gSprites[spriteId];
StartSpriteAnim(&gSprites[spriteId], i);
}
else
{
sMenu->menuWindowSprites[i] = NULL;
return;
}
}
sMenu->menuWindowSprites[1]->pos1.y = y + 96;
sprTemplate.tileTag++;
sprTemplate.paletteTag++;
sprTemplate.anims = gUnknown_0859EEDC;
sprTemplate.callback = sub_811FF40;
sprTemplate.oam = &gUnknown_0859EE84;
for (i = 0; i < 4; i++)
{
spriteId = CreateSprite(&sprTemplate, x + 32, y + 16 + 16 * i, 0);
if (spriteId != 64)
{
sMenu->menuMarkingSprites[i] = &gSprites[spriteId];
gSprites[spriteId].data[0] = i;
}
else
{
sMenu->menuMarkingSprites[i] = NULL;
return;
}
}
sprTemplate.callback = SpriteCallbackDummy;
spriteId = CreateSprite(&sprTemplate, 0, 0, 0);
if (spriteId != 64)
{
sMenu->menuTextSprite = &gSprites[spriteId];
sMenu->menuTextSprite->oam.shape = ST_OAM_SQUARE;
sMenu->menuTextSprite->oam.size = 2;
StartSpriteAnim(sMenu->menuTextSprite, 9);
sMenu->menuTextSprite->pos1.x = x + MENU_TEXT_SPRITE_X_OFFSET;
sMenu->menuTextSprite->pos1.y = y + 80;
CalcCenterToCornerVec(sMenu->menuTextSprite, 1, 2, 0);
}
else
{
sMenu->menuTextSprite = NULL;
}
sprTemplate.callback = sub_811FF7C;
spriteId = CreateSprite(&sprTemplate, x + 12, 0, 0);
if(spriteId != 64)
{
sMenu->unkSprite = &gSprites[spriteId];
sMenu->unkSprite->data[0] = y + 16;
StartSpriteAnim(sMenu->unkSprite, 8);
}
else
{
sMenu->unkSprite = NULL;
}
}
static void TaskDummy7(struct Sprite *sprite)
{
}
static void sub_811FF40(struct Sprite *sprite)
{
if (sMenu->markingsArray[sprite->data[0]])
StartSpriteAnim(sprite, 2 * sprite->data[0] + 1);
else
StartSpriteAnim(sprite, 2 * sprite->data[0]);
}
static void sub_811FF7C(struct Sprite *sprite)
{
sprite->pos1.y = (16 * sMenu->cursorPos) + sprite->data[0];
}
struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette)
{
if (!palette)
palette = gUnknown_0859E65C;
return sub_811FFD4(tileTag, paletteTag, palette, 16);
}
struct Sprite *sub_811FFB4(u16 tileTag, u16 paletteTag, const u16 *palette)
{
if (!palette)
palette = gUnknown_0859E65C;
return sub_811FFD4(tileTag, paletteTag, palette, 1);
}
static struct Sprite *sub_811FFD4(u16 tileTag, u16 paletteTag, const u16 *palette, u16 size)
{
u8 spriteId;
struct SpriteTemplate sprTemplate;
struct SpriteSheet sheet = { gUnknown_0859E67C, 0x80, tileTag };
struct SpritePalette sprPalette = { palette, paletteTag };
sprTemplate.tileTag = tileTag;
sprTemplate.paletteTag = paletteTag;
sprTemplate.oam = &gUnknown_0859EF1C;
sprTemplate.anims = gUnknown_0859EFA4;
sprTemplate.images = NULL;
sprTemplate.affineAnims = gDummySpriteAffineAnimTable;
sprTemplate.callback = TaskDummy7;
sheet.size = size * 0x80;
LoadSpriteSheet(&sheet);
LoadSpritePalette(&sprPalette);
spriteId = CreateSprite(&sprTemplate, 0, 0, 0);
if (spriteId != 64)
return &gSprites[spriteId];
else
return NULL;
}
void sub_8120084(u8 markings, void *dest)
{
RequestDma3Copy(gUnknown_0859E67C + markings * 0x80, dest, 0x80, 0x10);
}

View File

@ -75,7 +75,7 @@ static const u8 gSpriteImage_858BCB8[] = INCBIN_U8("graphics/naming_screen/pc_ic
static const u16 gUnknown_0858BD78[] = INCBIN_U16("graphics/naming_screen/0.gbapal");
static const u16 gUnknown_0858BD98[] = INCBIN_U16("graphics/naming_screen/1.gbapal");
static const u8 *const gUnknown_0858BDB8[] =
static const u8 *const gUnknown_0858BDB8[] =
{
gText_PkmnTransferredSomeonesPC,
gText_PkmnTransferredLanettesPC,
@ -85,7 +85,7 @@ static const u8 *const gUnknown_0858BDB8[] =
static const u8 gUnknown_0858BDC8[] = _("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!");
static const struct BgTemplate gUnknown_0858BE00[] =
static const struct BgTemplate gUnknown_0858BE00[] =
{
{
.bg = 0,
@ -226,10 +226,10 @@ void DoNamingScreen(u8 templateNum, u8 *destBuffer, u16 monSpecies, u16 monGende
gNamingScreenData->monPersonality = monPersonality;
gNamingScreenData->destBuffer = destBuffer;
gNamingScreenData->returnCallback = returnCallback;
if (templateNum == 0)
StartTimer1();
SetMainCallback2(C2_NamingScreen);
}
}
@ -316,15 +316,15 @@ static void sub_80E2FA4(void)
static void NamingScreen_InitBGs(void)
{
u8 i;
DmaClearLarge16(3, (void *)VRAM, VRAM_SIZE, 0x1000);
DmaClear32(3, (void *)OAM, OAM_SIZE);
DmaClear16(3, (void *)PLTT, PLTT_SIZE);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_0858BE00, 4);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
@ -333,21 +333,21 @@ static void NamingScreen_InitBGs(void)
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
sub_81971D0();
sub_8197200();
for (i = 0; i < 5; i++)
gNamingScreenData->windows[i] = AddWindow(&gUnknown_0858BE10[i]);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0xC, 0x8));
SetBgTilemapBuffer(1, gNamingScreenData->tilemapBuffer1);
SetBgTilemapBuffer(2, gNamingScreenData->tilemapBuffer2);
SetBgTilemapBuffer(3, gNamingScreenData->tilemapBuffer3);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 0x20, 0x20);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 0x20, 0x20);
FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 0x20, 0x20);
@ -511,7 +511,7 @@ static bool8 MainState_WaitFadeOutAndExit(void)
static void DisplaySentToPCMessage(void)
{
u8 stringToDisplay = 0;
if (!sub_813B260())
{
StringCopy(gStringVar1, GetBoxNamePtr(VarGet(VAR_STORAGE_UNKNOWN)));
@ -524,10 +524,10 @@ static void DisplaySentToPCMessage(void)
StringCopy(gStringVar3, GetBoxNamePtr(get_unknown_box_id()));
stringToDisplay = 2;
}
if (FlagGet(FLAG_SYS_PC_LANETTE))
stringToDisplay++;
StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]);
NewMenuHelpers_DrawDialogueFrame(0, 0);
gTextFlags.flag_0 = TRUE;
@ -538,10 +538,10 @@ static void DisplaySentToPCMessage(void)
static bool8 sub_80E3604(void)
{
RunTextPrinters();
if (!IsTextPrinterActive(0) && (gMain.newKeys & A_BUTTON))
gNamingScreenData->state = MAIN_STATE_BEGIN_FADE_OUT;
return FALSE;
}
@ -562,17 +562,17 @@ static bool8 MainState_WaitPageSwap(void)
s16 cursorX;
s16 cursorY;
bool32 var3;
if (IsPageSwapAnimNotInProgress())
{
GetCursorPos(&cursorX, &cursorY);
var3 = (cursorX == GetCurrentPageColumnCount());
gNamingScreenData->state = MAIN_STATE_HANDLE_INPUT;
gNamingScreenData->currentPage++;
gNamingScreenData->currentPage %= 3;
if (var3)
{
cursorX = GetCurrentPageColumnCount();
@ -582,7 +582,7 @@ static bool8 MainState_WaitPageSwap(void)
if (cursorX >= GetCurrentPageColumnCount())
cursorX = GetCurrentPageColumnCount() - 1;
}
SetCursorPos(cursorX, cursorY);
sub_80E4E5C();
SetInputState(INPUT_STATE_ENABLED);
@ -603,7 +603,7 @@ static bool8 PageSwapAnimState_1(struct Task *);
static bool8 PageSwapAnimState_2(struct Task *);
static bool8 PageSwapAnimState_Done(struct Task *);
static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *) =
static bool8 (*const sPageSwapAnimStateFuncs[])(struct Task *) =
{
PageSwapAnimState_Init,
PageSwapAnimState_1,
@ -754,7 +754,7 @@ static void Task_80E39BC(u8 taskId)
task->data[3] += task->data[4];
task->data[6] += task->data[4];
}
if (task->data[3] == 16 && task->data[6] == 22)
{
task->data[4] = -4;
@ -893,7 +893,7 @@ static void CursorInit(void)
static void SetCursorPos(s16 x, s16 y)
{
struct Sprite *cursorSprite = &gSprites[gNamingScreenData->cursorSpriteId];
if (x < gUnknown_0858BEA0[sub_80E3274()])
cursorSprite->pos1.x = gUnknown_0858BEA3[x + sub_80E3274() * 8] + 38;
else
@ -909,7 +909,7 @@ static void SetCursorPos(s16 x, s16 y)
static void GetCursorPos(s16 *x, s16 *y)
{
struct Sprite *cursorSprite = &gSprites[gNamingScreenData->cursorSpriteId];
*x = cursorSprite->data[0];
*y = cursorSprite->data[1];
}
@ -1133,7 +1133,7 @@ static void CreateInputTargetIcon(void)
static void TaskDummy2(void)
{
}
static void NamingScreen_CreatePlayerIcon(void)
@ -1160,7 +1160,7 @@ static void NamingScreen_CreateMonIcon(void)
{
u8 spriteId;
sub_80D2F04();
LoadMonIconPalettes();
spriteId = CreateMonIcon(gNamingScreenData->monSpecies, SpriteCallbackDummy, 0x38, 0x28, 0, gNamingScreenData->monPersonality, 1);
gSprites[spriteId].oam.priority = 3;
}
@ -1331,7 +1331,7 @@ static void InputState_Disabled(struct Task *task)
static void InputState_Enabled(struct Task *task)
{
task->tKeyboardEvent = 0;
if (gMain.newKeys & A_BUTTON)
task->tKeyboardEvent = KBEVENT_PRESSED_A;
else if (gMain.newKeys & B_BUTTON)
@ -1454,7 +1454,7 @@ static void sub_80E4894(void)
static void sub_80E48E8(void)
{
u8 buffer[0x20];
StringCopy(buffer, gSpeciesNames[gNamingScreenData->monSpecies]);
StringAppendN(buffer, gNamingScreenData->template->title, 15);
FillWindowPixelBuffer(gNamingScreenData->windows[3], 0x11);
@ -1492,10 +1492,10 @@ static void sub_80E498C(void)
static void TaskDummy3(void)
{
}
static const u8 sGenderColors[2][3] =
static const u8 sGenderColors[2][3] =
{
{0, 9, 8},
{0, 5, 4}
@ -1505,7 +1505,7 @@ static void sub_80E49BC(void)
{
u8 genderSymbol[2];
bool8 isFemale = FALSE;
StringCopy(genderSymbol, gText_MaleSymbol);
if (gNamingScreenData->monGender != MON_GENDERLESS)
@ -1575,7 +1575,7 @@ static bool8 sub_80E4B54(void)
sub_80E4D10();
CopyBgTilemapBufferToVram(3);
PlaySE(SE_SELECT);
if (GetPreviousTextCaretPosition() != gNamingScreenData->template->maxChars - 1)
return FALSE;
else
@ -1633,7 +1633,7 @@ static void sub_80E4CF8(u8 bg, const void *src)
static void nullsub_10(u8 a1, u8 a2)
{
}
static void sub_80E4D10(void)
@ -1643,18 +1643,18 @@ static void sub_80E4D10(void)
u16 unk2;
u8 maxChars = gNamingScreenData->template->maxChars;
u16 unk = gNamingScreenData->inputCharBaseXPos - 0x40;
FillWindowPixelBuffer(gNamingScreenData->windows[2], 0x11);
for (i = 0; i < maxChars; i++)
{
temp[0] = gNamingScreenData->textBuffer[i];
temp[1] = gExpandedPlaceholder_Empty[0];
unk2 = (sub_80E503C(temp[0]) == 1) ? 2 : 0;
PrintTextOnWindow(gNamingScreenData->windows[2], 1, temp, i * 8 + unk + unk2, 1, 0xFF, NULL);
}
sub_80E498C();
CopyWindowToVram(gNamingScreenData->windows[2], 2);
PutWindowTilemap(gNamingScreenData->windows[2]);
@ -1674,12 +1674,12 @@ static const struct TextColorThing sUnkColorStruct =
}
};
static const u8 sFillValues[3] =
static const u8 sFillValues[3] =
{
0xEE, 0xDD, 0xFF
};
static const u8 *const sUnkColors[3] =
static const u8 *const sUnkColors[3] =
{
sUnkColorStruct.colors[1],
sUnkColorStruct.colors[0],
@ -1689,18 +1689,18 @@ static const u8 *const sUnkColors[3] =
static void sub_80E4DE4(u8 window, u8 a1)
{
u8 i;
FillWindowPixelBuffer(window, sFillValues[a1]);
for (i = 0; i < 4; i++)
{
box_print(window, 1, 0, i * 16 + 1, sUnkColors[a1], 0, gUnknown_0858C198[a1][i]);
}
PutWindowTilemap(window);
}
static const u8 *const gUnknown_0858BF98[] =
static const u8 *const gUnknown_0858BF98[] =
{
gUnknown_08DD4620,
gUnknown_08DD46E0,
@ -1714,7 +1714,7 @@ static void sub_80E4E5C(void)
u8 unk3;
u8 bg1Priority = GetGpuReg(REG_OFFSET_BG1CNT) & 3;
u8 bg2Priority = GetGpuReg(REG_OFFSET_BG2CNT) & 3;
if (bg1Priority > bg2Priority)
{
unk1 = 1;
@ -1727,7 +1727,7 @@ static void sub_80E4E5C(void)
unk2 = 2;
unk3 = gNamingScreenData->windows[1];
}
sub_80E4CF8(unk1, gUnknown_0858BF98[gNamingScreenData->currentPage]);
sub_80E4DE4(unk3, sub_80E3254());
nullsub_10(unk1, sub_80E3254());
@ -1737,7 +1737,7 @@ static void sub_80E4E5C(void)
static void sub_80E4EF0(void)
{
const u8 color[3] = { 15, 1, 2 };
FillWindowPixelBuffer(gNamingScreenData->windows[4], 0xFF);
box_print(gNamingScreenData->windows[4], 0, 2, 1, color, 0, gText_MoveOkBack);
PutWindowTilemap(gNamingScreenData->windows[4]);
@ -1787,7 +1787,7 @@ static void sub_80E501C(void)
static bool8 sub_80E503C(u8 character)
{
u8 i;
for (i = 0; gUnknown_0858BDC8[i] != EOS; i++)
{
if (character == gUnknown_0858BDC8[i])
@ -1987,20 +1987,20 @@ static const struct SpriteFrameImage gUnknown_0858C080[] =
{gSpriteImage_858BCB8, sizeof(gSpriteImage_858BCB8)},
};
static const union AnimCmd gSpriteAnim_858C090[] =
static const union AnimCmd gSpriteAnim_858C090[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_JUMP(0)
};
static const union AnimCmd gSpriteAnim_858C098[] =
static const union AnimCmd gSpriteAnim_858C098[] =
{
ANIMCMD_FRAME(4, 8),
ANIMCMD_FRAME(8, 8),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_858C0A4[] =
static const union AnimCmd gSpriteAnim_858C0A4[] =
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(1, 2),
@ -2023,7 +2023,7 @@ static const union AnimCmd *const gSpriteAnimTable_858C0BC[] =
gSpriteAnim_858C0A4
};
static const struct SpriteTemplate gUnknown_0858C0C0 =
static const struct SpriteTemplate gUnknown_0858C0C0 =
{
.tileTag = 0x0002,
.paletteTag = 0x0004,
@ -2034,7 +2034,7 @@ static const struct SpriteTemplate gUnknown_0858C0C0 =
.callback = sub_80E4084
};
static const struct SpriteTemplate gUnknown_0858C0D8 =
static const struct SpriteTemplate gUnknown_0858C0D8 =
{
.tileTag = 0x0003,
.paletteTag = 0x0001,
@ -2045,7 +2045,7 @@ static const struct SpriteTemplate gUnknown_0858C0D8 =
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate gUnknown_0858C0F0 =
static const struct SpriteTemplate gUnknown_0858C0F0 =
{
.tileTag = 0x0004,
.paletteTag = 0x0004,
@ -2056,7 +2056,7 @@ static const struct SpriteTemplate gUnknown_0858C0F0 =
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate gUnknown_0858C108 =
static const struct SpriteTemplate gUnknown_0858C108 =
{
.tileTag = 0x0000,
.paletteTag = 0x0006,
@ -2067,7 +2067,7 @@ static const struct SpriteTemplate gUnknown_0858C108 =
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate gUnknown_0858C120 =
static const struct SpriteTemplate gUnknown_0858C120 =
{
.tileTag = 0x0001,
.paletteTag = 0x0007,
@ -2078,7 +2078,7 @@ static const struct SpriteTemplate gUnknown_0858C120 =
.callback = SpriteCallbackDummy
};
static const struct SpriteTemplate gUnknown_0858C138 =
static const struct SpriteTemplate gUnknown_0858C138 =
{
.tileTag = 0x0007,
.paletteTag = 0x0005,
@ -2089,7 +2089,7 @@ static const struct SpriteTemplate gUnknown_0858C138 =
.callback = sub_80E3B30
};
static const struct SpriteTemplate sSpriteTemplate_InputArrow =
static const struct SpriteTemplate sSpriteTemplate_InputArrow =
{
.tileTag = 0x000A,
.paletteTag = 0x0003,
@ -2100,7 +2100,7 @@ static const struct SpriteTemplate sSpriteTemplate_InputArrow =
.callback = sub_80E3C20
};
static const struct SpriteTemplate sSpriteTemplate_Underscore =
static const struct SpriteTemplate sSpriteTemplate_Underscore =
{
.tileTag = 0x000B,
.paletteTag = 0x0003,
@ -2111,7 +2111,7 @@ static const struct SpriteTemplate sSpriteTemplate_Underscore =
.callback = sub_80E3C6C
};
static const struct SpriteTemplate gUnknown_0858C180 =
static const struct SpriteTemplate gUnknown_0858C180 =
{
.tileTag = 0xFFFF,
.paletteTag = 0x0000,
@ -2122,7 +2122,7 @@ static const struct SpriteTemplate gUnknown_0858C180 =
.callback = SpriteCallbackDummy
};
static const u8* const gUnknown_0858C198[][4] =
static const u8* const gUnknown_0858C198[][4] =
{
{
gUnknown_0862B88D,

View File

@ -146,23 +146,7 @@ void CB2_InitOptionMenu(void)
gMain.state++;
break;
case 1:
{
u8 *addr;
u32 size;
addr = (u8 *)VRAM;
size = 0x18000;
while (1)
{
DmaFill16(3, 0, addr, 0x1000);
addr += 0x1000;
size -= 0x1000;
if (size <= 0x1000)
{
DmaFill16(3, 0, addr, size);
break;
}
}
DmaClearLarge16(3, (void*)(VRAM), VRAM_SIZE, 0x1000);
DmaClear32(3, OAM, OAM_SIZE);
DmaClear16(3, PLTT, PLTT_SIZE);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
@ -189,7 +173,6 @@ void CB2_InitOptionMenu(void)
ShowBg(0);
ShowBg(1);
gMain.state++;
}
break;
case 2:
ResetPaletteFade();

View File

@ -89,9 +89,6 @@ extern const u16 gUnknown_82EC7C4[];
extern u16 gSaveFileStatus;
extern u16 gUnknown_03005DA8;
extern u8 *gUnknown_03005DA0;
extern u8 *gUnknown_03005D9C;
extern u8 *gUnknown_03005DA4;
extern bool8 (*gUnknown_03005DB0)(void);
extern u8 gUnknown_03005DB4;
extern u8 gFieldLinkPlayerCount;
@ -1422,12 +1419,12 @@ static void overworld_bg_setup(void)
SetBgAttribute(1, BG_CTRL_ATTR_PALETTEMODE, 1);
SetBgAttribute(2, BG_CTRL_ATTR_PALETTEMODE, 1);
SetBgAttribute(3, BG_CTRL_ATTR_PALETTEMODE, 1);
gUnknown_03005DA0 = AllocZeroed(0x800);
gUnknown_03005D9C = AllocZeroed(0x800);
gUnknown_03005DA4 = AllocZeroed(0x800);
SetBgTilemapBuffer(1, gUnknown_03005DA0);
SetBgTilemapBuffer(2, gUnknown_03005D9C);
SetBgTilemapBuffer(3, gUnknown_03005DA4);
gBGTilemapBuffers2 = AllocZeroed(0x800);
gBGTilemapBuffers1 = AllocZeroed(0x800);
gBGTilemapBuffers3 = AllocZeroed(0x800);
SetBgTilemapBuffer(1, gBGTilemapBuffers2);
SetBgTilemapBuffer(2, gBGTilemapBuffers1);
SetBgTilemapBuffer(3, gBGTilemapBuffers3);
sub_81971D0();
}
@ -1435,12 +1432,12 @@ void overworld_free_bg_tilemaps(void)
{
sub_81BE72C();
sub_81971F4();
if (gUnknown_03005DA4 != NULL)
FREE_AND_SET_NULL(gUnknown_03005DA4);
if (gUnknown_03005D9C != NULL)
FREE_AND_SET_NULL(gUnknown_03005D9C);
if (gUnknown_03005DA0 != NULL)
FREE_AND_SET_NULL(gUnknown_03005DA0);
if (gBGTilemapBuffers3 != NULL)
FREE_AND_SET_NULL(gBGTilemapBuffers3);
if (gBGTilemapBuffers1 != NULL)
FREE_AND_SET_NULL(gBGTilemapBuffers1);
if (gBGTilemapBuffers2 != NULL)
FREE_AND_SET_NULL(gBGTilemapBuffers2);
}
static void ResetSafariZoneFlag_(void)

View File

@ -1,9 +1,28 @@
#include "global.h"
#include "sprite.h"
#include "mail.h"
#include "graphics.h"
#include "constants/species.h"
#include "palette.h"
#include "pokemon_icon.h"
#define POKE_ICON_BASE_PAL_TAG 56000
struct MonIconSpriteTemplate
{
const struct OamData *oam;
const u8 *image;
const union AnimCmd *const *anims;
const union AffineAnimCmd *const *affineAnims;
void (*callback)(struct Sprite *);
u16 paletteTag;
};
// static functions
static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8);
// .rodata
const u8 * const gMonIconTable[] =
{
gMonIcon_Bulbasaur,
@ -1012,3 +1031,288 @@ const u16 sSpriteImageSizes[3][4] =
0x400, // 4×8
},
};
u8 CreateMonIcon(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u32 personality, bool32 extra)
{
u8 spriteId;
struct MonIconSpriteTemplate iconTemplate =
{
.oam = &sMonIconOamData,
.image = GetMonIconPtr(species, personality, extra),
.anims = sMonIconAnims,
.affineAnims = sMonIconAffineAnims,
.callback = callback,
.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndices[species],
};
if (species > SPECIES_EGG)
iconTemplate.paletteTag = POKE_ICON_BASE_PAL_TAG;
spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority);
UpdateMonIconFrame(&gSprites[spriteId]);
return spriteId;
}
u8 sub_80D2D78(u16 species, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, bool32 extra)
{
u8 spriteId;
struct MonIconSpriteTemplate iconTemplate =
{
.oam = &sMonIconOamData,
.image = NULL,
.anims = sMonIconAnims,
.affineAnims = sMonIconAffineAnims,
.callback = callback,
.paletteTag = POKE_ICON_BASE_PAL_TAG + gMonIconPaletteIndices[species],
};
iconTemplate.image = GetMonIconTiles(species, extra);
spriteId = CreateMonIconSprite(&iconTemplate, x, y, subpriority);
UpdateMonIconFrame(&gSprites[spriteId]);
return spriteId;
}
u16 mon_icon_convert_unown_species_id(u16 species, u32 personality)
{
u16 result;
if (species == SPECIES_UNOWN)
{
u16 letter = GetUnownLetterByPersonality(personality);
if (letter == 0)
letter = SPECIES_UNOWN;
else
letter += (SPECIES_UNOWN_B - 1);
result = letter;
}
else
{
if (species > SPECIES_EGG)
result = 260;
else
result = species;
}
return result;
}
u16 GetUnownLetterByPersonality(u32 personality)
{
if (!personality)
return 0;
return (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 0x3)) % 0x1C;
}
u16 sub_80D2E84(u16 species)
{
u16 value;
if (MailSpeciesToSpecies(species, &value) == SPECIES_UNOWN)
{
if (value == 0)
value += SPECIES_UNOWN;
else
value += (SPECIES_UNOWN_B - 1);
return value;
}
else
{
if(species > (SPECIES_UNOWN_B - 1))
species = 260;
return mon_icon_convert_unown_species_id(species, 0);
}
}
const u8 *GetMonIconPtr(u16 species, u32 personality, bool32 extra)
{
return GetMonIconTiles(mon_icon_convert_unown_species_id(species, personality), extra);
}
void sub_80D2EF8(struct Sprite *sprite)
{
sub_80D328C(sprite);
}
void LoadMonIconPalettes(void)
{
u8 i;
for (i = 0; i < 6; i++)
LoadSpritePalette(&gMonIconPaletteTable[i]);
}
// unused
void SafeLoadMonIconPalette(u16 species)
{
u8 palIndex;
if (species > SPECIES_EGG)
species = 260;
palIndex = gMonIconPaletteIndices[species];
if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF)
LoadSpritePalette(&gMonIconPaletteTable[palIndex]);
}
void LoadMonIconPalette(u16 species)
{
u8 palIndex = gMonIconPaletteIndices[species];
if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF)
LoadSpritePalette(&gMonIconPaletteTable[palIndex]);
}
void FreeMonIconPalettes(void)
{
u8 i;
for (i = 0; i < 6; i++)
FreeSpritePaletteByTag(gMonIconPaletteTable[i].tag);
}
// unused
void SafeFreeMonIconPalette(u16 species)
{
u8 palIndex;
if (species > SPECIES_EGG)
species = 260;
palIndex = gMonIconPaletteIndices[species];
FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag);
}
void FreeMonIconPalette(u16 species)
{
u8 palIndex;
palIndex = gMonIconPaletteIndices[species];
FreeSpritePaletteByTag(gMonIconPaletteTable[palIndex].tag);
}
void sub_80D3014(struct Sprite *sprite)
{
UpdateMonIconFrame(sprite);
}
const u8* GetMonIconTiles(u16 species, bool32 extra)
{
const u8* iconSprite = gMonIconTable[species];
if(species == SPECIES_DEOXYS && extra == TRUE)
{
iconSprite = (const u8*)(0x400 + (u32)iconSprite); //WTF?
}
return iconSprite;
}
void sub_80D304C(u16 offset)
{
s32 i;
const struct SpritePalette* monIconPalettePtr;
if(offset <= 0xA0)
{
monIconPalettePtr = gMonIconPaletteTable;
for(i = 5; i >= 0 ; i--)
{
LoadPalette(monIconPalettePtr->data, offset, 0x20);
offset += 0x10;
monIconPalettePtr++;
}
}
}
u8 sub_80D3080(u16 species)
{
if (species > SPECIES_EGG)
species = 260;
return gMonIconPaletteIndices[species];
}
u8 sub_80D30A0(u16 species)
{
return gMonIconPaletteIndices[species];
}
const u16* GetValidMonIconPalettePtr(u16 species)
{
if (species > SPECIES_EGG)
species = 260;
return gMonIconPaletteTable[gMonIconPaletteIndices[species]].data;
}
// TODO: try to find a way to avoid using asm statement
u8 UpdateMonIconFrame(struct Sprite *sprite)
{
u8 result = 0;
if (sprite->animDelayCounter == 0)
{
s16 frame = sprite->anims[sprite->animNum][sprite->animCmdIndex].frame.imageValue;
switch (frame)
{
case -1:
break;
case -2:
sprite->animCmdIndex = 0;
break;
default:
RequestSpriteCopy(
// pointer arithmetic is needed to get the correct pointer to perform the sprite copy on.
// because sprite->images is a struct def, it has to be casted to (u8 *) before any
// arithmetic can be performed.
(u8 *)sprite->images + (sSpriteImageSizes[sprite->oam.shape][sprite->oam.size] * frame),
(u8 *)(OBJ_VRAM0 + sprite->oam.tileNum * TILE_SIZE_4BPP),
sSpriteImageSizes[sprite->oam.shape][sprite->oam.size]);
{
register u8 duration asm("r0") = sprite->anims[sprite->animNum][sprite->animCmdIndex].frame.duration;
sprite->animDelayCounter = duration;
}
sprite->animCmdIndex++;
result = sprite->animCmdIndex;
break;
}
}
else
{
sprite->animDelayCounter--;
}
return result;
}
static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *iconTemplate, s16 x, s16 y, u8 subpriority)
{
u8 spriteId;
struct SpriteFrameImage image = { NULL, sSpriteImageSizes[iconTemplate->oam->shape][iconTemplate->oam->size] };
struct SpriteTemplate spriteTemplate =
{
.tileTag = 0xFFFF,
.paletteTag = iconTemplate->paletteTag,
.oam = iconTemplate->oam,
.anims = iconTemplate->anims,
.images = &image,
.affineAnims = iconTemplate->affineAnims,
.callback = iconTemplate->callback,
};
spriteId = CreateSprite(&spriteTemplate, x, y, subpriority);
gSprites[spriteId].animPaused = TRUE;
gSprites[spriteId].animBeginning = FALSE;
gSprites[spriteId].images = (const struct SpriteFrameImage *)iconTemplate->image;
return spriteId;
}
void sub_80D328C(struct Sprite *sprite)
{
struct SpriteFrameImage image = { NULL, sSpriteImageSizes[sprite->oam.shape][sprite->oam.size] };
sprite->images = &image;
DestroySprite(sprite);
}
void sub_80D32C8(struct Sprite *sprite, u8 animNum)
{
sprite->animNum = animNum;
sprite->animDelayCounter = 0;
sprite->animCmdIndex = 0;
}

View File

@ -2776,93 +2776,27 @@ void sub_81C2C38(u8 a)
schedule_bg_copy_tilemap_to_vram(0);
}
#ifdef NONMATCHING
u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
{
u8 *r4 = gUnknown_0203CF1C->unk40CB;
if (r4[a] == 0xFF)
u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]);
if (*windowIdPtr == 0xFF)
{
r4[a] = AddWindow(&template[a]);
FillWindowPixelBuffer(r4[a], 0);
*windowIdPtr = AddWindow(&template[a]);
FillWindowPixelBuffer(*windowIdPtr, 0);
}
return r4[a];
return *windowIdPtr;
}
#else
ASM_DIRECT
u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
{
asm(".syntax unified\n\
push {r4,lr}\n\
adds r3, r0, 0\n\
lsls r1, 24\n\
lsrs r2, r1, 24\n\
ldr r0, =gUnknown_0203CF1C\n\
ldr r4, =0x000040cb\n\
adds r1, r2, r4\n\
ldr r0, [r0]\n\
adds r4, r0, r1\n\
ldrb r0, [r4]\n\
cmp r0, 0xFF\n\
bne _081C2D56\n\
lsls r0, r2, 3\n\
adds r0, r3, r0\n\
bl AddWindow\n\
strb r0, [r4]\n\
ldrb r0, [r4]\n\
movs r1, 0\n\
bl FillWindowPixelBuffer\n\
_081C2D56:\n\
ldrb r0, [r4]\n\
pop {r4}\n\
pop {r1}\n\
bx r1\n\
.pool\n\
.syntax divided\n");
}
#endif
#ifdef NONMATCHING
void sub_81C2D68(u8 a)
{
u8 *r4 = gUnknown_0203CF1C->unk40CB;
if (r4[a] != 0xFF)
u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]);
if (*windowIdPtr != 0xFF)
{
ClearWindowTilemap(r4[a]);
RemoveWindow(r4[a]);
r4[a] = 0xFF;
ClearWindowTilemap(*windowIdPtr);
RemoveWindow(*windowIdPtr);
*windowIdPtr = 0xFF;
}
}
#else
ASM_DIRECT
void sub_81C2D68(u8 a)
{
asm(".syntax unified\n\
push {r4,lr}\n\
lsls r0, 24\n\
lsrs r0, 24\n\
ldr r1, =gUnknown_0203CF1C\n\
ldr r2, =0x000040cb\n\
adds r0, r2\n\
ldr r1, [r1]\n\
adds r4, r1, r0\n\
ldrb r0, [r4]\n\
cmp r0, 0xFF\n\
beq _081C2D8C\n\
bl ClearWindowTilemap\n\
ldrb r0, [r4]\n\
bl RemoveWindow\n\
movs r0, 0xFF\n\
strb r0, [r4]\n\
_081C2D8C:\n\
pop {r4}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided\n");
}
#endif
void sub_81C2D9C(u8 a)
{

209
src/rom6.c Normal file
View File

@ -0,0 +1,209 @@
#include "global.h"
#include "constants/map_objects.h"
#include "constants/songs.h"
#include "rom6.h"
#include "braille_puzzles.h"
#include "event_data.h"
#include "event_scripts.h"
#include "field_effect.h"
#include "field_map_obj.h"
#include "field_player_avatar.h"
#include "item_use.h"
#include "party_menu.h"
#include "overworld.h"
#include "script.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
// static functions
static void task08_080C9820(u8 taskId);
static void sub_8135578(u8 taskId);
static void sub_813552C(u8 taskId);
static void sub_813561C(u8 taskId);
static void sub_81356C4(void);
static void sub_8135714(void);
static void hm2_dig(void);
static void sub_8135780(void);
// extern RAM loc
extern struct MapPosition gUnknown_0203AB40;
// text
bool8 npc_before_player_of_type(u8 a)
{
u8 mapObjId;
GetXYCoordsOneStepInFrontOfPlayer(&gUnknown_0203AB40.x, &gUnknown_0203AB40.y);
gUnknown_0203AB40.height = PlayerGetZCoord();
mapObjId = GetFieldObjectIdByXYZ(gUnknown_0203AB40.x, gUnknown_0203AB40.y, gUnknown_0203AB40.height);
if (gMapObjects[mapObjId].graphicsId != a)
{
return FALSE;
}
else
{
gSpecialVar_LastTalked = gMapObjects[mapObjId].localId;
return TRUE;
}
}
u8 oei_task_add(void)
{
GetXYCoordsOneStepInFrontOfPlayer(&gUnknown_0203AB40.x, &gUnknown_0203AB40.y);
return CreateTask(task08_080C9820, 8);
}
static void task08_080C9820(u8 taskId)
{
u8 mapObjId;
ScriptContext2_Enable();
gPlayerAvatar.preventStep = TRUE;
mapObjId = gPlayerAvatar.mapObjectId;
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(&gMapObjects[mapObjId])
|| FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[mapObjId]))
{
if (gMapHeader.mapType == MAP_TYPE_UNDERWATER)
{
FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT);
gTasks[taskId].func = sub_8135578;
}
else
{
sub_808C114();
FieldObjectSetSpecialAnim(&gMapObjects[mapObjId], 0x39);
gTasks[taskId].func = sub_813552C;
}
}
}
static void sub_813552C(u8 taskId)
{
if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(&gMapObjects[gPlayerAvatar.mapObjectId]) == TRUE)
{
FieldEffectStart(FLDEFF_FIELD_MOVE_SHOW_MON_INIT);
gTasks[taskId].func = sub_8135578;
}
}
static void sub_8135578(u8 taskId)
{
if (!FieldEffectActiveListContains(6))
{
gFieldEffectArguments[1] = player_get_direction_lower_nybble();
if (gFieldEffectArguments[1] == 1)
gFieldEffectArguments[2] = 0;
if (gFieldEffectArguments[1] == 2)
gFieldEffectArguments[2] = 1;
if (gFieldEffectArguments[1] == 3)
gFieldEffectArguments[2] = 2;
if (gFieldEffectArguments[1] == 4)
gFieldEffectArguments[2] = 3;
FieldObjectSetGraphicsId(&gMapObjects[gPlayerAvatar.mapObjectId], GetPlayerAvatarGraphicsIdByCurrentState());
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], gFieldEffectArguments[2]);
FieldEffectActiveListRemove(6);
gTasks[taskId].func = sub_813561C;
}
}
static void sub_813561C(u8 taskId)
{
void (*func)(void) = (void (*)(void))(((u16)gTasks[taskId].data[8] << 16) | (u16)gTasks[taskId].data[9]);
func();
gPlayerAvatar.preventStep = FALSE;
DestroyTask(taskId);
}
bool8 SetUpFieldMove_RockSmash(void)
{
if(ShouldDoBrailleStrengthEffect())
{
gSpecialVar_Result = GetCursorSelectionMonId();
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = sub_8179834;
return TRUE;
}
else if (npc_before_player_of_type(0x56) == TRUE)
{
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = sub_81356C4;
return TRUE;
}
else
{
return FALSE;
}
}
static void sub_81356C4(void)
{
gFieldEffectArguments[0] = GetCursorSelectionMonId();
ScriptContext1_SetupScript(Route111_EventScript_2907F0);
}
bool8 FldEff_UseRockSmash(void)
{
u8 taskId = oei_task_add();
gTasks[taskId].data[8] = (u32)sub_8135714 >> 16;
gTasks[taskId].data[9] = (u32)sub_8135714;
IncrementGameStat(GAME_STAT_USED_ROCK_SMASH);
return FALSE;
}
static void sub_8135714(void)
{
PlaySE(SE_W088);
FieldEffectActiveListRemove(FLDEFF_USE_ROCK_SMASH);
EnableBothScriptContexts();
}
bool8 SetUpFieldMove_Dig(void)
{
if (CanUseEscapeRopeOnCurrMap() == TRUE)
{
gUnknown_03005DB0 = FieldCallback_Teleport;
gUnknown_0203CEEC = hm2_dig;
return TRUE;
}
else
{
return FALSE;
}
}
static void hm2_dig(void)
{
Overworld_ResetStateAfterDigEscRope();
FieldEffectStart(FLDEFF_USE_DIG);
gFieldEffectArguments[0] = GetCursorSelectionMonId();
}
bool8 FldEff_UseDig(void)
{
u8 taskId = oei_task_add();
gTasks[taskId].data[8] = (u32)sub_8135780 >> 16;
gTasks[taskId].data[9] = (u32)sub_8135780;
if (!ShouldDoBrailleDigEffect())
SetPlayerAvatarTransitionFlags(1);
return FALSE;
}
static void sub_8135780(void)
{
u8 taskId;
FieldEffectActiveListRemove(FLDEFF_USE_DIG);
if (ShouldDoBrailleDigEffect())
{
DoBrailleDigEffect();
}
else
{
taskId = CreateTask(task08_080A1C44, 8);
gTasks[taskId].data[0] = 0;
}
}

1188
src/rotating_gate.c Normal file

File diff suppressed because it is too large Load Diff

233
src/script_movement.c Normal file
View File

@ -0,0 +1,233 @@
#include "global.h"
#include "script_movement.h"
#include "field_map_obj.h"
#include "field_map_obj_helpers.h"
#include "task.h"
#include "util.h"
// static functions
static void sub_80D33AC(u8);
static u8 sub_80D33F4(void);
static bool8 sub_80D3408(u8, u8, const u8 *);
static u8 sub_80D3474(u8, u8);
static bool8 sub_80D3584(u8, u8);
static void sub_80D35DC(u8, u8, u8, const u8 *);
static void UnfreezeObjects(u8);
static void sub_80D3660(u8);
static void sub_80A2490(u8, u8, u8, const u8 *);
// EWRAM_DATA
static EWRAM_DATA const u8 *gUnknown_02039D90[16] = {0};
// text
bool8 ScriptMovement_StartObjectMovementScript(u8 localId, u8 mapNum, u8 mapGroup, const u8 *movementScript)
{
u8 mapObjId;
if (TryGetFieldObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &mapObjId))
return TRUE;
if (!FuncIsActiveTask(sub_80D3660))
sub_80D33AC(50);
return sub_80D3408(sub_80D33F4(), mapObjId, movementScript);
}
bool8 ScriptMovement_IsObjectMovementFinished(u8 localId, u8 mapNum, u8 mapBank)
{
u8 mapObjId;
u8 r4;
u8 r1;
if (TryGetFieldObjectIdByLocalIdAndMap(localId, mapNum, mapBank, &mapObjId))
return TRUE;
r4 = sub_80D33F4();
r1 = sub_80D3474(r4, mapObjId);
if (r1 == 16)
return TRUE;
return sub_80D3584(r4, r1);
}
void sub_80D338C(void)
{
u8 taskId;
taskId = sub_80D33F4();
if (taskId != 0xFF)
{
UnfreezeObjects(taskId);
DestroyTask(taskId);
}
}
static void sub_80D33AC(u8 priority)
{
u8 taskId;
u8 i;
taskId = CreateTask(sub_80D3660, priority);
for (i = 1; i < 16; i++)
gTasks[taskId].data[i] = 0xFFFF;
}
static u8 sub_80D33F4(void)
{
return FindTaskIdByFunc(sub_80D3660);
}
static bool8 sub_80D3408(u8 taskId, u8 mapObjId, const u8 *movementScript)
{
u8 r4;
r4 = sub_80D3474(taskId, mapObjId);
if (r4 != 16)
{
if (sub_80D3584(taskId, r4) == 0)
{
return TRUE;
}
else
{
sub_80D35DC(taskId, r4, mapObjId, movementScript);
return FALSE;
}
}
r4 = sub_80D3474(taskId, 0xFF);
if (r4 == 16)
{
return TRUE;
}
else
{
sub_80D35DC(taskId, r4, mapObjId, movementScript);
return FALSE;
}
}
static u8 sub_80D3474(u8 taskId, u8 b)
{
u8 *ptr;
u8 i;
ptr = (u8 *)&gTasks[taskId].data[1];
for (i = 0; i < 16; i++, ptr++)
{
if (*ptr == b)
return i;
}
return 16;
}
static void sub_80D34B0(u8 taskId, u8 b, u8 **c)
{
u8 i;
*c = (u8 *)&gTasks[taskId].data[1];
for (i = 0; i < b; i++, (*c)++)
;
}
static void sub_80D34E4(u8 taskId, u8 b, u8 c)
{
u8 *ptr;
sub_80D34B0(taskId, b, &ptr);
*ptr = c; //what is this supposed to do?
}
static void sub_80D3508(u8 taskId, u8 b, u8 *c)
{
u8 *ptr;
sub_80D34B0(taskId, b, &ptr);
*c = *ptr;
}
static void sub_80D352C(u8 a, u8 b)
{
u16 var = ~gBitTable[b];
gTasks[a].data[0] &= var;
}
static void sub_80D355C(u8 taskId, u8 b)
{
gTasks[taskId].data[0] |= gBitTable[b];
}
static bool8 sub_80D3584(u8 taskId, u8 b)
{
u16 var = (u16)gTasks[taskId].data[0] & gBitTable[b];
if (var != 0)
return TRUE;
else
return FALSE;
}
static void npc_obj_offscreen_culling_and_flag_update(u8 a, const u8 *movementScript)
{
gUnknown_02039D90[a] = movementScript;
}
static const u8 *sub_80D35CC(u8 a)
{
return gUnknown_02039D90[a];
}
static void sub_80D35DC(u8 taskId, u8 b, u8 mapObjId, const u8 *movementScript)
{
sub_80D352C(taskId, b);
npc_obj_offscreen_culling_and_flag_update(b, movementScript);
sub_80D34E4(taskId, b, mapObjId);
}
static void UnfreezeObjects(u8 taskId)
{
u8 *pMapObjId;
u8 i;
pMapObjId = (u8 *)&gTasks[taskId].data[1];
for (i = 0; i < 16; i++, pMapObjId++)
{
if (*pMapObjId != 0xFF)
npc_sync_anim_pause_bits(&gMapObjects[*pMapObjId]);
}
}
static void sub_80D3660(u8 taskId)
{
u8 i;
u8 var;
for (i = 0; i < 16; i++)
{
sub_80D3508(taskId, i, &var);
if (var != 0xFF)
sub_80A2490(taskId, i, var, sub_80D35CC(i));
}
}
static void sub_80A2490(u8 taskId, u8 b, u8 mapObjId, const u8 *d)
{
u8 var;
if (FieldObjectIsSpecialAnimActive(&gMapObjects[mapObjId])
&& !FieldObjectClearAnimIfSpecialAnimFinished(&gMapObjects[mapObjId]))
return;
var = *d;
if (var == 0xFE)
{
sub_80D355C(taskId, b);
FreezeMapObject(&gMapObjects[mapObjId]);
}
else
{
if (!FieldObjectSetSpecialAnim(&gMapObjects[mapObjId], var))
{
d++;
npc_obj_offscreen_culling_and_flag_update(b, d);
}
}
}

View File

@ -7,26 +7,26 @@
#include "graphics.h"
// const rom data
const u32 gTextWindowFrame1_Gfx[] = INCBIN_U32("graphics/text_window/1.4bpp");
static const u32 sTextWindowFrame2_Gfx[] = INCBIN_U32("graphics/text_window/2.4bpp");
static const u32 sTextWindowFrame3_Gfx[] = INCBIN_U32("graphics/text_window/3.4bpp");
static const u32 sTextWindowFrame4_Gfx[] = INCBIN_U32("graphics/text_window/4.4bpp");
static const u32 sTextWindowFrame5_Gfx[] = INCBIN_U32("graphics/text_window/5.4bpp");
static const u32 sTextWindowFrame6_Gfx[] = INCBIN_U32("graphics/text_window/6.4bpp");
static const u32 sTextWindowFrame7_Gfx[] = INCBIN_U32("graphics/text_window/7.4bpp");
static const u32 sTextWindowFrame8_Gfx[] = INCBIN_U32("graphics/text_window/8.4bpp");
static const u32 sTextWindowFrame9_Gfx[] = INCBIN_U32("graphics/text_window/9.4bpp");
static const u32 sTextWindowFrame10_Gfx[] = INCBIN_U32("graphics/text_window/10.4bpp");
static const u32 sTextWindowFrame11_Gfx[] = INCBIN_U32("graphics/text_window/11.4bpp");
static const u32 sTextWindowFrame12_Gfx[] = INCBIN_U32("graphics/text_window/12.4bpp");
static const u32 sTextWindowFrame13_Gfx[] = INCBIN_U32("graphics/text_window/13.4bpp");
static const u32 sTextWindowFrame14_Gfx[] = INCBIN_U32("graphics/text_window/14.4bpp");
static const u32 sTextWindowFrame15_Gfx[] = INCBIN_U32("graphics/text_window/15.4bpp");
static const u32 sTextWindowFrame16_Gfx[] = INCBIN_U32("graphics/text_window/16.4bpp");
static const u32 sTextWindowFrame17_Gfx[] = INCBIN_U32("graphics/text_window/17.4bpp");
static const u32 sTextWindowFrame18_Gfx[] = INCBIN_U32("graphics/text_window/18.4bpp");
static const u32 sTextWindowFrame19_Gfx[] = INCBIN_U32("graphics/text_window/19.4bpp");
static const u32 sTextWindowFrame20_Gfx[] = INCBIN_U32("graphics/text_window/20.4bpp");
const u8 gTextWindowFrame1_Gfx[] = INCBIN_U8("graphics/text_window/1.4bpp");
static const u8 sTextWindowFrame2_Gfx[] = INCBIN_U8("graphics/text_window/2.4bpp");
static const u8 sTextWindowFrame3_Gfx[] = INCBIN_U8("graphics/text_window/3.4bpp");
static const u8 sTextWindowFrame4_Gfx[] = INCBIN_U8("graphics/text_window/4.4bpp");
static const u8 sTextWindowFrame5_Gfx[] = INCBIN_U8("graphics/text_window/5.4bpp");
static const u8 sTextWindowFrame6_Gfx[] = INCBIN_U8("graphics/text_window/6.4bpp");
static const u8 sTextWindowFrame7_Gfx[] = INCBIN_U8("graphics/text_window/7.4bpp");
static const u8 sTextWindowFrame8_Gfx[] = INCBIN_U8("graphics/text_window/8.4bpp");
static const u8 sTextWindowFrame9_Gfx[] = INCBIN_U8("graphics/text_window/9.4bpp");
static const u8 sTextWindowFrame10_Gfx[] = INCBIN_U8("graphics/text_window/10.4bpp");
static const u8 sTextWindowFrame11_Gfx[] = INCBIN_U8("graphics/text_window/11.4bpp");
static const u8 sTextWindowFrame12_Gfx[] = INCBIN_U8("graphics/text_window/12.4bpp");
static const u8 sTextWindowFrame13_Gfx[] = INCBIN_U8("graphics/text_window/13.4bpp");
static const u8 sTextWindowFrame14_Gfx[] = INCBIN_U8("graphics/text_window/14.4bpp");
static const u8 sTextWindowFrame15_Gfx[] = INCBIN_U8("graphics/text_window/15.4bpp");
static const u8 sTextWindowFrame16_Gfx[] = INCBIN_U8("graphics/text_window/16.4bpp");
static const u8 sTextWindowFrame17_Gfx[] = INCBIN_U8("graphics/text_window/17.4bpp");
static const u8 sTextWindowFrame18_Gfx[] = INCBIN_U8("graphics/text_window/18.4bpp");
static const u8 sTextWindowFrame19_Gfx[] = INCBIN_U8("graphics/text_window/19.4bpp");
static const u8 sTextWindowFrame20_Gfx[] = INCBIN_U8("graphics/text_window/20.4bpp");
const u16 gTextWindowFrame1_Pal[] = INCBIN_U16("graphics/text_window/1.gbapal");
static const u16 sTextWindowFrame2_Pal[] = INCBIN_U16("graphics/text_window/2.gbapal");

View File

@ -30,13 +30,13 @@ gPokemonStoragePtr: @ 3005D94
gInGameOpponentsNo: @ 3005D98
.space 0x4
gUnknown_03005D9C: @ 3005D9C
gBGTilemapBuffers1: @ 3005D9C
.space 0x4
gUnknown_03005DA0: @ 3005DA0
gBGTilemapBuffers2: @ 3005DA0
.space 0x4
gUnknown_03005DA4: @ 3005DA4
gBGTilemapBuffers3: @ 3005DA4
.space 0x4
gUnknown_03005DA8: @ 3005DA8

View File

@ -222,7 +222,7 @@ gCamera: @ 2037334
gUnknown_02037340: @ 2037340
.space 0x8
gUnknown_02037348: @ 2037348
gUnusedBikeCameraAheadPanback: @ 2037348
.space 0x4
gUnknown_0203734C: @ 203734C
@ -408,14 +408,13 @@ gUnknown_02039D88: @ 2039D88
gUnknown_02039D8C: @ 2039D8C
.space 0x4
gUnknown_02039D90: @ 2039D90
.space 0x40
.include "src/script_movement.o"
gUnknown_02039DD0: @ 2039DD0
.space 0x4
gUnknown_02039DD4: @ 2039DD4
.space 0x4
.include "src/map_name_popup.o"
.space 0x3
gBagPockets: @ 2039DD8
.space 0x28
@ -523,15 +522,7 @@ gUnknown_0203A018: @ 203A018
gUnknown_0203A034: @ 203A034
.space 0x4
gUnknown_0203A038: @ 203A038
.space 0xC
gUnknown_0203A044: @ 203A044
.space 0x4
gUnknown_0203A048: @ 203A048
.space 0x4
.include "src/rotating_gate.o"
.include "src/safari_zone.o"
gUnknown_0203A0F4: @ 203A0F4
@ -557,9 +548,7 @@ gUnknown_0203A11C: @ 203A11C
gUnknown_0203A120: @ 203A120
.space 0x4
gUnknown_0203A124: @ 203A124
.space 0x4
.include "src/mon_markings.o"
gUnknown_0203A128: @ 203A128
.space 0x4