diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 63fd80389..08866a85d 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,233 +5,6 @@ .text - thumb_func_start c2_mystery_gift -c2_mystery_gift: @ 8018650 - push {lr} - movs r0, 0 - bl sub_8018450 - cmp r0, 0 - beq _0801866C - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl task_add_00_mystery_gift -_0801866C: - bl RunTasks - pop {r0} - bx r0 - .pool - thumb_func_end c2_mystery_gift - - thumb_func_start sub_801867C -sub_801867C: @ 801867C - push {lr} - movs r0, 0x1 - bl sub_8018450 - cmp r0, 0 - beq _08018698 - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0x1 - strb r0, [r1] - bl sub_81D5014 -_08018698: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801867C - - thumb_func_start sub_80186A4 -sub_80186A4: @ 80186A4 - push {lr} - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl FreeAllWindowBuffers - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x2 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - ldr r0, =CB2_InitTitleScreen - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186A4 - - thumb_func_start sub_80186EC -sub_80186EC: @ 80186EC - push {r4-r7,lr} - sub sp, 0x14 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0 - bne _0801871C - ldr r0, =gText_MysteryGift - ldr r7, =gText_PickOKCancel - cmp r5, 0 - bne _08018720 - ldr r7, =gText_PickOKExit - b _08018720 - .pool -_0801871C: - ldr r0, =gJPText_MysteryGift - ldr r7, =gJPText_DecideStop -_08018720: - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - ldr r6, =gUnknown_082F0720 - str r6, [sp, 0x8] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0 - adds r1, r7, 0 - movs r2, 0xDE - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - str r5, [sp, 0xC] - str r7, [sp, 0x10] - movs r0, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl PutWindowTilemap - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186EC - - thumb_func_start sub_8018784 -sub_8018784: @ 8018784 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - pop {r0} - bx r0 - thumb_func_end sub_8018784 - - thumb_func_start sub_8018798 -sub_8018798: @ 8018798 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - mov r9, r0 - lsls r4, 24 - lsrs r0, r4, 24 - movs r1, 0x20 - str r1, [sp] - movs r1, 0x2 - str r1, [sp, 0x4] - movs r1, 0x11 - str r1, [sp, 0x8] - movs r1, 0x3 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - mov r8, r4 - movs r4, 0x1 -_080187C8: - movs r7, 0 - mov r0, r9 - adds r0, 0x2 - movs r1, 0x1 - add r1, r9 - mov r10, r1 - lsls r5, r0, 24 - movs r6, 0 -_080187D8: - mov r1, r9 - ands r1, r4 - adds r0, r7, 0 - ands r0, r4 - cmp r1, r0 - beq _080187FC - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x1 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect - b _08018812 -_080187FC: - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x2 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect -_08018812: - movs r0, 0x80 - lsls r0, 17 - adds r6, r0 - adds r7, 0x1 - cmp r7, 0x1F - ble _080187D8 - mov r9, r10 - mov r1, r9 - cmp r1, 0x11 - ble _080187C8 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8018798 - thumb_func_start sub_8018838 sub_8018838: @ 8018838 push {lr} diff --git a/data/mystery_gift.s b/data/mystery_gift.s index cfca73479..5f86ab4d2 100755 --- a/data/mystery_gift.s +++ b/data/mystery_gift.s @@ -3,99 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F0608:: @ 82F0608 - .4byte gText_WonderCards, 0x00000000 - .4byte gText_WonderNews, 0x00000001 - .4byte gText_Exit3, 0xfffffffe - - .align 2 -gUnknown_082F0620:: @ 82F0620 - .4byte gText_WirelessCommunication, 0x00000000 - .4byte gText_Friend2, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0638:: @ 82F0638 struct ListMenuTemplate - .4byte NULL - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0650:: @ 82F0650 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0670:: @ 82F0670 - .4byte gText_Receive, 0x00000000 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0688:: @ 82F0688 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06A0:: @ 82F06A0 - .4byte gText_Receive, 0x00000000 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06B0:: @ 82F06B0 struct ListMenuTemplate - .4byte gUnknown_082F0650 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06C8:: @ 82F06C8 - .4byte gUnknown_082F0670 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06E0:: @ 82F06E0 - .4byte gUnknown_082F0688 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06F8:: @ 82F06F8 - .4byte gUnknown_082F06A0 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 - .4byte gText_VarietyOfEventsImportedWireless - .4byte gText_WonderCardsInPossession - .4byte gText_ReadNewsThatArrived - .4byte gText_ReturnToTitle - - .align 2 -gUnknown_082F0720:: @ 82F0720 - .byte 0x00, 0x01, 0x02 - - .align 2 - .byte 0x00, 0x01, 0x02 - - .align 2 -gUnknown_082F0728:: @ 82F0728 - .byte 0x01, 0x02, 0x03 - .align 2 gUnknown_082F072C:: @ 82F072C .byte 0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42 diff --git a/include/mevent2.h b/include/mevent2.h new file mode 100644 index 000000000..80b1fd51b --- /dev/null +++ b/include/mevent2.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MEVENT2_H +#define GUARD_MEVENT2_H + +void sub_801B990(u32, u32); + +#endif //GUARD_MEVENT2_H diff --git a/include/mystery_gift.h b/include/mystery_gift.h index b83239bc7..b43fbe9a9 100644 --- a/include/mystery_gift.h +++ b/include/mystery_gift.h @@ -1,4 +1,8 @@ #ifndef GUARD_MYSTERY_GIFT_H #define GUARD_MYSTERY_GIFT_H +void sub_8018438(void); +void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel); +void sub_8018798(u32 bg); + #endif //GUARD_MYSTERY_GIFT_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index fa54fca66..ee7397320 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -1,175 +1,4 @@ #ifndef GUARD_rom_8011DC0_H #define GUARD_rom_8011DC0_H -#include "librfu.h" - -// Exported type declarations - -struct UnkStruct_Shared -{ - struct UnkLinkRfuStruct_02022B14 field_0; - u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; -}; - -struct UnkStruct_x1C -{ - struct UnkStruct_Shared unk0; - u8 unk18:1; -}; - -struct UnkStruct_x20 -{ - struct UnkStruct_Shared unk; - u16 field_18; - u8 field_1A_0:2; - u8 field_1A_1:1; - u8 field_1B; - u8 field_1D; - u8 field_1E; - u8 field_1F; -}; - -struct UnkStruct_Main0 -{ - struct UnkStruct_x20 arr[8]; -}; - -struct UnkStruct_Main4 -{ - struct UnkStruct_x1C arr[5]; -}; - -struct UnkStruct_Main8 -{ - struct UnkStruct_x20 arr[5]; -}; - -struct UnkStruct_Leader -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main8 *field_8; - u8 state; - u8 textState; - u8 field_E; - u8 listWindowId; - u8 field_10; - u8 field_11; - u8 listTaskId; - u8 field_13; - u8 field_14; - u8 field_15; - u8 field_16; - u8 field_17; - u8 field_18; - u8 field_19; - u16 field_1A; -}; - -struct UnkStruct_Group -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - u8 state; - u8 textState; - u8 field_A; - u8 listWindowId; - u8 field_C; - u8 field_D; - u8 listTaskId; - u8 field_F; - u8 field_10; - u8 field_11; - u8 field_12; - u8 field_13; - u8 field_14; - u8 field_15; -}; - -struct UnkStruct_8019BA8 -{ - u8 field_0; - u8 field_1; - u8 field_2; - u8 field_3; -}; - -struct UnkStruct_URoom -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main0 *field_8; - struct UnkStruct_Main4 *field_C; - u16 field_10; - u16 field_12; - u8 state; - u8 stateAfterPrint; - u8 textState; - u8 field_17; - u8 field_18; - u8 field_19; - u8 field_1A; - u8 field_1B; - u8 field_1C; - u8 field_1D; - u8 field_1E; - u8 field_1F; - u8 field_20; - u8 spriteIds[40]; - u8 field_49; - u8 field_4A; - u16 field_4C[6]; - u8 field_58[0x98 - 0x58]; - u16 field_98; - u16 field_9A[3]; - struct UnkStruct_8019BA8 field_A0[8]; - u8 field_C0[12][15]; - u8 field_174[48]; - u8 field_1A4[200]; -}; - -union UnkUnion_Main -{ - struct UnkStruct_Leader *leader; - struct UnkStruct_Group *group; - struct UnkStruct_URoom *uRoom; -}; - -struct TradeUnkStruct -{ - u16 field_0; - u16 type; - u32 playerPersonality; - u8 field_8; - u8 field_9; - u16 playerSpecies; - u16 playerLevel; - u16 species; - u16 level; - u16 field_12; - u32 personality; -}; - -// Exported RAM declarations - -extern u8 gUnknown_02022C2C; -extern union UnkUnion_Main gUnknown_02022C30; -extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; - -extern u16 gUnknown_02022C3C; -extern u8 gUnknown_02022C3E; - -// Exported ROM declarations - -void sub_8018438(void); -void sub_801B990(u32, u32); -u8 sub_8013F78(void); -bool32 sub_802C908(u16); -void nullsub_89(u8 taskId); -void var_800D_set_xB(void); - -bool32 mevent_0814257C(u8 *textState, const u8 *str); -void sub_8018884(const u8 *src); -void sub_80186A4(void); - #endif //GUARD_rom_8011DC0_H diff --git a/include/strings.h b/include/strings.h index 4a65e6875..bf1252680 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2606,4 +2606,24 @@ extern const u8 gText_YayUnkF9F9[]; extern const u8 gText_ThankYou[]; extern const u8 gText_ByeBye[]; +// Mystery Gift +extern const u8 gText_MysteryGift[]; +extern const u8 gText_PickOKCancel[]; +extern const u8 gText_PickOKExit[]; +extern const u8 gJPText_MysteryGift[]; +extern const u8 gJPText_DecideStop[]; +extern const u8 gText_WonderCards[]; +extern const u8 gText_WonderNews[]; +extern const u8 gText_Exit3[]; +extern const u8 gText_WirelessCommunication[]; +extern const u8 gText_Friend2[]; +extern const u8 gText_Cancel2[]; +extern const u8 gText_Receive[]; +extern const u8 gText_Send[]; +extern const u8 gText_Toss[]; +extern const u8 gText_VarietyOfEventsImportedWireless[]; +extern const u8 gText_WonderCardsInPossession[]; +extern const u8 gText_ReadNewsThatArrived[]; +extern const u8 gText_ReturnToTitle[]; + #endif // GUARD_STRINGS_H diff --git a/include/union_room.h b/include/union_room.h index 7634e4763..84a7f1f2b 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -1,9 +1,175 @@ #ifndef GUARD_UNION_ROOM_H #define GUARD_UNION_ROOM_H +#include "librfu.h" + +// Exported type declarations + +struct UnkStruct_Shared +{ + struct UnkLinkRfuStruct_02022B14 field_0; + u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; +}; + +struct UnkStruct_x1C +{ + struct UnkStruct_Shared unk0; + u8 unk18:1; +}; + +struct UnkStruct_x20 +{ + struct UnkStruct_Shared unk; + u16 field_18; + u8 field_1A_0:2; + u8 field_1A_1:1; + u8 field_1B; + u8 field_1D; + u8 field_1E; + u8 field_1F; +}; + +struct UnkStruct_Main0 +{ + struct UnkStruct_x20 arr[8]; +}; + +struct UnkStruct_Main4 +{ + struct UnkStruct_x1C arr[5]; +}; + +struct UnkStruct_Main8 +{ + struct UnkStruct_x20 arr[5]; +}; + +struct UnkStruct_Leader +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main8 *field_8; + u8 state; + u8 textState; + u8 field_E; + u8 listWindowId; + u8 field_10; + u8 field_11; + u8 listTaskId; + u8 field_13; + u8 field_14; + u8 field_15; + u8 field_16; + u8 field_17; + u8 field_18; + u8 field_19; + u16 field_1A; +}; + +struct UnkStruct_Group +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + u8 state; + u8 textState; + u8 field_A; + u8 listWindowId; + u8 field_C; + u8 field_D; + u8 listTaskId; + u8 field_F; + u8 field_10; + u8 field_11; + u8 field_12; + u8 field_13; + u8 field_14; + u8 field_15; +}; + +struct UnkStruct_8019BA8 +{ + u8 field_0; + u8 field_1; + u8 field_2; + u8 field_3; +}; + +struct UnkStruct_URoom +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main0 *field_8; + struct UnkStruct_Main4 *field_C; + u16 field_10; + u16 field_12; + u8 state; + u8 stateAfterPrint; + u8 textState; + u8 field_17; + u8 field_18; + u8 field_19; + u8 field_1A; + u8 field_1B; + u8 field_1C; + u8 field_1D; + u8 field_1E; + u8 field_1F; + u8 field_20; + u8 spriteIds[40]; + u8 field_49; + u8 field_4A; + u16 field_4C[6]; + u8 field_58[0x98 - 0x58]; + u16 field_98; + u16 field_9A[3]; + struct UnkStruct_8019BA8 field_A0[8]; + u8 field_C0[12][15]; + u8 field_174[48]; + u8 field_1A4[200]; +}; + +union UnkUnion_Main +{ + struct UnkStruct_Leader *leader; + struct UnkStruct_Group *group; + struct UnkStruct_URoom *uRoom; +}; + +struct TradeUnkStruct +{ + u16 field_0; + u16 type; + u32 playerPersonality; + u8 field_8; + u8 field_9; + u16 playerSpecies; + u16 playerLevel; + u16 species; + u16 level; + u16 field_12; + u32 personality; +}; + +// Exported RAM declarations + +extern u8 gUnknown_02022C2C; +extern union UnkUnion_Main gUnknown_02022C30; +extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; + +extern u16 gUnknown_02022C3C; +extern u8 gUnknown_02022C3E; + +// Exported ROM declarations + +u8 sub_8013F78(void); +bool32 sub_802C908(u16); +void nullsub_89(u8 taskId); +void var_800D_set_xB(void); + +bool32 mevent_0814257C(u8 *textState, const u8 *str); +void sub_8018884(const u8 *src); +void sub_80186A4(void); + extern bool8 gUnknown_02022C60; -void sub_8018798(u8); -void sub_80186EC(bool8, bool32); - #endif //GUARD_UNION_ROOM_H diff --git a/src/cable_club.c b/src/cable_club.c index b80e76e99..fab187b07 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -17,7 +17,8 @@ #include "menu.h" #include "overworld.h" #include "palette.h" -#include "rom_8011DC0.h" +#include "union_room.h" +#include "mevent2.h" #include "script.h" #include "script_pokemon_util_80F87D8.h" #include "sound.h" diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 6c92b676f..cdb829ac8 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "save.h" #include "sprite.h" #include "task.h" diff --git a/src/ereader_screen.c b/src/ereader_screen.c index b15c1fd0c..10a23e251 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "save.h" #include "sound.h" #include "sprite.h" diff --git a/src/link_rfu.c b/src/link_rfu.c index 945806459..43d19be03 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -11,13 +11,13 @@ #include "overworld.h" #include "random.h" #include "palette.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "string_util.h" #include "task.h" #include "text.h" #include "constants/species.h" #include "save.h" -#include "rom_8011DC0.h" +#include "mystery_gift.h" extern u16 gHeldKeyCodeToSend; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index 857ca3fde..d69ab0495 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -13,6 +13,7 @@ #include "string_util.h" #include "link_rfu.h" #include "mevent.h" +#include "mystery_gift.h" struct UnkStruct_8467FB8 { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index b6c317281..3fbe11378 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -8,16 +8,24 @@ #include "text_window.h" #include "bg.h" #include "window.h" +#include "strings.h" #include "text_window.h" #include "menu.h" #include "palette.h" #include "constants/songs.h" #include "sound.h" #include "mystery_gift.h" +#include "union_room.h" +#include "title_screen.h" +#include "ereader_screen.h" +#include "international_string_util.h" +#include "list_menu.h" void bgid_upload_textbox_1(u8 bgId); -void sub_8018798(u8); -void sub_80186EC(u8, u8); +void task_add_00_mystery_gift(void); + +EWRAM_DATA u8 gUnknown_02022C58 = 0; +EWRAM_DATA u8 gUnknown_02022C59 = 0; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); @@ -168,6 +176,158 @@ const struct WindowTemplate gUnknown_082F0600 = { .baseBlock = 0x0155 }; +const struct ListMenuItem gUnknown_082F0608[] = { + { gText_WonderCards, 0 }, + { gText_WonderNews, 1 }, + { gText_Exit3, -2 } +}; + +const struct ListMenuItem gUnknown_082F0620[] = { + { gText_WirelessCommunication, 0 }, + { gText_Friend2, 1 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuTemplate gUnknown_082F0638 = { + .items = NULL, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuItem gUnknown_082F0650[] = { + { gText_Receive, 0 }, + { gText_Send, 1 }, + { gText_Toss, 2 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F0670[] = { + { gText_Receive, 0 }, + { gText_Toss, 2 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F0688[] = { + { gText_Receive, 0 }, + { gText_Send, 1 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F06A0[] = { + { gText_Receive, 0 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuTemplate gUnknown_082F06B0 = { + .items = gUnknown_082F0650, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 4, + .maxShowed = 4, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06C8 = { + .items = gUnknown_082F0670, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06E0 = { + .items = gUnknown_082F0688, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06F8 = { + .items = gUnknown_082F06A0, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 2, + .maxShowed = 2, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const u8 *const Unref_082F0710[] = { + gText_VarietyOfEventsImportedWireless, + gText_WonderCardsInPossession, + gText_ReadNewsThatArrived, + gText_ReturnToTitle +}; + +ALIGNED(2) const u8 gUnknown_082F0720[] = { 0, 1, 2 }; +ALIGNED(2) const u8 gUnknown_082F0724[] = { 0, 1, 2 }; +ALIGNED(2) const u8 gUnknown_082F0728[] = { 1, 2, 3 }; + void sub_8018424(void) { ProcessSpriteCopyRequests(); @@ -251,3 +411,84 @@ bool32 sub_8018450(s32 arg) return FALSE; } + +void c2_mystery_gift(void) +{ + if (sub_8018450(0)) + { + SetMainCallback2(sub_8018438); + gUnknown_02022C60 = FALSE; + task_add_00_mystery_gift(); + } + RunTasks(); +} + +void sub_801867C(void) +{ + if (sub_8018450(1)) + { + SetMainCallback2(sub_8018438); + gUnknown_02022C60 = TRUE; + sub_81D5014(); + } +} + +void sub_80186A4(void) +{ + gUnknown_02022C60 = FALSE; + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(0)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(2)); + Free(GetBgTilemapBuffer(3)); + SetMainCallback2(CB2_InitTitleScreen); +} + +void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel) +{ + const u8 * header; + const u8 * options; + FillWindowPixelBuffer(0, 0); + if (!isJapanese) + { + header = gText_MysteryGift; + options = !usePickOkCancel ? gText_PickOKExit : gText_PickOKCancel; + } + else + { + header = gJPText_MysteryGift; + options = gJPText_DecideStop; + } + + AddTextPrinterParameterized4(0, 1, 4, 1, 0, 0, gUnknown_082F0720, -1, header); + AddTextPrinterParameterized4(0, 0, GetStringRightAlignXOffset(0, options, 0xDE), 1, 0, 0, gUnknown_082F0720, -1, options); + CopyWindowToVram(0, 2); + PutWindowTilemap(0); +} + +void sub_8018784(u8 windowId) +{ + sub_8098858(windowId, 0x01, 0xF); +} + +void sub_8018798(u32 bg) +{ + s32 i = 0, j; + + FillBgTilemapBufferRect(bg, 0x003, 0, 0, 32, 2, 0x11); + + for (i = 0; i < 18; i++) + { + for (j = 0; j < 32; j++) + { + if ((i & 1) != (j & 1)) + { + FillBgTilemapBufferRect(bg, 1, j, i + 2, 1, 1, 0x11); + } + else + { + FillBgTilemapBufferRect(bg, 2, j, i + 2, 1, 1, 0x11); + } + } + } +} diff --git a/src/party_menu.c b/src/party_menu.c index 7db24b6ca..6233558ff 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -49,7 +49,7 @@ #include "pokemon_summary_screen.h" #include "region_map.h" #include "reshow_battle_screen.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "scanline_effect.h" #include "script.h" #include "sound.h" diff --git a/src/start_menu.c b/src/start_menu.c index 4822c12e6..f573f9bdf 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -44,6 +44,7 @@ #include "window.h" #include "constants/songs.h" #include "rom_8011DC0.h" +#include "union_room.h" // Menu actions enum diff --git a/src/trade.c b/src/trade.c index df8f493f1..34f49060f 100644 --- a/src/trade.c +++ b/src/trade.c @@ -19,6 +19,8 @@ #include "load_save.h" #include "mail.h" #include "main.h" +#include "mevent2.h" +#include "mystery_gift.h" #include "overworld.h" #include "palette.h" #include "party_menu.h" @@ -39,6 +41,7 @@ #include "text_window.h" #include "trainer_card.h" #include "trade.h" +#include "union_room.h" #include "util.h" #include "window.h" #include "constants/easy_chat.h" diff --git a/src/union_room.c b/src/union_room.c index 338063ef1..a623527ec 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -40,7 +40,7 @@ #include "strings.h" #include "mevent.h" #include "dynamic_placeholder_text_util.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "easy_chat.h" #include "event_obj_lock.h" #include "union_room_chat.h" @@ -102,8 +102,6 @@ void sub_8020C70(MainCallback callback); void sub_80149D8(void); u16 sub_8019930(void); void sub_8018784(u8 windowId); -void sub_8018884(const u8 *src); -bool32 mevent_0814257C(u8 *textState, const u8 *str); s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); diff --git a/sym_ewram.txt b/sym_ewram.txt index 8aea7124c..f2efe6a69 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -7,10 +7,9 @@ .include "src/link.o" .include "src/link_rfu.o" .include "src/union_room.o" + .include "src/mystery_gift.o" -gUnknown_02022C58: @ 2022C58 - .space 0x8 - + .align 3 gUnknown_02022C60: @ 2022C60 .space 0x4