diff --git a/asm/secret_base.s b/asm/secret_base.s index c51eeb6d1..80cf3e37a 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -5,145 +5,6 @@ .text - thumb_func_start sub_80EA120 -sub_80EA120: @ 80EA120 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gText_RegisteredDataDeleted - ldr r2, =sub_80EA08C - bl DisplayItemMessageOnField - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EA120 - - thumb_func_start sub_80EA13C -sub_80EA13C: @ 80EA13C - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - adds r6, r4, r0 - movs r0, 0 - movs r1, 0 - bl sub_8197434 - ldrb r0, [r6, 0xA] - adds r1, r6, 0x4 - adds r6, 0x2 - adds r2, r6, 0 - bl sub_81AE6C8 - adds r0, r5, 0 - bl sub_80E9E00 - movs r0, 0x8 - negs r0, r0 - add r8, r0 - add r4, r8 - ldr r0, =sub_80E9E90 - str r0, [r4] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EA13C - - thumb_func_start sub_80EA18C -sub_80EA18C: @ 80EA18C - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r6, =gTasks + 0x8 - adds r5, r4, r6 - bl sub_80E9E44 - ldrb r0, [r5, 0xE] - movs r1, 0 - bl sub_819746C - ldrb r0, [r5, 0xE] - bl ClearWindowTilemap - ldrb r0, [r5, 0xE] - bl RemoveWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - subs r6, 0x8 - adds r4, r6 - ldr r0, =sub_80E9E90 - str r0, [r4] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80EA18C - - thumb_func_start task_pc_turn_off -task_pc_turn_off: @ 80EA1D0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =0x00004054 - bl VarGet - lsls r0, 16 - cmp r0, 0 - bne _080EA1F4 - ldr r0, =gUnknown_0823B4E8 - bl ScriptContext1_SetupScript - b _080EA1FA - .pool -_080EA1F4: - ldr r0, =gUnknown_0823B5E9 - bl ScriptContext1_SetupScript -_080EA1FA: - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_pc_turn_off - - thumb_func_start sub_80EA20C -sub_80EA20C: @ 80EA20C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSaveBlock1Ptr - ldr r4, [r1] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 5 - adds r4, r1 - ldr r1, =0x00001aa5 - adds r0, r4, r1 - ldrb r0, [r0] - movs r1, 0x5 - bl __umodsi3 - ldr r1, =0x00001a9d - adds r4, r1 - ldrb r2, [r4] - lsls r2, 27 - lsrs r2, 31 - lsls r1, r2, 2 - adds r1, r2 - adds r0, r1 - lsls r0, 24 - lsrs r0, 24 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80EA20C - thumb_func_start sub_80EA250 sub_80EA250: @ 80EA250 push {lr} diff --git a/include/event_scripts.h b/include/event_scripts.h index bc942bec3..259e463c8 100755 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -6,6 +6,7 @@ #define GUARD_EVENT_SCRIPTS_H extern const u8 gUnknown_0823B4E8[]; +extern const u8 gUnknown_0823B5E9[]; extern const u8 gUnknown_08275BB7[]; extern const u8 gUnknown_08275D0C[]; extern const u8 gUnknown_08275D1F[]; diff --git a/include/strings.h b/include/strings.h index abbbb1edc..190ee7b45 100644 --- a/include/strings.h +++ b/include/strings.h @@ -73,5 +73,6 @@ extern const u8 gText_Toss2[]; extern const u8 gText_ApostropheSBase[]; extern const u8 gText_NoRegistry[]; extern const u8 gText_OkayToDeleteFromRegistry[]; +extern const u8 gText_RegisteredDataDeleted[]; #endif //GUARD_STRINGS_H diff --git a/src/secret_base.c b/src/secret_base.c index 78647f8a0..a18dbbb0b 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -55,8 +55,8 @@ void sub_80E9E90(u8 taskId); void sub_80E9F20(u8 taskId); void sub_80E9FB0(u8 taskId); void sub_80EA06C(u8 taskId); +void sub_80EA18C(u8 taskId); void task_pc_turn_off(u8 taskId); -u8 sub_80EA18C(u8 sbId); u8 sub_80EA20C(u8 sbId); // .rodata @@ -1164,3 +1164,50 @@ void sub_80EA08C(u8 taskId) sub_80E9E00(taskId); gTasks[taskId].func = sub_80E9E90; } + +void sub_80EA120(u8 taskId) +{ + DisplayItemMessageOnField(taskId, gText_RegisteredDataDeleted, sub_80EA08C); +} + +void sub_80EA13C(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + sub_8197434(0, 0); + sub_81AE6C8(data[5], &data[2], &data[1]); + sub_80E9E00(taskId); + gTasks[taskId].func = sub_80E9E90; +} + +void sub_80EA18C(u8 taskId) +{ + s16 *data; + + data = gTasks[taskId].data; + sub_80E9E44(taskId); + sub_819746C(data[7], 0); + ClearWindowTilemap(data[7]); + RemoveWindow(data[7]); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = sub_80E9E90; +} + +void task_pc_turn_off(u8 taskId) +{ + if (VarGet(VAR_0x4054) == 0) + { + ScriptContext1_SetupScript(gUnknown_0823B4E8); + } + else + { + ScriptContext1_SetupScript(gUnknown_0823B5E9); + } + DestroyTask(taskId); +} + +u8 sub_80EA20C(u8 sbId) +{ + return (gSaveBlock1Ptr->secretBases[sbId].trainerId[0] % 5) + (gSaveBlock1Ptr->secretBases[sbId].gender * 5); +}