2022-01-21 00:39:29 +00:00
|
|
|
#include "constants/sndseq.h"
|
|
|
|
#include "constants/species.h"
|
|
|
|
#include "constants/maps.h"
|
|
|
|
#include "constants/pokemon.h"
|
|
|
|
#include "constants/flags.h"
|
|
|
|
#include "constants/vars.h"
|
|
|
|
#include "constants/items.h"
|
|
|
|
#include "constants/std_script.h"
|
|
|
|
#include "fielddata/script/scr_seq/event_D24R0204.h"
|
2022-03-25 20:21:14 +00:00
|
|
|
#include "constants/party_menu.h"
|
2022-01-21 00:39:29 +00:00
|
|
|
.include "asm/macros.inc"
|
2023-01-27 22:42:00 +00:00
|
|
|
.include "unk_0206793C.inc"
|
2022-01-21 00:39:29 +00:00
|
|
|
.include "global.inc"
|
|
|
|
|
|
|
|
.text
|
|
|
|
|
|
|
|
thumb_func_start sub_0206793C
|
|
|
|
sub_0206793C: ; 0x0206793C
|
|
|
|
push {r4, lr}
|
|
|
|
add r4, r0, #0
|
2023-06-21 18:41:52 +00:00
|
|
|
bl TaskManager_GetFieldSystem
|
2022-01-21 00:39:29 +00:00
|
|
|
add r0, r4, #0
|
2023-09-12 02:48:29 +00:00
|
|
|
bl TaskManager_GetEnvironment
|
2022-01-21 00:39:29 +00:00
|
|
|
add r2, r0, #0
|
|
|
|
ldr r1, _02067958 ; =_020FE79C
|
|
|
|
add r0, r4, #0
|
|
|
|
add r2, #0xc
|
2022-03-12 19:30:52 +00:00
|
|
|
bl CallApplicationAsTask
|
2022-01-21 00:39:29 +00:00
|
|
|
pop {r4, pc}
|
|
|
|
.balign 4, 0
|
|
|
|
_02067958: .word _020FE79C
|
|
|
|
thumb_func_end sub_0206793C
|
|
|
|
|
2023-06-25 12:21:56 +00:00
|
|
|
thumb_func_start Task_NPCTrade
|
|
|
|
Task_NPCTrade: ; 0x0206795C
|
2022-01-21 00:39:29 +00:00
|
|
|
push {r4, r5, r6, lr}
|
|
|
|
sub sp, #8
|
|
|
|
add r5, r0, #0
|
2023-06-21 18:41:52 +00:00
|
|
|
bl TaskManager_GetFieldSystem
|
2022-01-21 00:39:29 +00:00
|
|
|
add r6, r0, #0
|
|
|
|
add r0, r5, #0
|
2023-09-12 02:48:29 +00:00
|
|
|
bl TaskManager_GetEnvironment
|
2022-01-21 00:39:29 +00:00
|
|
|
add r4, r0, #0
|
|
|
|
ldr r0, [r4, #4]
|
|
|
|
cmp r0, #6
|
|
|
|
bhi _02067A16
|
|
|
|
add r0, r0, r0
|
|
|
|
add r0, pc
|
|
|
|
ldrh r0, [r0, #6]
|
|
|
|
lsl r0, r0, #0x10
|
|
|
|
asr r0, r0, #0x10
|
|
|
|
add pc, r0
|
|
|
|
_02067982: ; jump table
|
|
|
|
.short _02067990 - _02067982 - 2 ; case 0
|
|
|
|
.short _020679B8 - _02067982 - 2 ; case 1
|
|
|
|
.short _020679C6 - _02067982 - 2 ; case 2
|
|
|
|
.short _020679D4 - _02067982 - 2 ; case 3
|
|
|
|
.short _020679E2 - _02067982 - 2 ; case 4
|
|
|
|
.short _020679F0 - _02067982 - 2 ; case 5
|
|
|
|
.short _020679FE - _02067982 - 2 ; case 6
|
|
|
|
_02067990:
|
|
|
|
ldr r0, [r4, #0x24]
|
|
|
|
add r3, r4, #0
|
|
|
|
str r0, [sp]
|
|
|
|
ldr r0, [r4, #0x28]
|
|
|
|
add r3, #0xc
|
|
|
|
str r0, [sp, #4]
|
|
|
|
ldr r1, [r4]
|
|
|
|
ldr r2, [r4, #8]
|
|
|
|
add r0, r6, #0
|
2022-02-08 20:39:23 +00:00
|
|
|
bl NPCTrade_CreateTradeAnim
|
2022-01-21 00:39:29 +00:00
|
|
|
ldr r1, [r4]
|
|
|
|
ldr r2, [r4, #8]
|
|
|
|
add r0, r6, #0
|
2022-02-08 20:39:23 +00:00
|
|
|
bl NPCTrade_ReceiveMonToSlot
|
2022-01-21 00:39:29 +00:00
|
|
|
ldr r0, [r4, #4]
|
|
|
|
add r0, r0, #1
|
|
|
|
str r0, [r4, #4]
|
|
|
|
b _02067A16
|
|
|
|
_020679B8:
|
|
|
|
add r0, r5, #0
|
2024-05-20 00:34:22 +00:00
|
|
|
bl PaletteFadeUntilFinished
|
2022-01-21 00:39:29 +00:00
|
|
|
ldr r0, [r4, #4]
|
|
|
|
add r0, r0, #1
|
|
|
|
str r0, [r4, #4]
|
|
|
|
b _02067A16
|
|
|
|
_020679C6:
|
|
|
|
add r0, r5, #0
|
2024-05-20 20:24:51 +00:00
|
|
|
bl CallTask_LeaveOverworld
|
2022-01-21 00:39:29 +00:00
|
|
|
ldr r0, [r4, #4]
|
|
|
|
add r0, r0, #1
|
|
|
|
str r0, [r4, #4]
|
|
|
|
b _02067A16
|
|
|
|
_020679D4:
|
|
|
|
add r0, r5, #0
|
|
|
|
bl sub_0206793C
|
|
|
|
ldr r0, [r4, #4]
|
|
|
|
add r0, r0, #1
|
|
|
|
str r0, [r4, #4]
|
|
|
|
b _02067A16
|
|
|
|
_020679E2:
|
|
|
|
add r0, r5, #0
|
2023-09-12 02:48:29 +00:00
|
|
|
bl CallTask_RestoreOverworld
|
2022-01-21 00:39:29 +00:00
|
|
|
ldr r0, [r4, #4]
|
|
|
|
add r0, r0, #1
|
|
|
|
str r0, [r4, #4]
|
|
|
|
b _02067A16
|
|
|
|
_020679F0:
|
|
|
|
add r0, r5, #0
|
2023-09-12 02:48:29 +00:00
|
|
|
bl CallTask_FadeFromBlack
|
2022-01-21 00:39:29 +00:00
|
|
|
ldr r0, [r4, #4]
|
|
|
|
add r0, r0, #1
|
|
|
|
str r0, [r4, #4]
|
|
|
|
b _02067A16
|
|
|
|
_020679FE:
|
|
|
|
ldr r0, [r4, #0x24]
|
|
|
|
bl FreeToHeap
|
|
|
|
ldr r0, [r4, #0x28]
|
|
|
|
bl FreeToHeap
|
|
|
|
add r0, r4, #0
|
|
|
|
bl FreeToHeap
|
|
|
|
add sp, #8
|
|
|
|
mov r0, #1
|
|
|
|
pop {r4, r5, r6, pc}
|
|
|
|
_02067A16:
|
|
|
|
mov r0, #0
|
|
|
|
add sp, #8
|
|
|
|
pop {r4, r5, r6, pc}
|
2023-06-25 12:21:56 +00:00
|
|
|
thumb_func_end Task_NPCTrade
|
2022-01-21 00:39:29 +00:00
|
|
|
|
2023-06-25 12:21:56 +00:00
|
|
|
thumb_func_start CallTask_NPCTrade
|
|
|
|
CallTask_NPCTrade: ; 0x02067A1C
|
2022-01-21 00:39:29 +00:00
|
|
|
push {r3, r4, r5, r6, r7, lr}
|
|
|
|
add r7, r0, #0
|
|
|
|
add r5, r1, #0
|
|
|
|
add r0, r3, #0
|
|
|
|
mov r1, #0x2c
|
|
|
|
add r6, r2, #0
|
|
|
|
str r3, [sp]
|
|
|
|
bl AllocFromHeap
|
|
|
|
mov r1, #0
|
|
|
|
mov r2, #0x2c
|
|
|
|
add r4, r0, #0
|
|
|
|
bl memset
|
|
|
|
mov r0, #0
|
|
|
|
str r0, [r4, #4]
|
|
|
|
str r5, [r4]
|
|
|
|
ldr r0, [sp]
|
|
|
|
str r6, [r4, #8]
|
|
|
|
bl AllocMonZeroed
|
|
|
|
str r0, [r4, #0x24]
|
|
|
|
ldr r0, [sp]
|
|
|
|
bl AllocMonZeroed
|
|
|
|
str r0, [r4, #0x28]
|
2023-06-25 12:21:56 +00:00
|
|
|
ldr r1, _02067A5C ; =Task_NPCTrade
|
2022-01-21 00:39:29 +00:00
|
|
|
add r0, r7, #0
|
|
|
|
add r2, r4, #0
|
2022-03-12 16:55:51 +00:00
|
|
|
bl TaskManager_Call
|
2022-01-21 00:39:29 +00:00
|
|
|
pop {r3, r4, r5, r6, r7, pc}
|
|
|
|
.balign 4, 0
|
2023-06-25 12:21:56 +00:00
|
|
|
_02067A5C: .word Task_NPCTrade
|
|
|
|
thumb_func_end CallTask_NPCTrade
|
2022-01-21 00:39:29 +00:00
|
|
|
|
|
|
|
.rodata
|
|
|
|
|
|
|
|
.balign 4, 0
|
|
|
|
_020FE79C:
|
2024-02-28 06:59:46 +00:00
|
|
|
.word TradeSequence_Init, TradeSequence_Main, TradeSequence_Exit, FS_OVERLAY_ID(OVY_71)
|