mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
start working on walda phrase
This commit is contained in:
parent
ae5aa3c4df
commit
cda5c5f925
@ -1043,7 +1043,7 @@ _080C77C2:
|
||||
lsrs r5, r0, 16
|
||||
cmp r5, 0xD
|
||||
bls _080C77C2
|
||||
bl sub_80D242C
|
||||
bl ResetWaldaWallpaper
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
@ -7122,7 +7122,7 @@ sub_80CADD8: @ 80CADD8
|
||||
bl sub_80CFF34
|
||||
movs r0, 0x15
|
||||
bl sub_80CFF34
|
||||
bl sub_80D2494
|
||||
bl IsWaldaWallpaperUnlocked
|
||||
cmp r0, 0
|
||||
beq _080CAE04
|
||||
movs r0, 0x16
|
||||
@ -10421,7 +10421,7 @@ _080CC888:
|
||||
b _080CC9DA
|
||||
.pool
|
||||
_080CC8C4:
|
||||
bl sub_80D24A8
|
||||
bl GetWaldaWallpaperPatternId
|
||||
lsls r1, r0, 1
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
@ -10448,13 +10448,13 @@ _080CC8C4:
|
||||
adds r1, r4
|
||||
movs r2, 0x20
|
||||
bl CpuSet
|
||||
bl sub_80D2510
|
||||
bl GetWaldaWallpaperColorsPtr
|
||||
ldr r1, [r7]
|
||||
ldr r2, =0x00000794
|
||||
adds r1, r2
|
||||
movs r2, 0x2
|
||||
bl CpuSet
|
||||
bl sub_80D2510
|
||||
bl GetWaldaWallpaperColorsPtr
|
||||
ldr r1, [r7]
|
||||
ldr r3, =0x000007b4
|
||||
adds r1, r3
|
||||
@ -10500,7 +10500,7 @@ _080CC976:
|
||||
adds r1, r5
|
||||
str r0, [r1]
|
||||
ldr r4, =gUnknown_0857B004
|
||||
bl sub_80D24DC
|
||||
bl GetWaldaWallpaperIconId
|
||||
lsls r0, 2
|
||||
adds r0, r4
|
||||
ldr r0, [r0]
|
||||
@ -21544,8 +21544,8 @@ _080D241E:
|
||||
bx r1
|
||||
thumb_func_end sub_80D23A8
|
||||
|
||||
thumb_func_start sub_80D242C
|
||||
sub_80D242C: @ 80D242C
|
||||
thumb_func_start ResetWaldaWallpaper
|
||||
ResetWaldaWallpaper: @ 80D242C
|
||||
ldr r2, =gSaveBlock1Ptr
|
||||
ldr r0, [r2]
|
||||
ldr r1, =0x00003d84
|
||||
@ -21575,10 +21575,10 @@ sub_80D242C: @ 80D242C
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D242C
|
||||
thumb_func_end ResetWaldaWallpaper
|
||||
|
||||
thumb_func_start sub_80D2480
|
||||
sub_80D2480: @ 80D2480
|
||||
thumb_func_start SetWaldaWallpaperLockedOrUnlocked
|
||||
SetWaldaWallpaperLockedOrUnlocked: @ 80D2480
|
||||
ldr r1, =gSaveBlock1Ptr
|
||||
ldr r1, [r1]
|
||||
ldr r2, =0x00003d86
|
||||
@ -21586,10 +21586,10 @@ sub_80D2480: @ 80D2480
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D2480
|
||||
thumb_func_end SetWaldaWallpaperLockedOrUnlocked
|
||||
|
||||
thumb_func_start sub_80D2494
|
||||
sub_80D2494: @ 80D2494
|
||||
thumb_func_start IsWaldaWallpaperUnlocked
|
||||
IsWaldaWallpaperUnlocked: @ 80D2494
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003d86
|
||||
@ -21597,10 +21597,10 @@ sub_80D2494: @ 80D2494
|
||||
ldrb r0, [r0]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D2494
|
||||
thumb_func_end IsWaldaWallpaperUnlocked
|
||||
|
||||
thumb_func_start sub_80D24A8
|
||||
sub_80D24A8: @ 80D24A8
|
||||
thumb_func_start GetWaldaWallpaperPatternId
|
||||
GetWaldaWallpaperPatternId: @ 80D24A8
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003d85
|
||||
@ -21608,10 +21608,10 @@ sub_80D24A8: @ 80D24A8
|
||||
ldrb r0, [r0]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D24A8
|
||||
thumb_func_end GetWaldaWallpaperPatternId
|
||||
|
||||
thumb_func_start sub_80D24BC
|
||||
sub_80D24BC: @ 80D24BC
|
||||
thumb_func_start SetWaldaWallpaperPatternId
|
||||
SetWaldaWallpaperPatternId: @ 80D24BC
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
@ -21626,10 +21626,10 @@ _080D24D0:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D24BC
|
||||
thumb_func_end SetWaldaWallpaperPatternId
|
||||
|
||||
thumb_func_start sub_80D24DC
|
||||
sub_80D24DC: @ 80D24DC
|
||||
thumb_func_start GetWaldaWallpaperIconId
|
||||
GetWaldaWallpaperIconId: @ 80D24DC
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003d84
|
||||
@ -21637,10 +21637,10 @@ sub_80D24DC: @ 80D24DC
|
||||
ldrb r0, [r0]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D24DC
|
||||
thumb_func_end GetWaldaWallpaperIconId
|
||||
|
||||
thumb_func_start sub_80D24F0
|
||||
sub_80D24F0: @ 80D24F0
|
||||
thumb_func_start SetWaldaWallpaperIconId
|
||||
SetWaldaWallpaperIconId: @ 80D24F0
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
@ -21655,20 +21655,20 @@ _080D2504:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D24F0
|
||||
thumb_func_end SetWaldaWallpaperIconId
|
||||
|
||||
thumb_func_start sub_80D2510
|
||||
sub_80D2510: @ 80D2510
|
||||
thumb_func_start GetWaldaWallpaperColorsPtr
|
||||
GetWaldaWallpaperColorsPtr: @ 80D2510
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003d70
|
||||
adds r0, r1
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D2510
|
||||
thumb_func_end GetWaldaWallpaperColorsPtr
|
||||
|
||||
thumb_func_start sub_80D2524
|
||||
sub_80D2524: @ 80D2524
|
||||
thumb_func_start SetWaldaWallpaperColors
|
||||
SetWaldaWallpaperColors: @ 80D2524
|
||||
push {r4,lr}
|
||||
ldr r2, =gSaveBlock1Ptr
|
||||
ldr r2, [r2]
|
||||
@ -21682,20 +21682,20 @@ sub_80D2524: @ 80D2524
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D2524
|
||||
thumb_func_end SetWaldaWallpaperColors
|
||||
|
||||
thumb_func_start sub_80D2548
|
||||
sub_80D2548: @ 80D2548
|
||||
thumb_func_start GetWaldaPhrasePtr
|
||||
GetWaldaPhrasePtr: @ 80D2548
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00003d74
|
||||
adds r0, r1
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_80D2548
|
||||
thumb_func_end GetWaldaPhrasePtr
|
||||
|
||||
thumb_func_start sub_80D255C
|
||||
sub_80D255C: @ 80D255C
|
||||
thumb_func_start SetWaldaPhrase
|
||||
SetWaldaPhrase: @ 80D255C
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
@ -21706,10 +21706,10 @@ sub_80D255C: @ 80D255C
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80D255C
|
||||
thumb_func_end SetWaldaPhrase
|
||||
|
||||
thumb_func_start sub_80D2578
|
||||
sub_80D2578: @ 80D2578
|
||||
thumb_func_start IsWaldaPhraseEmpty
|
||||
IsWaldaPhraseEmpty: @ 80D2578
|
||||
push {lr}
|
||||
movs r1, 0
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
@ -21725,7 +21725,7 @@ _080D258C:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_80D2578
|
||||
thumb_func_end IsWaldaPhraseEmpty
|
||||
|
||||
thumb_func_start sub_80D259C
|
||||
sub_80D259C: @ 80D259C
|
||||
|
@ -5971,11 +5971,11 @@ _081D99B4:
|
||||
thumb_func_start sub_81D99BC
|
||||
sub_81D99BC: @ 81D99BC
|
||||
push {r4,lr}
|
||||
bl sub_80D2578
|
||||
bl IsWaldaPhraseEmpty
|
||||
cmp r0, 0
|
||||
bne _081D99DC
|
||||
ldr r4, =gStringVar1
|
||||
bl sub_80D2548
|
||||
bl GetWaldaPhrasePtr
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
bl StringCopy
|
||||
|
@ -5,382 +5,7 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start walda_maybe
|
||||
walda_maybe: @ 81D99E4
|
||||
push {r4,lr}
|
||||
sub sp, 0x8
|
||||
ldr r4, =gStringVar2
|
||||
bl sub_80D2548
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
bl StringCopy
|
||||
movs r0, 0
|
||||
str r0, [sp]
|
||||
ldr r0, =sub_81D9A1C
|
||||
str r0, [sp, 0x4]
|
||||
movs r0, 0x4
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
movs r3, 0
|
||||
bl DoNamingScreen
|
||||
add sp, 0x8
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end walda_maybe
|
||||
|
||||
thumb_func_start sub_81D9A1C
|
||||
sub_81D9A1C: @ 81D9A1C
|
||||
push {r4,r5,lr}
|
||||
ldr r4, =gSpecialVar_0x8004
|
||||
ldr r5, =gStringVar2
|
||||
adds r0, r5, 0
|
||||
bl sub_81D9A98
|
||||
strh r0, [r4]
|
||||
ldrh r0, [r4]
|
||||
cmp r0, 0x1
|
||||
beq _081D9A68
|
||||
cmp r0, 0x1
|
||||
bgt _081D9A44
|
||||
cmp r0, 0
|
||||
beq _081D9A62
|
||||
b _081D9A68
|
||||
.pool
|
||||
_081D9A44:
|
||||
cmp r0, 0x2
|
||||
bne _081D9A68
|
||||
bl sub_80D2578
|
||||
cmp r0, 0
|
||||
beq _081D9A5C
|
||||
ldr r0, =gText_Peekaboo
|
||||
bl sub_80D255C
|
||||
b _081D9A68
|
||||
.pool
|
||||
_081D9A5C:
|
||||
movs r0, 0x1
|
||||
strh r0, [r4]
|
||||
b _081D9A68
|
||||
_081D9A62:
|
||||
adds r0, r5, 0
|
||||
bl sub_80D255C
|
||||
_081D9A68:
|
||||
ldr r4, =gStringVar1
|
||||
bl sub_80D2548
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
bl StringCopy
|
||||
ldr r1, =gFieldCallback
|
||||
ldr r0, =sub_80AF168
|
||||
str r0, [r1]
|
||||
ldr r0, =c2_exit_to_overworld_2_switch
|
||||
bl SetMainCallback2
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81D9A1C
|
||||
|
||||
thumb_func_start sub_81D9A98
|
||||
sub_81D9A98: @ 81D9A98
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0xFF
|
||||
bne _081D9AA6
|
||||
movs r0, 0x2
|
||||
b _081D9ABC
|
||||
_081D9AA6:
|
||||
bl sub_80D2548
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
bl StringCompare
|
||||
cmp r0, 0
|
||||
beq _081D9ABA
|
||||
movs r0, 0
|
||||
b _081D9ABC
|
||||
_081D9ABA:
|
||||
movs r0, 0x1
|
||||
_081D9ABC:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81D9A98
|
||||
|
||||
thumb_func_start sub_81D9AC4
|
||||
sub_81D9AC4: @ 81D9AC4
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x10
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
adds r0, 0xA
|
||||
bl ReadUnalignedWord
|
||||
adds r4, r0, 0
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
ldr r0, =gScriptResult
|
||||
mov r8, r0
|
||||
bl sub_80D2548
|
||||
mov r7, sp
|
||||
adds r7, 0xA
|
||||
add r6, sp, 0xC
|
||||
mov r5, sp
|
||||
adds r5, 0xD
|
||||
str r4, [sp]
|
||||
str r0, [sp, 0x4]
|
||||
add r0, sp, 0x8
|
||||
adds r1, r7, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r5, 0
|
||||
bl sub_81D9B68
|
||||
mov r1, r8
|
||||
strh r0, [r1]
|
||||
lsls r0, 16
|
||||
cmp r0, 0
|
||||
beq _081D9B1E
|
||||
ldrb r0, [r5]
|
||||
bl sub_80D24BC
|
||||
ldrb r0, [r6]
|
||||
bl sub_80D24F0
|
||||
add r0, sp, 0x8
|
||||
ldrh r0, [r0]
|
||||
ldrh r1, [r7]
|
||||
bl sub_80D2524
|
||||
_081D9B1E:
|
||||
mov r1, r8
|
||||
ldrh r0, [r1]
|
||||
bl sub_80D2480
|
||||
mov r1, r8
|
||||
ldrb r0, [r1]
|
||||
add sp, 0x10
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81D9AC4
|
||||
|
||||
thumb_func_start sub_81D9B40
|
||||
sub_81D9B40: @ 81D9B40
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
movs r1, 0
|
||||
ldr r3, =gUnknown_0862AD14
|
||||
_081D9B4A:
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, r2
|
||||
bne _081D9B5C
|
||||
lsls r0, r1, 24
|
||||
lsrs r0, 24
|
||||
b _081D9B64
|
||||
.pool
|
||||
_081D9B5C:
|
||||
adds r1, 0x1
|
||||
cmp r1, 0x1F
|
||||
bls _081D9B4A
|
||||
movs r0, 0x20
|
||||
_081D9B64:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81D9B40
|
||||
|
||||
thumb_func_start sub_81D9B68
|
||||
sub_81D9B68: @ 81D9B68
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x2C
|
||||
mov r10, r0
|
||||
str r1, [sp, 0x20]
|
||||
str r2, [sp, 0x24]
|
||||
str r3, [sp, 0x28]
|
||||
ldr r0, [sp, 0x4C]
|
||||
ldr r5, [sp, 0x50]
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
mov r9, r0
|
||||
adds r0, r5, 0
|
||||
bl StringLength
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
cmp r0, 0xF
|
||||
bne _081D9C7E
|
||||
movs r4, 0
|
||||
add r7, sp, 0x10
|
||||
_081D9B98:
|
||||
adds r0, r5, r4
|
||||
ldrb r0, [r0]
|
||||
bl sub_81D9B40
|
||||
adds r1, r7, r4
|
||||
strb r0, [r1]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x20
|
||||
beq _081D9C7E
|
||||
adds r4, 0x1
|
||||
cmp r4, 0xE
|
||||
ble _081D9B98
|
||||
movs r6, 0x3
|
||||
movs r5, 0
|
||||
movs r0, 0x5
|
||||
mov r8, r0
|
||||
movs r4, 0xD
|
||||
_081D9BBC:
|
||||
mov r1, r8
|
||||
str r1, [sp]
|
||||
add r0, sp, 0x4
|
||||
adds r1, r7, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl sub_81D9D5C
|
||||
adds r6, 0x8
|
||||
adds r5, 0x5
|
||||
subs r4, 0x1
|
||||
cmp r4, 0
|
||||
bge _081D9BBC
|
||||
movs r0, 0x2
|
||||
str r0, [sp]
|
||||
add r0, sp, 0x4
|
||||
adds r1, r7, 0
|
||||
movs r2, 0x46
|
||||
movs r3, 0x73
|
||||
bl sub_81D9D5C
|
||||
add r0, sp, 0x4
|
||||
movs r1, 0
|
||||
movs r2, 0x3
|
||||
bl sub_81D9DAC
|
||||
adds r4, r0, 0
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x75
|
||||
movs r2, 0x3
|
||||
bl sub_81D9DAC
|
||||
cmp r4, r0
|
||||
bne _081D9C7E
|
||||
add r0, sp, 0x4
|
||||
movs r1, 0x9
|
||||
movs r2, 0x15
|
||||
bl sub_81D9C90
|
||||
add r0, sp, 0x4
|
||||
ldrb r0, [r0, 0x8]
|
||||
movs r2, 0xF
|
||||
ands r2, r0
|
||||
add r0, sp, 0x4
|
||||
movs r1, 0x8
|
||||
bl sub_81D9C90
|
||||
add r0, sp, 0x4
|
||||
ldrb r2, [r0, 0x8]
|
||||
lsrs r2, 4
|
||||
movs r1, 0x8
|
||||
bl sub_81D9CDC
|
||||
add r0, sp, 0x4
|
||||
ldrb r2, [r0, 0x6]
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r0]
|
||||
ldrb r1, [r1, 0x2]
|
||||
eors r0, r1
|
||||
add r1, sp, 0x4
|
||||
ldrb r4, [r1, 0x4]
|
||||
eors r0, r4
|
||||
mov r3, r9
|
||||
lsrs r1, r3, 8
|
||||
eors r0, r1
|
||||
cmp r2, r0
|
||||
bne _081D9C7E
|
||||
add r0, sp, 0x4
|
||||
ldrb r3, [r0, 0x7]
|
||||
adds r2, r0, 0
|
||||
ldrb r1, [r0, 0x1]
|
||||
ldrb r0, [r2, 0x3]
|
||||
eors r1, r0
|
||||
adds r0, r2, 0
|
||||
ldrb r2, [r0, 0x5]
|
||||
eors r1, r2
|
||||
movs r0, 0xFF
|
||||
mov r5, r9
|
||||
ands r0, r5
|
||||
eors r1, r0
|
||||
cmp r3, r1
|
||||
bne _081D9C7E
|
||||
add r0, sp, 0x4
|
||||
ldrh r0, [r0]
|
||||
mov r1, r10
|
||||
strh r0, [r1]
|
||||
mov r0, sp
|
||||
adds r0, 0x6
|
||||
ldrh r0, [r0]
|
||||
ldr r3, [sp, 0x20]
|
||||
strh r0, [r3]
|
||||
ldr r5, [sp, 0x24]
|
||||
strb r4, [r5]
|
||||
ldr r0, [sp, 0x28]
|
||||
strb r2, [r0]
|
||||
movs r0, 0x1
|
||||
b _081D9C80
|
||||
_081D9C7E:
|
||||
movs r0, 0
|
||||
_081D9C80:
|
||||
add sp, 0x2C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81D9B68
|
||||
|
||||
thumb_func_start sub_81D9C90
|
||||
sub_81D9C90: @ 81D9C90
|
||||
push {r4-r7,lr}
|
||||
adds r7, r0, 0
|
||||
mov r12, r1
|
||||
subs r3, r2, 0x1
|
||||
cmp r2, 0
|
||||
beq _081D9CD6
|
||||
_081D9C9C:
|
||||
ldrb r1, [r7]
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 31
|
||||
mov r2, r12
|
||||
subs r2, 0x1
|
||||
subs r5, r3, 0x1
|
||||
cmp r2, 0
|
||||
blt _081D9CCC
|
||||
movs r6, 0x80
|
||||
adds r3, r2, r7
|
||||
_081D9CB4:
|
||||
ldrb r1, [r3]
|
||||
adds r0, r6, 0
|
||||
ands r0, r1
|
||||
lsls r0, 24
|
||||
lsls r1, 1
|
||||
orrs r4, r1
|
||||
strb r4, [r3]
|
||||
lsrs r4, r0, 31
|
||||
subs r3, 0x1
|
||||
subs r2, 0x1
|
||||
cmp r2, 0
|
||||
bge _081D9CB4
|
||||
_081D9CCC:
|
||||
adds r3, r5, 0
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
cmp r3, r0
|
||||
bne _081D9C9C
|
||||
_081D9CD6:
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81D9C90
|
||||
|
||||
thumb_func_start sub_81D9CDC
|
||||
sub_81D9CDC: @ 81D9CDC
|
||||
|
@ -520,8 +520,8 @@ gSpecials:: @ 81DBA64
|
||||
def_special sub_81D4BEC
|
||||
def_special sub_80224D0
|
||||
def_special sub_81D99BC
|
||||
def_special walda_maybe
|
||||
def_special sub_81D9AC4
|
||||
def_special DoWaldaNamingScreen
|
||||
def_special TryGetWallpaperWithWaldaPhrase
|
||||
def_special sub_8139ED0
|
||||
def_special sub_813B968
|
||||
def_special sub_80F8B94
|
||||
|
@ -1,7 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
gUnknown_0862AD14:: @ 862AD14
|
||||
.incbin "baserom.gba", 0x62ad14, 0x20
|
@ -500,6 +500,16 @@ typedef union // TODO
|
||||
u8 id;
|
||||
} LilycoveLady;
|
||||
|
||||
struct WaldaPhrase
|
||||
{
|
||||
u16 field_0;
|
||||
u16 field_2;
|
||||
u8 text[16];
|
||||
u8 iconId;
|
||||
u8 patternId;
|
||||
bool8 patternUnlocked;
|
||||
};
|
||||
|
||||
struct SaveBlock1
|
||||
{
|
||||
/*0x00*/ struct Coords16 pos;
|
||||
@ -586,7 +596,7 @@ struct SaveBlock1
|
||||
/*0x3B24*/ u8 seen2[52];
|
||||
/*0x3B58*/ LilycoveLady lilycoveLady;
|
||||
/*0x3B88*/ u8 filler_3B88[0x1E8];
|
||||
/*0x3D70*/ u8 babyPhrase[24]; // TODO: convert to a struct
|
||||
/*0x3D70*/ struct WaldaPhrase waldaPhrase;
|
||||
// sizeof: 0x3D88
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define NAMING_SCREEN_BOX 1
|
||||
#define NAMING_SCREEN_CAUGHT_MON 2
|
||||
#define NAMING_SCREEN_3 3
|
||||
#define NAMING_SCREEN_WANDA 4
|
||||
#define NAMING_SCREEN_WALDA 4
|
||||
|
||||
void DoNamingScreen(u8 caseId, u8* dst, u16 monSpecies, u8 monGender, u32 monPersonality, void (*callback)(void));
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define GUARD_NEW_GAME_H
|
||||
|
||||
void WriteUnalignedWord(u32 var, u8 *dataPtr);
|
||||
u32 ReadUnalignedWord(u8* dataPtr);
|
||||
void CopyUnalignedWord(u8 *copyTo, u8 *copyFrom);
|
||||
void InitPlayerTrainerId(void);
|
||||
void SetDefaultOptions(void);
|
||||
|
@ -257,6 +257,7 @@ SECTIONS {
|
||||
asm/pokemon_summary_screen.o(.text);
|
||||
asm/pokenav.o(.text);
|
||||
asm/rayquaza_scene.o(.text);
|
||||
src/walda_phrase.o(.text);
|
||||
asm/walda_phrase.o(.text);
|
||||
asm/contest_link_81D9DE4.o(.text);
|
||||
asm/trainer_rematch.o(.text);
|
||||
@ -466,7 +467,7 @@ SECTIONS {
|
||||
data/pokemon_summary_screen.o(.rodata);
|
||||
data/pokenav.o(.rodata);
|
||||
data/rayquaza_scene.o(.rodata);
|
||||
data/walda_phrase.o(.rodata);
|
||||
src/walda_phrase.o(.rodata);
|
||||
data/trainer_rematch.o(.rodata);
|
||||
data/unk_sprite_file.o(.rodata);
|
||||
data/unk_transition.o(.rodata);
|
||||
|
185
src/walda_phrase.c
Normal file
185
src/walda_phrase.c
Normal file
@ -0,0 +1,185 @@
|
||||
#include "global.h"
|
||||
#include "string_util.h"
|
||||
#include "event_data.h"
|
||||
#include "naming_screen.h"
|
||||
#include "main.h"
|
||||
#include "text.h"
|
||||
#include "new_game.h"
|
||||
|
||||
extern void (*gFieldCallback)(void);
|
||||
|
||||
extern const u8 gText_Peekaboo[];
|
||||
|
||||
extern u8 *GetWaldaPhrasePtr(void);
|
||||
extern bool32 IsWaldaPhraseEmpty(void);
|
||||
extern void sub_80AF168(void);
|
||||
extern void c2_exit_to_overworld_2_switch(void);
|
||||
extern void SetWaldaPhrase(const u8 *src);
|
||||
extern void SetWaldaWallpaperPatternId(u8 patternId);
|
||||
extern void SetWaldaWallpaperIconId(u8 iconId);
|
||||
extern void SetWaldaWallpaperColors(u16 backgroundColor, u16 foregroundColor);
|
||||
extern void SetWaldaWallpaperLockedOrUnlocked(bool32 unlocked);
|
||||
|
||||
// this file's functions
|
||||
void CB2_HandleGivenWaldaPhrase(void);
|
||||
u32 GetWaldaPhraseInputCase(u8 *inputPtr);
|
||||
bool32 TryCalculateWallpaper(u16* backgroundClr, u16 *foregroundClr, u8 *iconId, u8 *patternId, u16 trainerId, u8 *phrase);
|
||||
void sub_81D9D5C(u8 *array, u8 *letterTableIds, s32 arg2, s32 arg3, s32 arg4);
|
||||
s32 sub_81D9DAC(u8 *array, s32 arg1, s32 arg2);
|
||||
void sub_81D9C90(u8 *array, s32 arg1, s32 arg2);
|
||||
void sub_81D9CDC(u8 *array, s32 arg1, u8 arg2);
|
||||
|
||||
// only consonants are allowed, no vowels, some lowercase letters are missing
|
||||
static const u8 sWaldaLettersTable[] =
|
||||
{
|
||||
CHAR_B, CHAR_C, CHAR_D, CHAR_F, CHAR_G, CHAR_H, CHAR_J, CHAR_K, CHAR_L, CHAR_M, CHAR_N, CHAR_P, CHAR_Q, CHAR_R, CHAR_S, CHAR_T, CHAR_V, CHAR_W, CHAR_Z,
|
||||
CHAR_b, CHAR_c, CHAR_d, CHAR_f, CHAR_g, CHAR_h, CHAR_j, CHAR_k, CHAR_m, CHAR_n, CHAR_p, CHAR_q, CHAR_s
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PHRASE_GIVEN_NEW,
|
||||
PHRASE_NO_CHANGE,
|
||||
PHRASE_FIRST_ATTEMPT
|
||||
};
|
||||
|
||||
void DoWaldaNamingScreen(void)
|
||||
{
|
||||
StringCopy(gStringVar2, GetWaldaPhrasePtr());
|
||||
DoNamingScreen(NAMING_SCREEN_WALDA, gStringVar2, 0, 0, 0, CB2_HandleGivenWaldaPhrase);
|
||||
}
|
||||
|
||||
void CB2_HandleGivenWaldaPhrase(void)
|
||||
{
|
||||
gSpecialVar_0x8004 = GetWaldaPhraseInputCase(gStringVar2);
|
||||
|
||||
switch (gSpecialVar_0x8004)
|
||||
{
|
||||
case PHRASE_FIRST_ATTEMPT:
|
||||
if (IsWaldaPhraseEmpty())
|
||||
SetWaldaPhrase(gText_Peekaboo);
|
||||
else
|
||||
gSpecialVar_0x8004 = PHRASE_NO_CHANGE;
|
||||
break;
|
||||
case PHRASE_GIVEN_NEW:
|
||||
SetWaldaPhrase(gStringVar2);
|
||||
break;
|
||||
case PHRASE_NO_CHANGE:
|
||||
break;
|
||||
}
|
||||
|
||||
StringCopy(gStringVar1, GetWaldaPhrasePtr());
|
||||
gFieldCallback = sub_80AF168;
|
||||
SetMainCallback2(c2_exit_to_overworld_2_switch);
|
||||
}
|
||||
|
||||
u32 GetWaldaPhraseInputCase(u8 *inputPtr)
|
||||
{
|
||||
if (inputPtr[0] == EOS)
|
||||
return PHRASE_FIRST_ATTEMPT;
|
||||
if (StringCompare(inputPtr, GetWaldaPhrasePtr()) == 0)
|
||||
return PHRASE_NO_CHANGE;
|
||||
|
||||
return PHRASE_GIVEN_NEW;
|
||||
}
|
||||
|
||||
u16 TryGetWallpaperWithWaldaPhrase(void)
|
||||
{
|
||||
u16 backgroundClr, foregroundClr;
|
||||
u8 patternId, iconId;
|
||||
u16 trainerId = ReadUnalignedWord(gSaveBlock2Ptr->playerTrainerId);
|
||||
gScriptResult = TryCalculateWallpaper(&backgroundClr, &foregroundClr, &iconId, &patternId, trainerId, GetWaldaPhrasePtr());
|
||||
|
||||
if (gScriptResult)
|
||||
{
|
||||
SetWaldaWallpaperPatternId(patternId);
|
||||
SetWaldaWallpaperIconId(iconId);
|
||||
SetWaldaWallpaperColors(backgroundClr, foregroundClr);
|
||||
}
|
||||
|
||||
SetWaldaWallpaperLockedOrUnlocked(gScriptResult);
|
||||
return (bool8)(gScriptResult);
|
||||
}
|
||||
|
||||
u8 GetLetterTableId(u8 letter)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sWaldaLettersTable); i++)
|
||||
{
|
||||
if (sWaldaLettersTable[i] == letter)
|
||||
return i;
|
||||
}
|
||||
|
||||
return ARRAY_COUNT(sWaldaLettersTable);
|
||||
}
|
||||
|
||||
bool32 TryCalculateWallpaper(u16* backgroundClr, u16 *foregroundClr, u8 *iconId, u8 *patternId, u16 trainerId, u8 *phrase)
|
||||
{
|
||||
s32 i;
|
||||
ALIGNED(2) u8 array[12];
|
||||
u8 charsByTableId[16];
|
||||
u16 *ptr;
|
||||
|
||||
if (StringLength(phrase) != 15)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
charsByTableId[i] = GetLetterTableId(phrase[i]);
|
||||
if (charsByTableId[i] == ARRAY_COUNT(sWaldaLettersTable))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 14; i++)
|
||||
{
|
||||
sub_81D9D5C(array, charsByTableId, (5 * i), 3 + (8 * i), 5);
|
||||
}
|
||||
|
||||
sub_81D9D5C(array, charsByTableId, 70, 115, 2);
|
||||
|
||||
if (sub_81D9DAC(array, 0, 3) != sub_81D9DAC(charsByTableId, 117, 3))
|
||||
return FALSE;
|
||||
|
||||
sub_81D9C90(array, 9, 21);
|
||||
sub_81D9C90(array, 8, array[8] & 0xF);
|
||||
sub_81D9CDC(array, 8, array[8] >> 4);
|
||||
|
||||
if (array[6] != (array[0] ^ array[2] ^ array[4] ^ (trainerId >> 8)))
|
||||
return FALSE;
|
||||
|
||||
if (array[7] != (array[1] ^ array[3] ^ array[5] ^ (trainerId & 0xFF)))
|
||||
return FALSE;
|
||||
|
||||
ptr = (u16*)(&array[0]);
|
||||
*backgroundClr = *ptr;
|
||||
|
||||
ptr = (u16*)(&array[2]);
|
||||
*foregroundClr = *ptr;
|
||||
|
||||
*iconId = array[4];
|
||||
*patternId = array[5];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81D9C90(u8 *array, s32 arg1, s32 arg2)
|
||||
{
|
||||
s32 i, j;
|
||||
u8 var1, var2;
|
||||
|
||||
for (i = arg2 - 1; i != -1; i--)
|
||||
{
|
||||
var1 = (array[0] & 0x80) >> 7;
|
||||
|
||||
var1++;var1--; // needed to match
|
||||
|
||||
for (j = arg1 - 1; j >= 0; j--)
|
||||
{
|
||||
var2 = array[j] & 0x80;
|
||||
array[j] <<= 1;
|
||||
array[j] |= var1;
|
||||
var1 = var2 >> 7;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user