From 1f5378c6d16285451fda0cc6a7348ebe2c70a9b3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 24 Oct 2017 21:41:22 -0400 Subject: [PATCH] sub_80E9108 --- asm/secret_base.s | 75 ---------------------------------------- include/map_name_popup.h | 11 ++++++ src/secret_base.c | 33 ++++++++++++++++-- 3 files changed, 42 insertions(+), 77 deletions(-) create mode 100644 include/map_name_popup.h diff --git a/asm/secret_base.s b/asm/secret_base.s index 1a0a51b994..0b3af4ef56 100644 --- a/asm/secret_base.s +++ b/asm/secret_base.s @@ -5,81 +5,6 @@ .text - thumb_func_start sub_80E90C8 -sub_80E90C8: @ 80E90C8 - 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 - movs r1, 0x2 - bl FieldObjectTurn - bl sub_80ABDFC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080E90F8 - bl EnableBothScriptContexts - adds r0, r4, 0 - bl DestroyTask -_080E90F8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E90C8 - - thumb_func_start sub_80E9108 -sub_80E9108: @ 80E9108 - push {r4,lr} - sub sp, 0x4 - bl ScriptContext2_Enable - bl HideMapNamePopUpWindow - mov r4, sp - adds r4, 0x2 - movs r2, 0x88 - lsls r2, 2 - mov r0, sp - adds r1, r4, 0 - bl sub_80E8CB0 - mov r1, sp - mov r0, sp - ldrh r0, [r0] - adds r0, 0x7 - strh r0, [r1] - ldrh r0, [r4] - adds r0, 0x7 - strh r0, [r4] - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - movs r2, 0xE2 - lsls r2, 4 - bl MapGridSetMetatileIdAt - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl CurrentMapDrawMetatileAt - bl pal_fill_black - ldr r0, =sub_80E90C8 - movs r1, 0 - bl CreateTask - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E9108 - thumb_func_start sub_80E916C sub_80E916C: @ 80E916C push {r4-r6,lr} diff --git a/include/map_name_popup.h b/include/map_name_popup.h new file mode 100644 index 0000000000..8a9043a3f9 --- /dev/null +++ b/include/map_name_popup.h @@ -0,0 +1,11 @@ +#ifndef GUARD_MAP_NAME_POPUP_H +#define GUARD_MAP_NAME_POPUP_H + +// Exported type declarations + +// Exported RAM declarations + +// Exported ROM declarations +void HideMapNamePopUpWindow(void); + +#endif //GUARD_MAP_NAME_POPUP_H diff --git a/src/secret_base.c b/src/secret_base.c index 190962c51f..0cdf6b010d 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -5,17 +5,20 @@ #include "palette.h" #include "list_menu.h" #include "map_constants.h" -#include "decoration.h" -#include "decoration_inventory.h" #include "overworld.h" #include "fieldmap.h" #include "field_camera.h" #include "field_player_avatar.h" #include "field_screen.h" #include "field_weather.h" +#include "field_map_obj.h" +#include "map_name_popup.h" #include "text.h" #include "string_util.h" +#include "script.h" #include "event_data.h" +#include "decoration.h" +#include "decoration_inventory.h" #include "secret_base.h" // Static type declarations @@ -303,3 +306,29 @@ bool8 sub_80E909C(void) } return TRUE; } + +void sub_80E90C8(u8 taskId) +{ + FieldObjectTurn(&gMapObjects[gPlayerAvatar.mapObjectId], DIR_NORTH); + if (sub_80ABDFC() == TRUE) + { + EnableBothScriptContexts(); + DestroyTask(taskId); + } +} + +void sub_80E9108(void) +{ + s16 x; + s16 y; + + ScriptContext2_Enable(); + HideMapNamePopUpWindow(); + sub_80E8CB0(&x, &y, 0x220); + x += 7; + y += 7; + MapGridSetMetatileIdAt(x, y, 0x220 | 0xC00); + CurrentMapDrawMetatileAt(x, y); + pal_fill_black(); + CreateTask(sub_80E90C8, 0); +}