From bad170b0cb7a0a7ecb8725e6fc458a39c11a7e4d Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 8 Aug 2018 23:53:21 -0700 Subject: [PATCH] Continue decompiling field_specials --- asm/battle_frontier_2.s | 2 +- asm/field_specials.s | 1301 ----------------- asm/script_menu.s | 2 +- data/field_specials.s | 305 ---- .../scripts.inc | 2 +- .../scripts.inc | 2 +- data/maps/TrainerHill_Elevator/scripts.inc | 2 +- data/specials.inc | 2 +- include/global.h | 24 +- include/menu.h | 2 +- include/script_menu.h | 3 +- include/strings.h | 175 +++ src/field_specials.c | 1061 ++++++++++++++ src/main_menu.c | 2 +- src/menu.c | 2 +- src/scrcmd.c | 2 +- sym_common.txt | 3 +- sym_ewram.txt | 30 - 18 files changed, 1259 insertions(+), 1663 deletions(-) diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 2ab474037..38e0d2e62 100644 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -11843,7 +11843,7 @@ sub_81A0784: @ 81A0784 movs r1, 0 adds r2, r4, 0 adds r3, r5, 0 - bl sub_8198A50 + bl CreateWindowTemplate ldr r0, [sp, 0x10] ldr r1, [sp, 0x14] str r0, [sp, 0x18] diff --git a/asm/field_specials.s b/asm/field_specials.s index 3f0ba5ad8..6e6329a42 100644 --- a/asm/field_specials.s +++ b/asm/field_specials.s @@ -5,1307 +5,6 @@ .text - thumb_func_start sub_81399F4 -sub_81399F4: @ 81399F4 - push {r4,lr} - ldr r2, =gUnknown_0203AB60 - movs r0, 0 - strh r0, [r2] - ldr r1, =gUnknown_0203AB62 - strh r0, [r1] - ldr r0, =gSaveBlock1Ptr - ldr r3, [r0] - movs r0, 0x14 - ldrsb r0, [r3, r0] - adds r4, r1, 0 - cmp r0, 0xD - bne _08139A6E - ldrb r0, [r3, 0x15] - subs r0, 0x10 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bhi _08139A6E - lsls r0, 2 - ldr r1, =_08139A34 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08139A34: - .4byte _08139A66 - .4byte _08139A5E - .4byte _08139A56 - .4byte _08139A4E - .4byte _08139A48 -_08139A48: - movs r0, 0 - strh r0, [r2] - b _08139A6C -_08139A4E: - movs r0, 0 - strh r0, [r2] - movs r0, 0x1 - b _08139A6C -_08139A56: - movs r0, 0 - strh r0, [r2] - movs r0, 0x2 - b _08139A6C -_08139A5E: - movs r0, 0 - strh r0, [r2] - movs r0, 0x3 - b _08139A6C -_08139A66: - movs r0, 0 - strh r0, [r2] - movs r0, 0x4 -_08139A6C: - strh r0, [r4] -_08139A6E: - ldrh r0, [r4] - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_81399F4 - - thumb_func_start sub_8139A78 -sub_8139A78: @ 8139A78 - push {r4-r6,lr} - ldr r0, =sub_8139AF4 - movs r1, 0x9 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r4, r1, r0 - movs r3, 0 - strh r3, [r4, 0x2] - strh r3, [r4, 0x4] - movs r6, 0x1 - strh r6, [r4, 0x8] - ldr r0, =gSpecialVar_0x8005 - ldr r1, =gSpecialVar_0x8006 - ldrh r2, [r0] - ldrh r0, [r1] - cmp r2, r0 - bls _08139AC0 - subs r0, r2, r0 - lsls r0, 16 - lsrs r5, r0, 16 - strh r6, [r4, 0xC] - b _08139AC8 - .pool -_08139AC0: - subs r0, r2 - lsls r0, 16 - lsrs r5, r0, 16 - strh r3, [r4, 0xC] -_08139AC8: - cmp r5, 0x8 - bls _08139ACE - movs r5, 0x8 -_08139ACE: - ldr r0, =gUnknown_085B2C18 - adds r0, r5, r0 - ldrb r0, [r0] - strh r0, [r4, 0xA] - movs r0, 0 - bl SetCameraPanningCallback - ldrb r1, [r4, 0xC] - adds r0, r5, 0 - bl sub_8139C2C - movs r0, 0x59 - bl PlaySE - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139A78 - - thumb_func_start sub_8139AF4 -sub_8139AF4: @ 8139AF4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r4, r0, r1 - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] - movs r1, 0x2 - ldrsh r0, [r4, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bne _08139B54 - strh r0, [r4, 0x2] - ldrh r0, [r4, 0x4] - adds r0, 0x1 - strh r0, [r4, 0x4] - ldrh r0, [r4, 0x8] - negs r0, r0 - strh r0, [r4, 0x8] - movs r2, 0x8 - ldrsh r1, [r4, r2] - movs r0, 0 - bl SetCameraPanning - movs r0, 0x4 - ldrsh r1, [r4, r0] - movs r2, 0xA - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _08139B54 - movs r0, 0x49 - bl PlaySE - adds r0, r5, 0 - bl DestroyTask - bl EnableBothScriptContexts - bl InstallCameraPanAheadCallback -_08139B54: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139AF4 - - thumb_func_start sub_8139B60 -sub_8139B60: @ 8139B60 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0xC - ldr r5, =gUnknown_0203AB5E - ldr r0, =gUnknown_085B2BAC - bl AddWindow - strb r0, [r5] - ldrb r0, [r5] - movs r1, 0 - bl SetStandardWindowBorderStyle - ldr r4, =gText_ElevatorNowOn - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldrb r0, [r5] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - mov r9, r1 - str r1, [sp, 0x4] - movs r1, 0 - mov r8, r1 - str r1, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - bl PrintTextOnWindow - ldr r6, =gElevatorFloorsTable - ldr r4, =gSpecialVar_0x8005 - ldrh r0, [r4] - lsls r0, 2 - adds r0, r6 - ldr r1, [r0] - movs r0, 0x1 - movs r2, 0x40 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - ldrb r0, [r5] - ldrh r1, [r4] - lsls r1, 2 - adds r1, r6 - ldr r2, [r1] - lsls r3, 24 - lsrs r3, 24 - movs r1, 0x11 - str r1, [sp] - mov r1, r9 - str r1, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - movs r1, 0x1 - bl PrintTextOnWindow - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r5] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139B60 - - thumb_func_start sub_8139C10 -sub_8139C10: @ 8139C10 - push {r4,lr} - ldr r4, =gUnknown_0203AB5E - ldrb r0, [r4] - movs r1, 0x1 - bl sub_8198070 - ldrb r0, [r4] - bl RemoveWindow - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139C10 - - thumb_func_start sub_8139C2C -sub_8139C2C: @ 8139C2C - push {r4-r6,lr} - lsls r0, 16 - lsrs r6, r0, 16 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r4, =sub_8139C80 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08139C6C - adds r0, r4, 0 - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - strh r0, [r1, 0xA] - strh r5, [r1, 0xC] - ldr r0, =gUnknown_085B2C21 - adds r0, r6, r0 - ldrb r0, [r0] - strh r0, [r1, 0xE] -_08139C6C: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139C2C - - thumb_func_start sub_8139C80 -sub_8139C80: @ 8139C80 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - lsls r0, 2 - ldr r1, [sp] - adds r0, r1 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r6, r0, r1 - movs r2, 0x2 - ldrsh r0, [r6, r2] - cmp r0, 0x6 - bne _08139D7C - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] - movs r1, 0x4 - ldrsh r0, [r6, r1] - cmp r0, 0 - bne _08139D10 - movs r1, 0 - ldr r2, =gUnknown_085B2BF4 - mov r10, r2 -_08139CBA: - movs r5, 0 - adds r7, r1, 0x7 - lsls r0, r1, 1 - adds r2, r1, 0x1 - mov r8, r2 - adds r0, r1 - lsls r0, 1 - mov r9, r0 -_08139CCA: - adds r4, r5, 0 - adds r4, 0x8 - movs r1, 0 - ldrsh r0, [r6, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - asrs r0, 15 - add r0, r9 - add r0, r10 - ldrh r0, [r0] - movs r1, 0xC0 - lsls r1, 4 - adds r2, r1, 0 - orrs r2, r0 - adds r0, r4, 0 - adds r1, r7, 0 - bl MapGridSetMetatileIdAt - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _08139CCA - mov r2, r8 - lsls r0, r2, 24 - lsrs r1, r0, 24 - cmp r1, 0x2 - bls _08139CBA - b _08139D62 - .pool -_08139D10: - movs r1, 0 - ldr r0, =gUnknown_085B2C06 - mov r10, r0 -_08139D16: - movs r5, 0 - adds r7, r1, 0x7 - lsls r0, r1, 1 - adds r2, r1, 0x1 - mov r8, r2 - adds r0, r1 - lsls r0, 1 - mov r9, r0 -_08139D26: - adds r4, r5, 0 - adds r4, 0x8 - movs r1, 0 - ldrsh r0, [r6, r1] - movs r1, 0x3 - bl __modsi3 - lsls r0, 16 - asrs r0, 15 - add r0, r9 - add r0, r10 - ldrh r0, [r0] - movs r1, 0xC0 - lsls r1, 4 - adds r2, r1, 0 - orrs r2, r0 - adds r0, r4, 0 - adds r1, r7, 0 - bl MapGridSetMetatileIdAt - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _08139D26 - mov r2, r8 - lsls r0, r2, 24 - lsrs r1, r0, 24 - cmp r1, 0x2 - bls _08139D16 -_08139D62: - bl DrawWholeMapView - movs r0, 0 - strh r0, [r6, 0x2] - movs r0, 0 - ldrsh r1, [r6, r0] - movs r2, 0x6 - ldrsh r0, [r6, r2] - cmp r1, r0 - bne _08139D7C - ldr r0, [sp] - bl DestroyTask -_08139D7C: - ldrh r0, [r6, 0x2] - adds r0, 0x1 - strh r0, [r6, 0x2] - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139C80 - - thumb_func_start sub_8139D98 -sub_8139D98: @ 8139D98 - push {r4-r7,lr} - sub sp, 0x18 - ldr r6, =gSpecialVar_0x8004 - ldrh r0, [r6] - movs r5, 0x64 - muls r0, r5 - ldr r4, =gPlayerParty - adds r0, r4 - movs r1, 0x27 - bl GetMonData - str r0, [sp] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x28 - bl GetMonData - str r0, [sp, 0x4] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x29 - bl GetMonData - str r0, [sp, 0x8] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x2A - bl GetMonData - str r0, [sp, 0xC] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x2B - bl GetMonData - str r0, [sp, 0x10] - ldrh r0, [r6] - muls r0, r5 - adds r0, r4 - movs r1, 0x2C - bl GetMonData - str r0, [sp, 0x14] - ldr r1, =gSpecialVar_0x8005 - movs r0, 0 - strh r0, [r1] - movs r4, 0 - adds r2, r1, 0 -_08139E00: - lsls r0, r4, 2 - add r0, sp - ldr r1, [r0] - ldrh r0, [r2] - adds r0, r1 - strh r0, [r2] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _08139E00 - ldr r2, =gSpecialVar_0x8006 - movs r0, 0 - strh r0, [r2] - ldr r1, =gSpecialVar_0x8007 - ldr r0, [sp] - strh r0, [r1] - movs r4, 0x1 - adds r6, r2, 0 - adds r7, r1, 0 -_08139E28: - ldrh r0, [r6] - lsls r0, 2 - mov r2, sp - adds r1, r2, r0 - lsls r0, r4, 2 - adds r5, r2, r0 - ldr r1, [r1] - ldr r0, [r5] - cmp r1, r0 - bcs _08139E54 - strh r4, [r6] - b _08139E6C - .pool -_08139E54: - cmp r1, r0 - bne _08139E6E - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08139E6E - strh r4, [r6] - ldr r0, [r5] -_08139E6C: - strh r0, [r7] -_08139E6E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _08139E28 - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8139D98 - - thumb_func_start warp0_in_pokecenter -warp0_in_pokecenter: @ 8139E80 - push {r4,lr} - ldr r0, =gUnknown_020322DC - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r1, 8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - asrs r0, 24 - adds r0, r1 - lsls r0, 16 - lsrs r3, r0, 16 - ldr r2, =gUnknown_085B2C2A - ldrh r0, [r2] - ldr r1, =0x0000ffff - cmp r0, r1 - beq _08139EC6 - adds r4, r1, 0 - adds r1, r2, 0 -_08139EA4: - ldrh r0, [r2] - cmp r0, r3 - bne _08139EBC - movs r0, 0x1 - b _08139EC8 - .pool -_08139EBC: - adds r1, 0x2 - adds r2, 0x2 - ldrh r0, [r1] - cmp r0, r4 - bne _08139EA4 -_08139EC6: - movs r0, 0 -_08139EC8: - pop {r4} - pop {r1} - bx r1 - thumb_func_end warp0_in_pokecenter - - thumb_func_start sub_8139ED0 -sub_8139ED0: @ 8139ED0 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldr r0, =0x00003c1a - cmp r1, r0 - beq _08139EEC - movs r0, 0x1 - b _08139EEE - .pool -_08139EEC: - movs r0, 0 -_08139EEE: - pop {r1} - bx r1 - thumb_func_end sub_8139ED0 - - thumb_func_start UpdateFrontierManiac -UpdateFrontierManiac: @ 8139EF4 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, =0x0000402f - bl GetVarPointer - adds r5, r0, 0 - ldrh r0, [r5] - adds r4, r0 - strh r4, [r5] - ldrh r0, [r5] - movs r1, 0xA - bl __umodsi3 - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end UpdateFrontierManiac - - thumb_func_start sub_8139F20 -sub_8139F20: @ 8139F20 - push {r4-r7,lr} - movs r4, 0 - ldr r0, =0x0000402f - bl VarGet - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x9 - bls _08139F34 - b _0813A03A -_08139F34: - lsls r0, r6, 2 - ldr r1, =_08139F48 - adds r1, r0, r1 - ldr r1, [r1] - adds r2, r0, 0 - mov pc, r1 - .pool - .align 2, 0 -_08139F48: - .4byte _08139F70 - .4byte _08139F70 - .4byte _08139F70 - .4byte _08139F70 - .4byte _08139F94 - .4byte _08139FB4 - .4byte _08139FCC - .4byte _08139FE4 - .4byte _08139FFC - .4byte _0813A014 -_08139F70: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - movs r3, 0xCE - lsls r3, 4 - adds r1, r0, r3 - adds r3, r1, r2 - ldr r1, =0x00000ce2 - adds r0, r1 - adds r1, r0, r2 - ldrh r0, [r3] - ldrh r2, [r1] - cmp r0, r2 - bcs _0813A028 - b _0813A038 - .pool -_08139F94: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r3, =0x00000d0c - adds r2, r0, r3 - adds r3, 0x2 -_08139F9E: - adds r1, r0, r3 - ldrh r0, [r2] - ldrh r3, [r1] - cmp r0, r3 - bcs _0813A028 - b _0813A038 - .pool -_08139FB4: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000de2 - adds r2, r0, r1 - ldr r3, =0x00000de4 - b _08139F9E - .pool -_08139FCC: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000dc8 - adds r2, r0, r1 - ldr r3, =0x00000dca - b _08139F9E - .pool -_08139FE4: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000dda - adds r2, r0, r1 - ldr r3, =0x00000ddc - b _08139F9E - .pool -_08139FFC: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000e04 - adds r2, r0, r1 - ldr r3, =0x00000e06 - b _08139F9E - .pool -_0813A014: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000e1a - adds r2, r0, r1 - ldr r3, =0x00000e1c - adds r1, r0, r3 - ldrh r0, [r2] - ldrh r3, [r1] - cmp r0, r3 - bcc _0813A038 -_0813A028: - adds r4, r0, 0 - b _0813A03A - .pool -_0813A038: - ldrh r4, [r1] -_0813A03A: - movs r2, 0 - ldr r5, =gUnknown_085B2CC8 - lsls r0, r6, 1 - adds r1, r0, r5 - ldrb r1, [r1] - adds r3, r0, 0 - ldr r7, =gUnknown_085B2C50 - cmp r1, r4 - bcs _0813A062 - adds r1, r3, 0 -_0813A04E: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x1 - bhi _0813A062 - adds r0, r2, r1 - adds r0, r5 - ldrb r0, [r0] - cmp r0, r4 - bcc _0813A04E -_0813A062: - adds r0, r3, r6 - adds r0, r2 - lsls r0, 2 - adds r0, r7 - ldr r0, [r0] - bl ShowFieldMessage - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8139F20 - - thumb_func_start sub_813A080 -sub_813A080: @ 813A080 - push {r4-r7,lr} - ldr r0, =0x000040ce - bl VarGet - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000ca9 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 30 - lsrs r4, r0, 30 - cmp r5, 0x2 - bne _0813A0D8 - movs r0, 0xA9 - lsls r0, 1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _0813A0D8 - ldr r1, =gSpecialVar_0x8005 - movs r0, 0x5 - strh r0, [r1] - ldr r1, =gSpecialVar_0x8006 - movs r0, 0x4 - strh r0, [r1] - b _0813A110 - .pool -_0813A0D0: - movs r0, 0x4 - strh r0, [r6] - adds r0, r3, 0x5 - b _0813A10E -_0813A0D8: - movs r3, 0 - ldr r6, =gSpecialVar_0x8005 - ldr r7, =gSpecialVar_0x8006 - lsls r1, r4, 1 - lsls r2, r5, 2 - ldr r4, =gUnknown_085B2CDC - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - adds r1, r2 - movs r2, 0xCE - lsls r2, 4 - adds r0, r2 - adds r0, r1 - ldrh r1, [r0] -_0813A0F4: - lsls r0, r3, 1 - adds r0, r4 - ldrh r0, [r0] - cmp r0, r1 - bhi _0813A0D0 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x8 - bls _0813A0F4 - movs r0, 0x4 - strh r0, [r6] - movs r0, 0xC -_0813A10E: - strh r0, [r7] -_0813A110: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A080 - - thumb_func_start sub_813A128 -sub_813A128: @ 813A128 - push {r4,lr} - ldr r0, =sub_813A2DC - movs r1, 0x8 - bl CreateTask - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks - adds r3, r0, r1 - ldr r1, =gSpecialVar_0x8004 - ldrh r0, [r1] - strh r0, [r3, 0x1E] - ldrh r0, [r1] - cmp r0, 0xC - bls _0813A14E - b _0813A2C6 -_0813A14E: - lsls r0, 2 - ldr r1, =_0813A168 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0813A168: - .4byte _0813A19C - .4byte _0813A1AA - .4byte _0813A1C2 - .4byte _0813A1D6 - .4byte _0813A1F0 - .4byte _0813A208 - .4byte _0813A222 - .4byte _0813A23C - .4byte _0813A25A - .4byte _0813A274 - .4byte _0813A274 - .4byte _0813A28E - .4byte _0813A2A8 -_0813A19C: - movs r1, 0 - movs r0, 0x1 - strh r0, [r3, 0x8] - strh r0, [r3, 0xA] - strh r0, [r3, 0xC] - strh r0, [r3, 0xE] - b _0813A2BC -_0813A1AA: - movs r1, 0 - movs r0, 0x5 - strh r0, [r3, 0x8] - movs r0, 0x8 - strh r0, [r3, 0xA] - movs r0, 0x1 - strh r0, [r3, 0xC] - strh r0, [r3, 0xE] - movs r0, 0x9 - strh r0, [r3, 0x10] - movs r0, 0xA - b _0813A2BE -_0813A1C2: - movs r2, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r1, 0xC - strh r1, [r3, 0xA] - movs r0, 0x1 - strh r0, [r3, 0xC] - strh r0, [r3, 0xE] - movs r0, 0x7 - b _0813A250 -_0813A1D6: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xB - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A1F0: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A208: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0x7 - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A222: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xA - strh r0, [r3, 0xA] - movs r0, 0xE - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xF - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A23C: - movs r2, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r1, 0xC - strh r1, [r3, 0xA] - movs r0, 0xF - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xE -_0813A250: - strh r0, [r3, 0x10] - strh r1, [r3, 0x12] - strh r2, [r3, 0x14] - strh r4, [r3, 0x26] - b _0813A2D2 -_0813A25A: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xA - strh r0, [r3, 0xA] - movs r0, 0x11 - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xB - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A274: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0xB - strh r0, [r3, 0xA] - movs r0, 0xF - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xE - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A28E: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0x7 - strh r0, [r3, 0xA] - movs r0, 0x13 - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xA - strh r0, [r3, 0x10] - movs r0, 0xC - b _0813A2BE -_0813A2A8: - movs r1, 0 - movs r0, 0x6 - strh r0, [r3, 0x8] - movs r0, 0x7 - strh r0, [r3, 0xA] - movs r0, 0x11 - strh r0, [r3, 0xC] - movs r0, 0x1 - strh r0, [r3, 0xE] - movs r0, 0xC -_0813A2BC: - strh r0, [r3, 0x10] -_0813A2BE: - strh r0, [r3, 0x12] - strh r1, [r3, 0x14] - strh r4, [r3, 0x26] - b _0813A2D2 -_0813A2C6: - ldr r1, =gSpecialVar_Result - movs r0, 0x7F - strh r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_0813A2D2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A128 - - thumb_func_start sub_813A2DC -sub_813A2DC: @ 813A2DC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x20 - lsls r0, 24 - lsrs r7, r0, 24 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks - adds r6, r0, r1 - bl ScriptContext2_Enable - ldr r0, =gUnknown_0203AB68 - movs r5, 0 - strh r5, [r0] - ldr r1, =gUnknown_0203AB6C - movs r0, 0x40 - strb r0, [r1] - ldrh r0, [r6, 0x1E] - movs r1, 0 - bl sub_813AA60 - ldrb r0, [r6, 0x1E] - movs r1, 0 - bl sub_813ACE8 - ldr r4, =gUnknown_0203AB64 - movs r1, 0xA - ldrsh r0, [r6, r1] - lsls r0, 3 - bl AllocZeroed - str r0, [r4] - ldr r0, =gUnknown_0203AB6A - strh r5, [r0] - bl sub_813A42C - movs r3, 0 - movs r4, 0 - movs r2, 0xA - ldrsh r0, [r6, r2] - add r1, sp, 0x18 - mov r8, r1 - cmp r3, r0 - bge _0813A36A - ldr r5, =gUnknown_085B2CF0 -_0813A33A: - lsls r1, r4, 2 - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r1, r5 - ldr r0, [r1] - ldr r1, =gUnknown_0203AB64 - ldr r2, [r1] - lsls r1, r4, 3 - adds r1, r2 - str r0, [r1] - str r4, [r1, 0x4] - adds r1, r3, 0 - bl display_text_and_get_width - adds r3, r0, 0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - movs r2, 0xA - ldrsh r0, [r6, r2] - cmp r4, r0 - blt _0813A33A -_0813A36A: - adds r0, r3, 0 - bl convert_pixel_width_to_tile_width - strh r0, [r6, 0x10] - movs r1, 0xC - ldrsh r0, [r6, r1] - movs r2, 0x10 - ldrsh r1, [r6, r2] - adds r0, r1 - cmp r0, 0x1D - ble _0813A38C - movs r0, 0x1D - subs r0, r1 - cmp r0, 0 - bge _0813A38A - movs r0, 0 -_0813A38A: - strh r0, [r6, 0xC] -_0813A38C: - ldrb r2, [r6, 0xC] - ldrb r3, [r6, 0xE] - ldrb r0, [r6, 0x10] - str r0, [sp] - ldrb r0, [r6, 0x12] - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0x64 - str r0, [sp, 0xC] - add r0, sp, 0x10 - movs r1, 0 - bl sub_8198A50 - ldr r0, [sp, 0x10] - ldr r1, [sp, 0x14] - str r0, [sp, 0x18] - str r1, [sp, 0x1C] - mov r0, r8 - bl AddWindow - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x22] - movs r1, 0 - bl SetStandardWindowBorderStyle - ldr r4, =gUnknown_030061D0 - ldrh r0, [r6, 0xA] - strh r0, [r4, 0xC] - ldrh r0, [r6, 0x8] - strh r0, [r4, 0xE] - ldrh r0, [r6, 0x22] - strb r0, [r4, 0x10] - adds r0, r7, 0 - bl sub_813A694 - ldrh r1, [r6, 0x16] - ldrh r2, [r6, 0x18] - adds r0, r4, 0 - bl ListMenuInit - lsls r0, 24 - lsrs r0, 24 - strh r0, [r6, 0x24] - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_813A4EC - str r1, [r0] - add sp, 0x20 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A2DC - - thumb_func_start sub_813A42C -sub_813A42C: @ 813A42C - ldr r1, =gUnknown_030061D0 - ldr r0, =gUnknown_0203AB64 - ldr r0, [r0] - str r0, [r1] - ldr r0, =sub_813A46C - str r0, [r1, 0x4] - movs r0, 0 - str r0, [r1, 0x8] - movs r2, 0 - movs r0, 0x1 - strh r0, [r1, 0xC] - strh r0, [r1, 0xE] - strb r2, [r1, 0x10] - strb r2, [r1, 0x11] - movs r0, 0x8 - strb r0, [r1, 0x12] - strb r2, [r1, 0x13] - movs r0, 0x21 - strb r0, [r1, 0x14] - movs r0, 0x31 - strb r0, [r1, 0x15] - movs r0, 0 - strb r0, [r1, 0x16] - movs r0, 0x1 - strb r0, [r1, 0x17] - bx lr - .pool - thumb_func_end sub_813A42C - - thumb_func_start sub_813A46C -sub_813A46C: @ 813A46C - push {r4,r5,lr} - sub sp, 0x4 - movs r0, 0x5 - bl PlaySE - ldr r0, =sub_813A4EC - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _0813A4D4 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks - adds r4, r0 - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - bl ListMenuGetScrollAndRow - ldr r1, =gUnknown_0203AB68 - mov r0, sp - ldrh r0, [r0] - strh r0, [r1] - ldrh r0, [r4, 0x24] - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - bl ListMenuGetCurrentItemArrayId - ldrh r0, [r4, 0x1E] - ldr r5, =gUnknown_0203AB6A - ldrh r1, [r5] - bl sub_813AC44 - ldrh r0, [r4, 0x1E] - mov r1, sp - ldrh r1, [r1] - bl sub_813AA60 - ldrb r0, [r4, 0x1E] - mov r1, sp - ldrh r1, [r1] - bl sub_813AD34 - mov r0, sp - ldrh r0, [r0] - strh r0, [r5] -_0813A4D4: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_813A46C - thumb_func_start sub_813A4EC sub_813A4EC: @ 813A4EC push {r4-r6,lr} diff --git a/asm/script_menu.s b/asm/script_menu.s index a2e2ec59e..670740a77 100644 --- a/asm/script_menu.s +++ b/asm/script_menu.s @@ -1498,7 +1498,7 @@ CreateWindowFromRect: @ 80E2A1C movs r1, 0 adds r2, r4, 0 adds r3, r5, 0 - bl sub_8198A50 + bl CreateWindowTemplate ldr r0, [sp, 0x10] ldr r1, [sp, 0x14] str r0, [sp, 0x18] diff --git a/data/field_specials.s b/data/field_specials.s index 030a279ef..0f52cb891 100644 --- a/data/field_specials.s +++ b/data/field_specials.s @@ -3,311 +3,6 @@ .section .rodata - .align 2 -gUnknown_085B2BAC:: @ 85B2BAC - .byte 0x00, 0x15, 0x01, 0x08, 0x04, 0x0f, 0x08, 0x00 - - .align 2 -gElevatorFloorsTable:: @ 85B2BB4 - .4byte gText_B4F - .4byte gText_B3F - .4byte gText_B2F - .4byte gText_B1F - .4byte gText_1F - .4byte gText_2F - .4byte gText_3F - .4byte gText_4F - .4byte gText_5F - .4byte gText_6F - .4byte gText_7F - .4byte gText_8F - .4byte gText_9F - .4byte gText_10F - .4byte gText_11F - .4byte gText_Rooftop - - .align 1 -gUnknown_085B2BF4:: @ 85B2BF4 - .2byte 0x0329, 0x032a, 0x032b, 0x0331, 0x0332, 0x0333, 0x0339, 0x033a, 0x033b - - .align 1 -gUnknown_085B2C06:: @ 85B2C06 - .2byte 0x0329, 0x032b, 0x032a, 0x0331, 0x0333, 0x0332, 0x0339, 0x033b, 0x033a - -gUnknown_085B2C18:: @ 85B2C18 - .byte 0x08, 0x10, 0x18, 0x20, 0x26, 0x2e, 0x34, 0x38, 0x39 - -gUnknown_085B2C21:: @ 85B2C21 - .byte 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b - - .align 1 -gUnknown_085B2C2A:: @ 85B2C2A - .2byte 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a - .2byte 0x1a35, 0x193c, 0xffff - - .align 2 -gUnknown_085B2C50:: @ 85B2C50 - .4byte BattleFrontier_Lounge2_Text_260971 - .4byte BattleFrontier_Lounge2_Text_260A1E - .4byte BattleFrontier_Lounge2_Text_260AE7 - .4byte BattleFrontier_Lounge2_Text_2619AC - .4byte BattleFrontier_Lounge2_Text_261A91 - .4byte BattleFrontier_Lounge2_Text_261B0C - .4byte BattleFrontier_Lounge2_Text_261B95 - .4byte BattleFrontier_Lounge2_Text_261B95 - .4byte BattleFrontier_Lounge2_Text_261B95 - .4byte BattleFrontier_Lounge2_Text_261C1A - .4byte BattleFrontier_Lounge2_Text_261C1A - .4byte BattleFrontier_Lounge2_Text_261C1A - .4byte BattleFrontier_Lounge2_Text_260BC4 - .4byte BattleFrontier_Lounge2_Text_260C6D - .4byte BattleFrontier_Lounge2_Text_260D3A - .4byte BattleFrontier_Lounge2_Text_260E1E - .4byte BattleFrontier_Lounge2_Text_260EC7 - .4byte BattleFrontier_Lounge2_Text_260F74 - .4byte BattleFrontier_Lounge2_Text_2614E6 - .4byte BattleFrontier_Lounge2_Text_261591 - .4byte BattleFrontier_Lounge2_Text_26166F - .4byte BattleFrontier_Lounge2_Text_261282 - .4byte BattleFrontier_Lounge2_Text_261329 - .4byte BattleFrontier_Lounge2_Text_261403 - .4byte BattleFrontier_Lounge2_Text_261026 - .4byte BattleFrontier_Lounge2_Text_2610CC - .4byte BattleFrontier_Lounge2_Text_261194 - .4byte BattleFrontier_Lounge2_Text_26174D - .4byte BattleFrontier_Lounge2_Text_2617F9 - .4byte BattleFrontier_Lounge2_Text_2618C4 - -gUnknown_085B2CC8:: @ 85B2CC8 - .byte 0x15, 0x38, 0x15, 0x23, 0xff, 0xff, 0xff, 0xff, 0x02, 0x04, 0x07, 0x15, 0x07, 0x15, 0x0e, 0x1c, 0x0d, 0x70, 0x07, 0x38 - - .align 1 -gUnknown_085B2CDC:: @ 85B2CDC - .2byte 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 - - .align 2 -gUnknown_085B2CF0:: @ 85B2CF0 - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_BlueFlute - .4byte gText_YellowFlute - .4byte gText_RedFlute - .4byte gText_WhiteFlute - .4byte gText_BlackFlute - .4byte gText_PrettyChair - .4byte gText_PrettyDesk - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_0Pts - .4byte gText_10Pts - .4byte gText_20Pts - .4byte gText_30Pts - .4byte gText_40Pts - .4byte gText_50Pts - .4byte gText_60Pts - .4byte gText_70Pts - .4byte gText_80Pts - .4byte gText_90Pts - .4byte gText_100Pts - .4byte gText_QuestionMark - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_KissPoster16BP - .4byte gText_KissCushion32BP - .4byte gText_SmoochumDoll32BP - .4byte gText_TogepiDoll48BP - .4byte gText_MeowthDoll48BP - .4byte gText_ClefairyDoll48BP - .4byte gText_DittoDoll48BP - .4byte gText_CyndaquilDoll80BP - .4byte gText_ChikoritaDoll80BP - .4byte gText_TotodileDoll80BP - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_LaprasDoll128BP - .4byte gText_SnorlaxDoll128BP - .4byte gText_VenusaurDoll256BP - .4byte gText_CharizardDoll256BP - .4byte gText_BlastoiseDoll256BP - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_Protein1BP - .4byte gText_Calcium1BP - .4byte gText_Iron1BP - .4byte gText_Zinc1BP - .4byte gText_Carbos1BP - .4byte gText_HpUp1BP - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_Leftovers48BP - .4byte gText_WhiteHerb48BP - .4byte gText_QuickClaw48BP - .4byte gText_MentalHerb48BP - .4byte gText_BrightPowder64BP - .4byte gText_ChoiceBand64BP - .4byte gText_KingsRock64BP - .4byte gText_FocusBand64BP - .4byte gText_ScopeLens64BP - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_EnergyPowder50 - .4byte gText_EnergyRoot80 - .4byte gText_HealPowder50 - .4byte gText_RevivalHerb300 - .4byte gText_Protein1000 - .4byte gText_Iron1000 - .4byte gText_Carbos1000 - .4byte gText_Calcium1000 - .4byte gText_Zinc1000 - .4byte gText_HPUp1000 - .4byte gText_PPUp3000 - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_BattleTower2 - .4byte gText_BattleDome - .4byte gText_BattlePalace - .4byte gText_BattleArena - .4byte gText_BattleFactory - .4byte gText_BattlePike - .4byte gText_BattlePyramid - .4byte gText_RankingHall - .4byte gText_ExchangeService - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_Softboiled16BP - .4byte gText_SeismicToss24BP - .4byte gText_DreamEater24BP - .4byte gText_MegaPunch24BP - .4byte gText_MegaKick48BP - .4byte gText_BodySlam48BP - .4byte gText_RockSlide48BP - .4byte gText_Counter48BP - .4byte gText_ThunderWave48BP - .4byte gText_SwordsDance48BP - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_DefenseCurl16BP - .4byte gText_Snore24BP - .4byte gText_MudSlap24BP - .4byte gText_Swift24BP - .4byte gText_IcyWind24BP - .4byte gText_Endure48BP - .4byte gText_PsychUp48BP - .4byte gText_IcePunch48BP - .4byte gText_ThunderPunch48BP - .4byte gText_FirePunch48BP - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_SlateportCity - .4byte gText_BattleFrontier - .4byte gText_SouthernIsland - .4byte gText_NavelRock - .4byte gText_BirthIsland - .4byte gText_FarawayIsland - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - - .4byte gText_BattleTrainers - .4byte gText_BattleBasics - .4byte gText_PokemonNature - .4byte gText_PokemonMoves - .4byte gText_Underpowered - .4byte gText_WhenInDanger - .4byte gText_Exit - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .4byte NULL - .align 2 gUnknown_085B3030:: @ 85B3030 .4byte 0x03000002, 0x00000000, 0x07d00000, 0x00000064 diff --git a/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc b/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc index 248c1f9ca..072d27137 100644 --- a/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc +++ b/data/maps/BattleFrontier_BattleTowerElevator/scripts.inc @@ -14,7 +14,7 @@ BattleFrontier_BattleTowerElevator_EventScript_2419F0:: @ 82419F0 waitmovement 0 special sub_813A080 waitse - special sub_8139A78 + special ShakeScreenInElevator waitstate delay 48 applymovement 1, BattleFrontier_BattleTowerElevator_Movement_241A8E diff --git a/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc b/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc index cc1b51ea4..372d16dae 100644 --- a/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc +++ b/data/maps/LilycoveCity_DepartmentStoreElevator/scripts.inc @@ -118,7 +118,7 @@ LilycoveCity_DepartmentStoreElevator_EventScript_2207E5:: @ 82207E5 applymovement VAR_LAST_TALKED, LilycoveCity_DepartmentStoreElevator_Movement_2725AA waitmovement 0 waitse - special sub_8139A78 + special ShakeScreenInElevator waitstate setflag FLAG_0x002 return diff --git a/data/maps/TrainerHill_Elevator/scripts.inc b/data/maps/TrainerHill_Elevator/scripts.inc index ac2d5c8a7..ff731393b 100644 --- a/data/maps/TrainerHill_Elevator/scripts.inc +++ b/data/maps/TrainerHill_Elevator/scripts.inc @@ -50,7 +50,7 @@ TrainerHill_Elevator_EventScript_2693D4:: @ 82693D4 TrainerHill_Elevator_EventScript_2693D9:: @ 82693D9 waitse - special sub_8139A78 + special ShakeScreenInElevator waitstate return diff --git a/data/specials.inc b/data/specials.inc index 43607cf6e..0b58f39ba 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -284,7 +284,7 @@ gSpecials:: @ 81DBA64 def_special sub_80FB7A4 def_special DoSoftReset def_special GameClear - def_special sub_8139A78 + def_special ShakeScreenInElevator def_special nullsub_55 def_special SpawnScriptEventObject def_special RemoveScriptEventObject diff --git a/include/global.h b/include/global.h index 7153ef260..687ee26d2 100644 --- a/include/global.h +++ b/include/global.h @@ -344,7 +344,8 @@ struct BattleFrontier /*0xCA9*/ u8 field_CA9_f:1; // 0x80 /*0xCAA*/ u16 field_CAA[4]; /*0xCB2*/ u16 field_CB2; - /*0xCB4*/ u16 field_CB4[30]; + /*0xCB4*/ u16 field_CB4[22]; + /*0xCE0*/ u16 field_CE0[4][2]; /*0xCF0*/ u16 field_CF0[2]; /*0xCF4*/ u16 field_CF4[2]; /*0xCF8*/ u16 field_CF8[2]; @@ -355,24 +356,21 @@ struct BattleFrontier /*0xD09*/ u8 filler_D09; /*0xD0A*/ u8 filler_D0A; /*0xD0B*/ u8 filler_D0B; - /*0xD0C*/ u8 filler_D0C; - /*0xD0D*/ u8 filler_D0D; - /*0xD0E*/ u8 filler_D0E; - /*0xD0F*/ u8 filler_D0F; + /*0xD0C*/ u16 field_D0C[2]; /*0xD10*/ u8 filler_D10; /*0xD11*/ u8 filler_D11; /*0xD12*/ u8 filler_D12; /*0xD13*/ u8 filler_D13; /*0xD14*/ u16 field_D14[2]; - /*0xD18*/ u8 field_D18[0xB8]; + /*0xD18*/ u8 field_D18[0xB0]; + /*0xDC8*/ u16 field_DC8[2]; + /*0xDCC*/ u8 filler_DCC[4]; /*0xDD0*/ u16 field_DD0[2]; /*0xDD4*/ u16 field_DD4[2]; /*0xDD8*/ u16 field_DD8; - /*0xDDA*/ u16 field_DDA; - /*0xDDC*/ u16 field_DDC; + /*0xDDA*/ u16 field_DDA[2]; /*0xDDE*/ u16 field_DDE[2]; - /*0xDE2*/ u16 field_DE2; - /*0xDE4*/ u16 field_DE4; + /*0xDE2*/ u16 field_DE2[2]; /*0xDE6*/ u16 field_DE6; /*0xDE8*/ u16 field_DE8; /*0xDEA*/ u16 field_DEA[2]; @@ -387,11 +385,9 @@ struct BattleFrontier /*0xDFE*/ u16 field_DFE; /*0xE00*/ u16 field_E00; /*0xE02*/ u16 field_E02; - /*0xE04*/ u16 field_E04; - /*0xE06*/ u16 field_E06; + /*0xE04*/ u16 field_E04[2]; /*0xE08*/ u16 field_E08[9]; - /*0xE1A*/ u16 field_E1A; - /*0xE1C*/ u16 field_E1C; + /*0xE1A*/ u16 field_E1A[2]; /*0xE1E*/ u16 field_E1E[7]; /*0xE2C*/ struct PyramidBag pyramidBag; /*0xE58*/ u16 field_E58; diff --git a/include/menu.h b/include/menu.h index 888d898b6..0c191de57 100644 --- a/include/menu.h +++ b/include/menu.h @@ -51,7 +51,7 @@ void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void reset_temp_tile_data_buffers(void); void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode); bool8 free_temp_tile_data_buffers_if_possible(void); -struct WindowTemplate sub_8198A50(u8, u8, u8, u8, u8, u8, u16); +struct WindowTemplate CreateWindowTemplate(u8, u8, u8, u8, u8, u8, u16); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); void copy_decompressed_tile_data_to_vram_autofree(u8 bgId, const void *src, int size, u16 offset, u8 mode); s8 ProcessMenuInputNoWrap_(void); diff --git a/include/script_menu.h b/include/script_menu.h index 0555d0f78..c50bef00f 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -9,8 +9,9 @@ bool8 ScriptMenu_YesNo(u8 var1, u8 var2); bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 a4, u8 columnCount); bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3); bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void); -u8 convert_pixel_width_to_tile_width(s32); +s32 convert_pixel_width_to_tile_width(s32); u8 CreateWindowFromRect(u8, u8, u8, u8); void sub_80E2A78(u8); +u32 display_text_and_get_width(const u8*, u32); #endif //GUARD_SCRIPT_MENU_H diff --git a/include/strings.h b/include/strings.h index 3d3741a86..14ff0048f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -472,4 +472,179 @@ extern const u8 gText_BigGirl[]; extern const u8 gText_Son[]; extern const u8 gText_Daughter[]; +extern const u8 gText_1F[]; +extern const u8 gText_2F[]; +extern const u8 gText_3F[]; +extern const u8 gText_4F[]; +extern const u8 gText_5F[]; +extern const u8 gText_6F[]; +extern const u8 gText_7F[]; +extern const u8 gText_8F[]; +extern const u8 gText_9F[]; +extern const u8 gText_10F[]; +extern const u8 gText_11F[]; +extern const u8 gText_B1F[]; +extern const u8 gText_B2F[]; +extern const u8 gText_B3F[]; +extern const u8 gText_B4F[]; +extern const u8 gText_Rooftop[]; +extern const u8 gText_ElevatorNowOn[]; + +extern const u8 BattleFrontier_Lounge2_Text_260971[]; +extern const u8 BattleFrontier_Lounge2_Text_260A1E[]; +extern const u8 BattleFrontier_Lounge2_Text_260AE7[]; +extern const u8 BattleFrontier_Lounge2_Text_2619AC[]; +extern const u8 BattleFrontier_Lounge2_Text_261A91[]; +extern const u8 BattleFrontier_Lounge2_Text_261B0C[]; +extern const u8 BattleFrontier_Lounge2_Text_261B95[]; +extern const u8 BattleFrontier_Lounge2_Text_261B95[]; +extern const u8 BattleFrontier_Lounge2_Text_261B95[]; +extern const u8 BattleFrontier_Lounge2_Text_261C1A[]; +extern const u8 BattleFrontier_Lounge2_Text_261C1A[]; +extern const u8 BattleFrontier_Lounge2_Text_261C1A[]; +extern const u8 BattleFrontier_Lounge2_Text_260BC4[]; +extern const u8 BattleFrontier_Lounge2_Text_260C6D[]; +extern const u8 BattleFrontier_Lounge2_Text_260D3A[]; +extern const u8 BattleFrontier_Lounge2_Text_260E1E[]; +extern const u8 BattleFrontier_Lounge2_Text_260EC7[]; +extern const u8 BattleFrontier_Lounge2_Text_260F74[]; +extern const u8 BattleFrontier_Lounge2_Text_2614E6[]; +extern const u8 BattleFrontier_Lounge2_Text_261591[]; +extern const u8 BattleFrontier_Lounge2_Text_26166F[]; +extern const u8 BattleFrontier_Lounge2_Text_261282[]; +extern const u8 BattleFrontier_Lounge2_Text_261329[]; +extern const u8 BattleFrontier_Lounge2_Text_261403[]; +extern const u8 BattleFrontier_Lounge2_Text_261026[]; +extern const u8 BattleFrontier_Lounge2_Text_2610CC[]; +extern const u8 BattleFrontier_Lounge2_Text_261194[]; +extern const u8 BattleFrontier_Lounge2_Text_26174D[]; +extern const u8 BattleFrontier_Lounge2_Text_2617F9[]; +extern const u8 BattleFrontier_Lounge2_Text_2618C4[]; + +extern const u8 gText_Exit[]; + +extern const u8 gText_BlueFlute[]; +extern const u8 gText_YellowFlute[]; +extern const u8 gText_RedFlute[]; +extern const u8 gText_WhiteFlute[]; +extern const u8 gText_BlackFlute[]; +extern const u8 gText_PrettyChair[]; +extern const u8 gText_PrettyDesk[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_0Pts[]; +extern const u8 gText_10Pts[]; +extern const u8 gText_20Pts[]; +extern const u8 gText_30Pts[]; +extern const u8 gText_40Pts[]; +extern const u8 gText_50Pts[]; +extern const u8 gText_60Pts[]; +extern const u8 gText_70Pts[]; +extern const u8 gText_80Pts[]; +extern const u8 gText_90Pts[]; +extern const u8 gText_100Pts[]; +extern const u8 gText_QuestionMark[]; + +extern const u8 gText_KissPoster16BP[]; +extern const u8 gText_KissCushion32BP[]; +extern const u8 gText_SmoochumDoll32BP[]; +extern const u8 gText_TogepiDoll48BP[]; +extern const u8 gText_MeowthDoll48BP[]; +extern const u8 gText_ClefairyDoll48BP[]; +extern const u8 gText_DittoDoll48BP[]; +extern const u8 gText_CyndaquilDoll80BP[]; +extern const u8 gText_ChikoritaDoll80BP[]; +extern const u8 gText_TotodileDoll80BP[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_LaprasDoll128BP[]; +extern const u8 gText_SnorlaxDoll128BP[]; +extern const u8 gText_VenusaurDoll256BP[]; +extern const u8 gText_CharizardDoll256BP[]; +extern const u8 gText_BlastoiseDoll256BP[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_Protein1BP[]; +extern const u8 gText_Calcium1BP[]; +extern const u8 gText_Iron1BP[]; +extern const u8 gText_Zinc1BP[]; +extern const u8 gText_Carbos1BP[]; +extern const u8 gText_HpUp1BP[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_Leftovers48BP[]; +extern const u8 gText_WhiteHerb48BP[]; +extern const u8 gText_QuickClaw48BP[]; +extern const u8 gText_MentalHerb48BP[]; +extern const u8 gText_BrightPowder64BP[]; +extern const u8 gText_ChoiceBand64BP[]; +extern const u8 gText_KingsRock64BP[]; +extern const u8 gText_FocusBand64BP[]; +extern const u8 gText_ScopeLens64BP[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_EnergyPowder50[]; +extern const u8 gText_EnergyRoot80[]; +extern const u8 gText_HealPowder50[]; +extern const u8 gText_RevivalHerb300[]; +extern const u8 gText_Protein1000[]; +extern const u8 gText_Iron1000[]; +extern const u8 gText_Carbos1000[]; +extern const u8 gText_Calcium1000[]; +extern const u8 gText_Zinc1000[]; +extern const u8 gText_HPUp1000[]; +extern const u8 gText_PPUp3000[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_BattleTower2[]; +extern const u8 gText_BattleDome[]; +extern const u8 gText_BattlePalace[]; +extern const u8 gText_BattleArena[]; +extern const u8 gText_BattleFactory[]; +extern const u8 gText_BattlePike[]; +extern const u8 gText_BattlePyramid[]; +extern const u8 gText_RankingHall[]; +extern const u8 gText_ExchangeService[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_Softboiled16BP[]; +extern const u8 gText_SeismicToss24BP[]; +extern const u8 gText_DreamEater24BP[]; +extern const u8 gText_MegaPunch24BP[]; +extern const u8 gText_MegaKick48BP[]; +extern const u8 gText_BodySlam48BP[]; +extern const u8 gText_RockSlide48BP[]; +extern const u8 gText_Counter48BP[]; +extern const u8 gText_ThunderWave48BP[]; +extern const u8 gText_SwordsDance48BP[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_DefenseCurl16BP[]; +extern const u8 gText_Snore24BP[]; +extern const u8 gText_MudSlap24BP[]; +extern const u8 gText_Swift24BP[]; +extern const u8 gText_IcyWind24BP[]; +extern const u8 gText_Endure48BP[]; +extern const u8 gText_PsychUp48BP[]; +extern const u8 gText_IcePunch48BP[]; +extern const u8 gText_ThunderPunch48BP[]; +extern const u8 gText_FirePunch48BP[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_SlateportCity[]; +extern const u8 gText_BattleFrontier[]; +extern const u8 gText_SouthernIsland[]; +extern const u8 gText_NavelRock[]; +extern const u8 gText_BirthIsland[]; +extern const u8 gText_FarawayIsland[]; +extern const u8 gText_Exit[]; + +extern const u8 gText_BattleTrainers[]; +extern const u8 gText_BattleBasics[]; +extern const u8 gText_PokemonNature[]; +extern const u8 gText_PokemonMoves[]; +extern const u8 gText_Underpowered[]; +extern const u8 gText_WhenInDanger[]; +extern const u8 gText_Exit[]; + #endif //GUARD_STRINGS_H diff --git a/src/field_specials.c b/src/field_specials.c index a0d640ccd..5f4b4f784 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -13,16 +13,22 @@ #include "field_region_map.h" #include "field_specials.h" #include "field_weather.h" +#include "international_string_util.h" #include "link.h" +#include "list_menu.h" +#include "malloc.h" +#include "menu.h" #include "overworld.h" #include "party_menu.h" #include "pokeblock.h" #include "pokemon.h" #include "pokemon_storage_system.h" +#include "random.h" #include "region_map.h" #include "rom_8011DC0.h" #include "rtc.h" #include "script.h" +#include "script_menu.h" #include "sound.h" #include "starter_choose.h" #include "string_util.h" @@ -31,6 +37,7 @@ #include "text.h" #include "tv.h" #include "wallclock.h" +#include "window.h" #include "constants/event_objects.h" #include "constants/items.h" #include "constants/maps.h" @@ -44,6 +51,18 @@ EWRAM_DATA u8 gBikeCollisions = 0; EWRAM_DATA u32 gBikeCyclingTimer = 0; EWRAM_DATA u8 gUnknown_0203AB5C = 0; EWRAM_DATA u8 gUnknown_0203AB5D = 0; +EWRAM_DATA u8 gUnknown_0203AB5E = 0; +EWRAM_DATA u16 gUnknown_0203AB60 = 0; +EWRAM_DATA u16 gUnknown_0203AB62 = 0; +EWRAM_DATA struct ListMenuItem *gUnknown_0203AB64 = NULL; +EWRAM_DATA u16 gUnknown_0203AB68 = 0; +EWRAM_DATA u16 gUnknown_0203AB6A = 0; +EWRAM_DATA u8 gUnknown_0203AB6C = 0; +EWRAM_DATA u8 gUnknown_0203AB6D = 0; +EWRAM_DATA u8 gUnknown_0203AB6E = 0; +EWRAM_DATA u8 gUnknown_0203AB6F = 0; + +struct ListMenuTemplate gUnknown_030061D0; extern const u16 gEventObjectPalette8[]; extern const u16 gEventObjectPalette17[]; @@ -1626,6 +1645,44 @@ void sub_8139980(void) SetCameraPanning(8, 0); } +void sub_8139AF4(u8 taskId); +void sub_8139C2C(u16 a1, u8 a2); + +const struct WindowTemplate gUnknown_085B2BAC = { + .priority = 0, + .tilemapLeft = 21, + .tilemapTop = 1, + .width = 8, + .height = 4, + .paletteNum = 15, + .baseBlock = 8, +}; + +const u8 *const gElevatorFloorsTable[] = { + gText_B4F, + gText_B3F, + gText_B2F, + gText_B1F, + gText_1F, + gText_2F, + gText_3F, + gText_4F, + gText_5F, + gText_6F, + gText_7F, + gText_8F, + gText_9F, + gText_10F, + gText_11F, + gText_Rooftop +}; + +const u16 gUnknown_085B2BF4[] = { 0x0329, 0x032a, 0x032b, 0x0331, 0x0332, 0x0333, 0x0339, 0x033a, 0x033b }; +const u16 gUnknown_085B2C06[] = { 0x0329, 0x032b, 0x032a, 0x0331, 0x0333, 0x0332, 0x0339, 0x033b, 0x033a }; +const u8 gUnknown_085B2C18[] = { 0x08, 0x10, 0x18, 0x20, 0x26, 0x2e, 0x34, 0x38, 0x39 }; +const u8 gUnknown_085B2C21[] = { 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b }; +const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff }; + void SetDepartmentStoreFloorVar(void) { u8 deptStoreFloor; @@ -1655,3 +1712,1007 @@ void SetDepartmentStoreFloorVar(void) } VarSet(VAR_DEPT_STORE_FLOOR, deptStoreFloor); } + +u16 sub_81399F4(void) +{ + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 0; + + if (gSaveBlock1Ptr->warp2.mapGroup == 13) + { + switch (gSaveBlock1Ptr->warp2.mapNum) + { + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 0; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 1; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 2; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 3; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 4; + break; + } + } + + return gUnknown_0203AB62; +} + +void ShakeScreenInElevator(void) +{ + s16 *data = gTasks[CreateTask(sub_8139AF4, 9)].data; + u16 floorDelta; + + data[1] = 0; + data[2] = 0; + data[4] = 1; + + if (gSpecialVar_0x8005 > gSpecialVar_0x8006) + { + floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006; + data[6] = 1; + } + else + { + floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005; + data[6] = 0; + } + + if (floorDelta > 8) + floorDelta = 8; + + data[5] = gUnknown_085B2C18[floorDelta]; + + SetCameraPanningCallback(NULL); + sub_8139C2C(floorDelta, data[6]); + PlaySE(SE_ELEBETA); +} + +void sub_8139AF4(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1]++; + if (data[1] % 3 == 0) + { + data[1] = 0; + data[2]++; + data[4] = -data[4]; + SetCameraPanning(0, data[4]); + if (data[2] == data[5]) + { + PlaySE(SE_PINPON); + DestroyTask(taskId); + EnableBothScriptContexts(); + InstallCameraPanAheadCallback(); + } + } +} + +void sub_8139B60(void) +{ + int xPos; + + gUnknown_0203AB5E = AddWindow(&gUnknown_085B2BAC); + SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + + xPos = GetStringCenterAlignXOffset(1, gText_ElevatorNowOn, 64); + PrintTextOnWindow(gUnknown_0203AB5E, 1, gText_ElevatorNowOn, xPos, 1, 0xFF, NULL); + + xPos = GetStringCenterAlignXOffset(1, gElevatorFloorsTable[gSpecialVar_0x8005], 64); + PrintTextOnWindow(gUnknown_0203AB5E, 1, gElevatorFloorsTable[gSpecialVar_0x8005], xPos, 17, 0xFF, NULL); + + PutWindowTilemap(gUnknown_0203AB5E); + CopyWindowToVram(gUnknown_0203AB5E, 3); +} + +void sub_8139C10(void) +{ + sub_8198070(gUnknown_0203AB5E, TRUE); + RemoveWindow(gUnknown_0203AB5E); +} + +void sub_8139C80(u8 taskId); + +void sub_8139C2C(u16 a1, u8 a2) +{ + if (FuncIsActiveTask(sub_8139C80) != TRUE) + { + u8 taskId = CreateTask(sub_8139C80, 8); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = a2; + gTasks[taskId].data[3] = gUnknown_085B2C21[a1]; + } +} + +// Annoyingly close but compiler wants to add all the parts of the index into the arrays +// first and then shift by one, whereas we need each individual part to shift and then be added. +#ifdef NONMATCHING +void sub_8139C80(u8 taskId) +{ + u8 x, y; + s16 *data = gTasks[taskId].data; + + if (data[1] == 6) + { + data[0]++; + if (data[2] == 0) + { + for (y = 0; y < 3; y++) + { + for (x = 0; x < 3; x++) + { + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y * 3 + data[0] % 3] | 0xC00); + } + } + } + else + { + for (y = 0; y < 3; y++) + { + for (x = 0; x < 3; x++) + { + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y * 3 + data[0] % 3] | 0xC00); + } + } + } + DrawWholeMapView(); + data[1] = 0; + if (data[0] == data[3]) + { + DestroyTask(taskId); + } + } + data[1]++; +} +#else +NAKED +void sub_8139C80(u8 taskId) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x4\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp]\n\ + lsls r0, 2\n\ + ldr r1, [sp]\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + ldr r1, =gTasks + 0x8\n\ + adds r6, r0, r1\n\ + movs r2, 0x2\n\ + ldrsh r0, [r6, r2]\n\ + cmp r0, 0x6\n\ + bne _08139D7C\n\ + ldrh r0, [r6]\n\ + adds r0, 0x1\n\ + strh r0, [r6]\n\ + movs r1, 0x4\n\ + ldrsh r0, [r6, r1]\n\ + cmp r0, 0\n\ + bne _08139D10\n\ + movs r1, 0\n\ + ldr r2, =gUnknown_085B2BF4\n\ + mov r10, r2\n\ +_08139CBA:\n\ + movs r5, 0\n\ + adds r7, r1, 0x7\n\ + lsls r0, r1, 1\n\ + adds r2, r1, 0x1\n\ + mov r8, r2\n\ + adds r0, r1\n\ + lsls r0, 1\n\ + mov r9, r0\n\ +_08139CCA:\n\ + adds r4, r5, 0\n\ + adds r4, 0x8\n\ + movs r1, 0\n\ + ldrsh r0, [r6, r1]\n\ + movs r1, 0x3\n\ + bl __modsi3\n\ + lsls r0, 16\n\ + asrs r0, 15\n\ + add r0, r9\n\ + add r0, r10\n\ + ldrh r0, [r0]\n\ + movs r1, 0xC0\n\ + lsls r1, 4\n\ + adds r2, r1, 0\n\ + orrs r2, r0\n\ + adds r0, r4, 0\n\ + adds r1, r7, 0\n\ + bl MapGridSetMetatileIdAt\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x2\n\ + bls _08139CCA\n\ + mov r2, r8\n\ + lsls r0, r2, 24\n\ + lsrs r1, r0, 24\n\ + cmp r1, 0x2\n\ + bls _08139CBA\n\ + b _08139D62\n\ + .pool\n\ +_08139D10:\n\ + movs r1, 0\n\ + ldr r0, =gUnknown_085B2C06\n\ + mov r10, r0\n\ +_08139D16:\n\ + movs r5, 0\n\ + adds r7, r1, 0x7\n\ + lsls r0, r1, 1\n\ + adds r2, r1, 0x1\n\ + mov r8, r2\n\ + adds r0, r1\n\ + lsls r0, 1\n\ + mov r9, r0\n\ +_08139D26:\n\ + adds r4, r5, 0\n\ + adds r4, 0x8\n\ + movs r1, 0\n\ + ldrsh r0, [r6, r1]\n\ + movs r1, 0x3\n\ + bl __modsi3\n\ + lsls r0, 16\n\ + asrs r0, 15\n\ + add r0, r9\n\ + add r0, r10\n\ + ldrh r0, [r0]\n\ + movs r1, 0xC0\n\ + lsls r1, 4\n\ + adds r2, r1, 0\n\ + orrs r2, r0\n\ + adds r0, r4, 0\n\ + adds r1, r7, 0\n\ + bl MapGridSetMetatileIdAt\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x2\n\ + bls _08139D26\n\ + mov r2, r8\n\ + lsls r0, r2, 24\n\ + lsrs r1, r0, 24\n\ + cmp r1, 0x2\n\ + bls _08139D16\n\ +_08139D62:\n\ + bl DrawWholeMapView\n\ + movs r0, 0\n\ + strh r0, [r6, 0x2]\n\ + movs r0, 0\n\ + ldrsh r1, [r6, r0]\n\ + movs r2, 0x6\n\ + ldrsh r0, [r6, r2]\n\ + cmp r1, r0\n\ + bne _08139D7C\n\ + ldr r0, [sp]\n\ + bl DestroyTask\n\ +_08139D7C:\n\ + ldrh r0, [r6, 0x2]\n\ + adds r0, 0x1\n\ + strh r0, [r6, 0x2]\n\ + add sp, 0x4\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NAKED + +void sub_8139D98(void) +{ + u8 i; + u32 ivStorage[6]; + + ivStorage[0] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV); + ivStorage[1] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV); + ivStorage[2] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV); + ivStorage[3] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV); + ivStorage[4] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV); + ivStorage[5] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV); + + gSpecialVar_0x8005 = 0; + + for (i = 0; i < ARRAY_COUNT(ivStorage); i++) + { + gSpecialVar_0x8005 += ivStorage[i]; + } + + gSpecialVar_0x8006 = 0; + gSpecialVar_0x8007 = ivStorage[0]; // HP IV + + for (i = 1; i < 6; i++) + { + if (ivStorage[gSpecialVar_0x8006] < ivStorage[i]) + { + gSpecialVar_0x8006 = i; + gSpecialVar_0x8007 = ivStorage[i]; + } + else if (ivStorage[gSpecialVar_0x8006] == ivStorage[i]) + { + u16 randomNumber = Random(); + if ((randomNumber & 1) != 0) + { + gSpecialVar_0x8006 = i; + gSpecialVar_0x8007 = ivStorage[i]; + } + } + } +} + +bool32 warp0_in_pokecenter(void) +{ + int i; + u16 map = (gUnknown_020322DC.mapGroup << 8) + gUnknown_020322DC.mapNum; + + for (i = 0; gUnknown_085B2C2A[i] != 0xFFFF; i++) + { + if (gUnknown_085B2C2A[i] == map) + return TRUE; + } + + return FALSE; +} + +bool32 sub_8139ED0(void) +{ + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_HILL_ENTRANCE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_HILL_ENTRANCE)) + { + return FALSE; + } + return TRUE; +} + +void UpdateFrontierManiac(u16 a0) +{ + u16 *var = GetVarPointer(VAR_FRONTIER_MANIAC_FACILITY); + *var += a0; + *var %= 10; +} + +const u8 *const gUnknown_085B2C50[][3] = { + { BattleFrontier_Lounge2_Text_260971, BattleFrontier_Lounge2_Text_260A1E, BattleFrontier_Lounge2_Text_260AE7 }, + { BattleFrontier_Lounge2_Text_2619AC, BattleFrontier_Lounge2_Text_261A91, BattleFrontier_Lounge2_Text_261B0C }, + { BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95 }, + { BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A }, + { BattleFrontier_Lounge2_Text_260BC4, BattleFrontier_Lounge2_Text_260C6D, BattleFrontier_Lounge2_Text_260D3A }, + { BattleFrontier_Lounge2_Text_260E1E, BattleFrontier_Lounge2_Text_260EC7, BattleFrontier_Lounge2_Text_260F74 }, + { BattleFrontier_Lounge2_Text_2614E6, BattleFrontier_Lounge2_Text_261591, BattleFrontier_Lounge2_Text_26166F }, + { BattleFrontier_Lounge2_Text_261282, BattleFrontier_Lounge2_Text_261329, BattleFrontier_Lounge2_Text_261403 }, + { BattleFrontier_Lounge2_Text_261026, BattleFrontier_Lounge2_Text_2610CC, BattleFrontier_Lounge2_Text_261194 }, + { BattleFrontier_Lounge2_Text_26174D, BattleFrontier_Lounge2_Text_2617F9, BattleFrontier_Lounge2_Text_2618C4 }, +}; + +const u8 gUnknown_085B2CC8[][2] = { + { 0x15, 0x38 }, + { 0x15, 0x23 }, + { 0xff, 0xff }, + { 0xff, 0xff }, + { 0x02, 0x04 }, + { 0x07, 0x15 }, + { 0x07, 0x15 }, + { 0x0e, 0x1c }, + { 0x0d, 0x70 }, + { 0x07, 0x38 } +}; + +void sub_8139F20(void) +{ + u8 i; + u16 unk = 0; + u16 var = VarGet(VAR_FRONTIER_MANIAC_FACILITY); + switch (var) + { + case 0: + case 1: + case 2: + case 3: + if (gSaveBlock2Ptr->frontier.field_CE0[var][0] >= gSaveBlock2Ptr->frontier.field_CE0[var][1]) + { + unk = gSaveBlock2Ptr->frontier.field_CE0[var][0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_CE0[var][1]; + } + break; + case 4: + if (gSaveBlock2Ptr->frontier.field_D0C[0] >= gSaveBlock2Ptr->frontier.field_D0C[1]) + { + unk = gSaveBlock2Ptr->frontier.field_D0C[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_D0C[1]; + } + break; + case 5: + if (gSaveBlock2Ptr->frontier.field_DE2[0] >= gSaveBlock2Ptr->frontier.field_DE2[1]) + { + unk = gSaveBlock2Ptr->frontier.field_DE2[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_DE2[1]; + } + break; + case 6: + if (gSaveBlock2Ptr->frontier.field_DC8[0] >= gSaveBlock2Ptr->frontier.field_DC8[1]) + { + unk = gSaveBlock2Ptr->frontier.field_DC8[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_DC8[1]; + } + break; + case 7: + if (gSaveBlock2Ptr->frontier.field_DDA[0] >= gSaveBlock2Ptr->frontier.field_DDA[1]) + { + unk = gSaveBlock2Ptr->frontier.field_DDA[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_DDA[1]; + } + break; + case 8: + if (gSaveBlock2Ptr->frontier.field_E04[0] >= gSaveBlock2Ptr->frontier.field_E04[1]) + { + unk = gSaveBlock2Ptr->frontier.field_E04[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_E04[1]; + } + break; + case 9: + if (gSaveBlock2Ptr->frontier.field_E1A[0] >= gSaveBlock2Ptr->frontier.field_E1A[1]) + { + unk = gSaveBlock2Ptr->frontier.field_E1A[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_E1A[1]; + } + break; + } + + for (i = 0; i < 2 && gUnknown_085B2CC8[var][i] < unk; i++); + + ShowFieldMessage(gUnknown_085B2C50[var][i]); +} + +const u16 gUnknown_085B2CDC[] = { + 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 +}; + +void sub_813A080(void) +{ + u8 i; + u16 var = VarGet(VAR_0x40CE); + u8 chosenLevel = gSaveBlock2Ptr->frontier.chosenLvl; + + if (var == 2 && !FlagGet(FLAG_0x152)) + { + gSpecialVar_0x8005 = 5; + gSpecialVar_0x8006 = 4; + return; + } + + for (i = 0; i < 9; i++) + { + if (gUnknown_085B2CDC[i] > gSaveBlock2Ptr->frontier.field_CE0[var][chosenLevel]) + { + gSpecialVar_0x8005 = 4; + gSpecialVar_0x8006 = i + 5; + return; + } + } + + gSpecialVar_0x8005 = 4; + gSpecialVar_0x8006 = 12; +} + +void sub_813A2DC(u8 taskId); + +void sub_813A128(void) +{ + u8 taskId = CreateTask(sub_813A2DC, 8); + struct Task *task = &gTasks[taskId]; + task->data[11] = gSpecialVar_0x8004; + + switch (gSpecialVar_0x8004) + { + case 0: + task->data[0] = 1; + task->data[1] = 1; + task->data[2] = 1; + task->data[3] = 1; + task->data[4] = 1; + task->data[5] = 1; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 1: + task->data[0] = 5; + task->data[1] = 8; + task->data[2] = 1; + task->data[3] = 1; + task->data[4] = 9; + task->data[5] = 10; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 2: + task->data[0] = 6; + task->data[1] = 12; + task->data[2] = 1; + task->data[3] = 1; + task->data[4] = 7; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 3: + task->data[0] = 6; + task->data[1] = 11; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 4: + task->data[0] = 6; + task->data[1] = 6; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 5: + task->data[0] = 6; + task->data[1] = 7; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 6: + task->data[0] = 6; + task->data[1] = 10; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 7: + task->data[0] = 6; + task->data[1] = 12; + task->data[2] = 15; + task->data[3] = 1; + task->data[4] = 14; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 8: + task->data[0] = 6; + task->data[1] = 10; + task->data[2] = 17; + task->data[3] = 1; + task->data[4] = 11; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 9: + case 10: + task->data[0] = 6; + task->data[1] = 11; + task->data[2] = 15; + task->data[3] = 1; + task->data[4] = 14; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 11: + task->data[0] = 6; + task->data[1] = 7; + task->data[2] = 19; + task->data[3] = 1; + task->data[4] = 10; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 12: + task->data[0] = 6; + task->data[1] = 7; + task->data[2] = 17; + task->data[3] = 1; + task->data[4] = 12; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + default: + gSpecialVar_Result = 0x7F; + DestroyTask(taskId); + break; + } +} + +void sub_813AA60(u16 a0, u16 a1); +void sub_813ACE8(u8 a0, u16 a1); +void sub_813A42C(void); + +const u8 *const gUnknown_085B2CF0[][16] = { + { + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_BlueFlute, + gText_YellowFlute, + gText_RedFlute, + gText_WhiteFlute, + gText_BlackFlute, + gText_PrettyChair, + gText_PrettyDesk, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_0Pts, + gText_10Pts, + gText_20Pts, + gText_30Pts, + gText_40Pts, + gText_50Pts, + gText_60Pts, + gText_70Pts, + gText_80Pts, + gText_90Pts, + gText_100Pts, + gText_QuestionMark, + NULL, + NULL, + NULL, + NULL + }, + { + gText_KissPoster16BP, + gText_KissCushion32BP, + gText_SmoochumDoll32BP, + gText_TogepiDoll48BP, + gText_MeowthDoll48BP, + gText_ClefairyDoll48BP, + gText_DittoDoll48BP, + gText_CyndaquilDoll80BP, + gText_ChikoritaDoll80BP, + gText_TotodileDoll80BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_LaprasDoll128BP, + gText_SnorlaxDoll128BP, + gText_VenusaurDoll256BP, + gText_CharizardDoll256BP, + gText_BlastoiseDoll256BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_Protein1BP, + gText_Calcium1BP, + gText_Iron1BP, + gText_Zinc1BP, + gText_Carbos1BP, + gText_HpUp1BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_Leftovers48BP, + gText_WhiteHerb48BP, + gText_QuickClaw48BP, + gText_MentalHerb48BP, + gText_BrightPowder64BP, + gText_ChoiceBand64BP, + gText_KingsRock64BP, + gText_FocusBand64BP, + gText_ScopeLens64BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_EnergyPowder50, + gText_EnergyRoot80, + gText_HealPowder50, + gText_RevivalHerb300, + gText_Protein1000, + gText_Iron1000, + gText_Carbos1000, + gText_Calcium1000, + gText_Zinc1000, + gText_HPUp1000, + gText_PPUp3000, + gText_Exit, + NULL, + NULL, + NULL, + NULL + }, + { + gText_BattleTower2, + gText_BattleDome, + gText_BattlePalace, + gText_BattleArena, + gText_BattleFactory, + gText_BattlePike, + gText_BattlePyramid, + gText_RankingHall, + gText_ExchangeService, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_Softboiled16BP, + gText_SeismicToss24BP, + gText_DreamEater24BP, + gText_MegaPunch24BP, + gText_MegaKick48BP, + gText_BodySlam48BP, + gText_RockSlide48BP, + gText_Counter48BP, + gText_ThunderWave48BP, + gText_SwordsDance48BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_DefenseCurl16BP, + gText_Snore24BP, + gText_MudSlap24BP, + gText_Swift24BP, + gText_IcyWind24BP, + gText_Endure48BP, + gText_PsychUp48BP, + gText_IcePunch48BP, + gText_ThunderPunch48BP, + gText_FirePunch48BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_SlateportCity, + gText_BattleFrontier, + gText_SouthernIsland, + gText_NavelRock, + gText_BirthIsland, + gText_FarawayIsland, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_BattleTrainers, + gText_BattleBasics, + gText_PokemonNature, + gText_PokemonMoves, + gText_Underpowered, + gText_WhenInDanger, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } +}; + +void sub_813A4EC(u8 taskId); +void sub_813A694(u8 taskId); + +void sub_813A2DC(u8 taskId) +{ + u32 unk1; + u8 i, windowId; + struct WindowTemplate template; + struct Task *task = &gTasks[taskId]; + + ScriptContext2_Enable(); + gUnknown_0203AB68 = 0; + gUnknown_0203AB6C = 0x40; + sub_813AA60(task->data[11], 0); + sub_813ACE8(task->data[11], 0); + gUnknown_0203AB64 = AllocZeroed(task->data[1] * 8); + gUnknown_0203AB6A = 0; + sub_813A42C(); + + for (unk1 = 0, i = 0; i < task->data[1]; i++) + { + const u8 *text = gUnknown_085B2CF0[gSpecialVar_0x8004][i]; + gUnknown_0203AB64[i].name = text; + gUnknown_0203AB64[i].id = i; + unk1 = display_text_and_get_width(text, unk1); + } + + task->data[4] = convert_pixel_width_to_tile_width(unk1); + + if (task->data[2] + task->data[4] > 0x1D) + { + int unk2 = 0x1D - task->data[4]; + if (unk2 < 0) + { + task->data[2] = 0; + } + else + { + task->data[2] = unk2; + } + } + + template = CreateWindowTemplate(0, task->data[2], task->data[3], task->data[4], task->data[5], 0xF, 0x64); + windowId = AddWindow(&template); + task->data[13] = windowId; + SetStandardWindowBorderStyle(windowId, 0); + + gUnknown_030061D0.totalItems = task->data[1]; + gUnknown_030061D0.maxShowed = task->data[0]; + gUnknown_030061D0.windowId = task->data[13]; + + sub_813A694(taskId); + task->data[14] = ListMenuInit(&gUnknown_030061D0, task->data[7], task->data[8]); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = sub_813A4EC; +} + +void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list); + +void sub_813A42C(void) +{ + gUnknown_030061D0.items = gUnknown_0203AB64; + gUnknown_030061D0.moveCursorFunc = sub_813A46C; + gUnknown_030061D0.itemPrintFunc = NULL; + gUnknown_030061D0.totalItems = 1; + gUnknown_030061D0.maxShowed = 1; + gUnknown_030061D0.windowId = 0; + gUnknown_030061D0.header_X = 0; + gUnknown_030061D0.item_X = 8; + gUnknown_030061D0.cursor_X = 0; + gUnknown_030061D0.upText_Y = 1; + gUnknown_030061D0.cursorPal = 2; + gUnknown_030061D0.fillValue = 1; + gUnknown_030061D0.cursorShadowPal = 3; + gUnknown_030061D0.lettersSpacing = 0; + gUnknown_030061D0.itemVerticalPadding = 0; + gUnknown_030061D0.scrollMultiple = 0; + gUnknown_030061D0.fontId = 1; + gUnknown_030061D0.cursorKind = 0; +} + +void sub_813A4EC(u8 taskId); +void sub_813AA60(u16 a0, u16 a1); +void sub_813AC44(u16 a0, u16 a1); +void sub_813AD34(u8 a0, u16 a1); + +void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) +{ + u8 taskId; + PlaySE(SE_SELECT); + taskId = FindTaskIdByFunc(sub_813A4EC); + if (taskId != 0xFF) + { + u16 misc; + struct Task *task = &gTasks[taskId]; + ListMenuGetScrollAndRow(task->data[14], &misc, NULL); + gUnknown_0203AB68 = misc; + ListMenuGetCurrentItemArrayId(task->data[14], &misc); + sub_813AC44(task->data[11], gUnknown_0203AB6A); + sub_813AA60(task->data[11], misc); + sub_813AD34(task->data[11], misc); + gUnknown_0203AB6A = misc; + } +} diff --git a/src/main_menu.c b/src/main_menu.c index 87673c9b2..3afe1abe5 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1965,7 +1965,7 @@ void sub_80323CC(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f) { struct WindowTemplate sp; - sp = sub_8198A50(0, a + 1, b + 1, 5, 4, f, d); + sp = CreateWindowTemplate(0, a + 1, b + 1, 5, 4, f, d); CreateYesNoMenu(&sp, c, e, 0); } diff --git a/src/menu.c b/src/menu.c index 96dda3075..223f8fd52 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1143,7 +1143,7 @@ void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 template->baseBlock = baseBlock; } -struct WindowTemplate sub_8198A50(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) +struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) { struct WindowTemplate template; SetWindowTemplateFields(&template, bg, left, top, width, height, paletteNum, baseBlock); diff --git a/src/scrcmd.c b/src/scrcmd.c index a15ad666c..01d04704a 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1515,7 +1515,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) xText = (xWindow - xText - 1) * 8 + 3; yText = (yText - yWindow - 1) * 8; - winTemplate = sub_8198A50(0, xWindow, yWindow + 1, width, height, 0xF, 0x1); + winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1); gUnknown_03000F30 = AddWindow(&winTemplate); LoadUserWindowBorderGfx(gUnknown_03000F30, 0x214, 0xE0); NewMenuHelpers_DrawStdWindowFrame(gUnknown_03000F30, 0); diff --git a/sym_common.txt b/sym_common.txt index 3fa302968..0158b7615 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -91,8 +91,7 @@ gUnknown_030061C0: @ 30061C0 gUnknown_030061C4: @ 30061C4 .space 0xC -gUnknown_030061D0: @ 30061D0 - .space 0x18 + .include "field_specials.o" gCB2_AfterEvolution: @ 30061E8 .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 1832e2240..34c9658e8 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -605,36 +605,6 @@ gPlayerFacingPosition: @ 203AB40 .include "src/pokeblock.o" .include "src/field_specials.o" -gUnknown_0203AB5E: @ 203AB5E - .space 0x2 - -gUnknown_0203AB60: @ 203AB60 - .space 0x2 - -gUnknown_0203AB62: @ 203AB62 - .space 0x2 - -gUnknown_0203AB64: @ 203AB64 - .space 0x4 - -gUnknown_0203AB68: @ 203AB68 - .space 0x2 - -gUnknown_0203AB6A: @ 203AB6A - .space 0x2 - -gUnknown_0203AB6C: @ 203AB6C - .space 0x1 - -gUnknown_0203AB6D: @ 203AB6D - .space 0x1 - -gUnknown_0203AB6E: @ 203AB6E - .space 0x1 - -gUnknown_0203AB6F: @ 203AB6F - .space 0x1 - gUnknown_0203AB70: @ 203AB70 .space 0x4