diff --git a/asm/party_menu.s b/asm/party_menu.s index bbb36b109..27ad74541 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -6700,7 +6700,7 @@ _081B3774: _081B3778: lsls r0, 24 lsrs r4, r0, 24 - bl GetMenuCursorPos + bl Menu_GetCursorPos lsls r0, 24 lsrs r0, 24 strh r0, [r5] @@ -9914,7 +9914,7 @@ sub_81B5470: @ 81B5470 push {r4-r7,lr} lsls r0, 24 lsrs r6, r0, 24 - bl GetMenuCursorPos + bl Menu_GetCursorPos ldr r5, =gUnknown_0203CEC4 ldr r1, [r5] lsls r0, 24 @@ -12639,7 +12639,7 @@ ether_effect_related_2: @ 81B6B80 ldr r0, [r0] adds r0, 0xC bl sub_81B302C - bl GetMenuCursorPos + bl Menu_GetCursorPos ldr r1, =gUnknown_0203CEC8 lsls r0, 24 lsrs r0, 24 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index b6822eeac..38bb6ce8e 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -7,3049 +7,6 @@ - thumb_func_start sub_80CE760 -sub_80CE760: @ 80CE760 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE77A - ldr r0, =gUnknown_02039D14 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x000020a4 - adds r1, r2 - movs r2, 0x64 - bl memcpy -_080CE77A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE760 - - thumb_func_start sub_80CE790 -sub_80CE790: @ 80CE790 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE7D8 - ldr r0, =sMovingMonOrigBoxId - ldrb r0, [r0] - cmp r0, 0xE - bne _080CE7C8 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r1, =gUnknown_02039D14 - movs r2, 0x64 - bl memcpy - b _080CE7D8 - .pool -_080CE7C8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000020a4 - adds r0, r1 - ldr r1, =gUnknown_02039D14 - movs r2, 0x50 - bl memcpy -_080CE7D8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE790 - - thumb_func_start sub_80CE7E8 -sub_80CE7E8: @ 80CE7E8 - push {r4,r5,lr} - ldr r0, =sIsMonBeingMoved - ldrb r5, [r0] - cmp r5, 0 - beq _080CE838 - bl sub_80CE760 - ldr r3, =gUnknown_02039D08 - ldr r1, [r3] - ldr r0, =0x0000218c - adds r2, r1, r0 - ldr r0, =gUnknown_02039D14 - str r0, [r2] - ldr r2, =0x00002187 - adds r1, r2 - movs r2, 0 - strb r2, [r1] - ldr r0, [r3] - ldr r4, =0x00002186 - adds r0, r4 - strb r2, [r0] - ldr r0, [r3] - ldr r1, =0x00002188 - adds r0, r1 - strb r2, [r0] - b _080CE8CA - .pool -_080CE838: - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CE894 - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r0, =0x0000218c - adds r2, r1, r0 - ldr r0, =gPlayerParty - str r0, [r2] - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - ldr r2, =0x00002187 - adds r1, r2 - strb r0, [r1] - bl CountPartyMons - ldr r1, [r4] - subs r0, 0x1 - ldr r2, =0x00002186 - adds r1, r2 - strb r0, [r1] - ldr r0, [r4] - ldr r4, =0x00002188 - adds r0, r4 - strb r5, [r0] - b _080CE8CA - .pool -_080CE894: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl GetBoxedMonPtr - ldr r3, =gUnknown_02039D08 - ldr r2, [r3] - ldr r4, =0x0000218c - adds r1, r2, r4 - str r0, [r1] - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - ldr r1, =0x00002187 - adds r2, r1 - strb r0, [r2] - ldr r0, [r3] - ldr r2, =0x00002186 - adds r0, r2 - movs r1, 0x1D - strb r1, [r0] - ldr r0, [r3] - subs r4, 0x4 - adds r0, r4 - movs r1, 0x2 - strb r1, [r0] -_080CE8CA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE7E8 - - thumb_func_start sub_80CE8E4 -sub_80CE8E4: @ 80CE8E4 - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE8F8 - bl sub_80CE790 - b _080CE900 - .pool -_080CE8F8: - ldr r0, =sBoxCursorPosition - ldr r1, =gUnknown_0203CF20 - ldrb r1, [r1] - strb r1, [r0] -_080CE900: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE8E4 - - thumb_func_start CompactPartySlots -CompactPartySlots: @ 80CE90C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r7, =0x0000ffff - movs r6, 0 - movs r5, 0 - movs r0, 0x64 - mov r9, r0 - ldr r1, =gPlayerParty - mov r8, r1 - subs r0, 0x65 - mov r10, r0 -_080CE928: - mov r0, r9 - muls r0, r6 - mov r1, r8 - adds r4, r0, r1 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - lsls r0, 16 - cmp r0, 0 - beq _080CE960 - cmp r6, r5 - beq _080CE950 - mov r0, r9 - muls r0, r5 - add r0, r8 - adds r1, r4, 0 - movs r2, 0x64 - bl memcpy -_080CE950: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - b _080CE96A - .pool -_080CE960: - lsls r0, r7, 16 - asrs r0, 16 - cmp r0, r10 - bne _080CE96A - adds r7, r6, 0 -_080CE96A: - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _080CE928 - lsls r7, 16 - cmp r5, 0x5 - bhi _080CE992 - movs r6, 0x64 - ldr r4, =gPlayerParty -_080CE97E: - adds r0, r5, 0 - muls r0, r6 - adds r0, r4 - bl ZeroMonData - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x5 - bls _080CE97E -_080CE992: - asrs r0, r7, 16 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end CompactPartySlots - - thumb_func_start sub_80CE9A8 -sub_80CE9A8: @ 80CE9A8 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - strb r0, [r1] - ldr r2, =gUnknown_02039D08 - ldr r1, [r2] - ldr r3, =0x00000ceb - adds r1, r3 - strb r0, [r1] - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CE9E8 - ldr r0, [r2] - ldr r1, =0x000020a4 - adds r0, r1 - movs r1, 0x8 - mov r2, sp - bl SetMonData - b _080CEA1C - .pool -_080CE9E8: - ldr r4, =sBoxCursorArea - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0x1 - bne _080CEA08 - ldr r0, =sBoxCursorPosition - movs r1, 0 - ldrsb r1, [r0, r1] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x8 - mov r2, sp - bl SetMonData -_080CEA08: - movs r0, 0 - ldrsb r0, [r4, r0] - cmp r0, 0 - bne _080CEA1C - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - movs r1, 0x8 - mov r2, sp - bl SetCurrentBoxMonData -_080CEA1C: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CE9A8 - - thumb_func_start CanMoveMon -CanMoveMon: @ 80CEA30 - push {lr} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEA64 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - bne _080CEA64 - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - bl CountPartyAliveNonEggMonsExcept - lsls r0, 24 - cmp r0, 0 - bne _080CEA64 - movs r0, 0x1 - b _080CEA66 - .pool -_080CEA64: - movs r0, 0 -_080CEA66: - pop {r1} - bx r1 - thumb_func_end CanMoveMon - - thumb_func_start CanShifMon -CanShifMon: @ 80CEA6C - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CEAC8 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEAAC - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - bl CountPartyAliveNonEggMonsExcept - lsls r0, 24 - cmp r0, 0 - bne _080CEAAC - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000ced - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080CEAC8 - ldr r2, =0x000020a4 - adds r0, r1, r2 - movs r1, 0x39 - bl GetMonData - cmp r0, 0 - beq _080CEAC8 -_080CEAAC: - movs r0, 0x1 - b _080CEACA - .pool -_080CEAC8: - movs r0, 0 -_080CEACA: - pop {r1} - bx r1 - thumb_func_end CanShifMon - - thumb_func_start IsMonBeingMoved -IsMonBeingMoved: @ 80CEAD0 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - bx lr - .pool - thumb_func_end IsMonBeingMoved - - thumb_func_start IsCursorOnBox -IsCursorOnBox: @ 80CEADC - push {lr} - movs r1, 0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x2 - bne _080CEAEE - movs r1, 0x1 -_080CEAEE: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end IsCursorOnBox - - thumb_func_start IsCursorOnCloseBox -IsCursorOnCloseBox: @ 80CEAF8 - push {lr} - movs r1, 0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x3 - bne _080CEB16 - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CEB16 - movs r1, 0x1 -_080CEB16: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end IsCursorOnCloseBox - - thumb_func_start IsCursorInBox -IsCursorInBox: @ 80CEB24 - push {lr} - movs r1, 0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CEB36 - movs r1, 0x1 -_080CEB36: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end IsCursorInBox - - thumb_func_start sub_80CEB40 -sub_80CEB40: @ 80CEB40 - push {r4,lr} - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - movs r2, 0 - ldr r3, =sIsMonBeingMoved - ldrb r0, [r3] - cmp r0, 0 - bne _080CEB52 - movs r2, 0x1 -_080CEB52: - ldr r4, =0x00000cea - adds r0, r1, r4 - strb r2, [r0] - ldrb r0, [r3] - cmp r0, 0 - bne _080CEBD0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - beq _080CEB8A - cmp r0, 0x1 - bgt _080CEB84 - cmp r0, 0 - beq _080CEBBA - b _080CEBD0 - .pool -_080CEB84: - cmp r0, 0x3 - bgt _080CEBD0 - b _080CEBB0 -_080CEB8A: - ldr r1, =sBoxCursorPosition - movs r0, 0 - ldrsb r0, [r1, r0] - cmp r0, 0x5 - bgt _080CEBB0 - adds r1, r0, 0 - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0 - bl sub_80CEC00 - b _080CEBD0 - .pool -_080CEBB0: - movs r0, 0 - movs r1, 0x2 - bl sub_80CEC00 - b _080CEBD0 -_080CEBBA: - bl StorageGetCurrentBox - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - bl GetBoxedMonPtr - movs r1, 0x1 - bl sub_80CEC00 -_080CEBD0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CEB40 - - thumb_func_start sub_80CEBDC -sub_80CEBDC: @ 80CEBDC - push {lr} - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CEBF8 - ldr r0, =gUnknown_02039D14 - movs r1, 0 - bl sub_80CEC00 - b _080CEBFC - .pool -_080CEBF8: - bl sub_80CEB40 -_080CEBFC: - pop {r0} - bx r0 - thumb_func_end sub_80CEBDC - - thumb_func_start sub_80CEC00 -sub_80CEC00: @ 80CEC00 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r4, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r5, r1, 0 - ldr r0, =gUnknown_02039D08 - mov r8, r0 - ldr r1, [r0] - ldr r3, =0x00000ce6 - adds r2, r1, r3 - movs r0, 0 - strh r0, [r2] - mov r9, r0 - mov r10, r0 - cmp r5, 0 - bne _080CED18 - adds r6, r4, 0 - adds r0, r4, 0 - movs r1, 0x41 - bl GetMonData - mov r2, r8 - ldr r1, [r2] - ldr r3, =0x00000ce4 - adds r1, r3 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _080CEC44 - b _080CEE34 -_080CEC44: - adds r0, r4, 0 - movs r1, 0x4 - bl GetMonData - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0 - beq _080CEC74 - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00000ced - adds r0, r2 - movs r1, 0x1 - strb r1, [r0] - b _080CEC86 - .pool -_080CEC74: - adds r0, r4, 0 - movs r1, 0x2D - bl GetMonData - mov r3, r8 - ldr r1, [r3] - ldr r2, =0x00000ced - adds r1, r2 - strb r0, [r1] -_080CEC86: - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r5, =0x00000cee - adds r2, r5 - adds r0, r6, 0 - movs r1, 0x2 - bl GetMonData - ldr r0, [r4] - adds r0, r5 - bl StringGetEnd10 - adds r0, r6, 0 - movs r1, 0x38 - bl GetMonData - ldr r1, [r4] - ldr r3, =0x00000cec - adds r1, r3 - strb r0, [r1] - adds r0, r6, 0 - movs r1, 0x8 - bl GetMonData - ldr r1, [r4] - ldr r2, =0x00000ceb - adds r1, r2 - strb r0, [r1] - adds r0, r6, 0 - movs r1, 0 - bl GetMonData - ldr r1, [r4] - movs r3, 0xCE - lsls r3, 4 - adds r1, r3 - str r0, [r1] - adds r0, r6, 0 - bl GetMonFrontSpritePal - ldr r1, [r4] - ldr r2, =0x00000cdc - adds r1, r2 - str r0, [r1] - adds r0, r6, 0 - bl GetMonGender - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r0, r6, 0 - movs r1, 0xC - bl GetMonData - ldr r1, [r4] - ldr r3, =0x00000ce6 - adds r1, r3 - strh r0, [r1] - b _080CEE26 - .pool -_080CED18: - cmp r5, 0x1 - beq _080CED1E - b _080CEE1C -_080CED1E: - adds r7, r4, 0 - adds r0, r7, 0 - movs r1, 0x41 - bl GetBoxMonData - mov r2, r8 - ldr r1, [r2] - ldr r3, =0x00000ce4 - adds r1, r3 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bne _080CED3A - b _080CEE34 -_080CED3A: - adds r0, r7, 0 - movs r1, 0x1 - bl GetBoxMonData - mov r9, r0 - adds r0, r7, 0 - movs r1, 0x4 - bl GetBoxMonData - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - cmp r0, 0 - beq _080CED6C - mov r1, r8 - ldr r0, [r1] - ldr r2, =0x00000ced - adds r0, r2 - strb r5, [r0] - b _080CED7E - .pool -_080CED6C: - adds r0, r7, 0 - movs r1, 0x2D - bl GetBoxMonData - mov r3, r8 - ldr r1, [r3] - ldr r2, =0x00000ced - adds r1, r2 - strb r0, [r1] -_080CED7E: - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - ldr r4, =0x00000cee - adds r2, r4 - adds r0, r7, 0 - movs r1, 0x2 - bl GetBoxMonData - ldr r0, [r5] - adds r0, r4 - bl StringGetEnd10 - adds r0, r7, 0 - bl GetLevelFromBoxMonExp - ldr r1, [r5] - ldr r3, =0x00000cec - adds r1, r3 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x8 - bl GetBoxMonData - ldr r1, [r5] - ldr r2, =0x00000ceb - adds r1, r2 - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0 - bl GetBoxMonData - adds r2, r0, 0 - ldr r1, [r5] - movs r6, 0xCE - lsls r6, 4 - adds r0, r1, r6 - str r2, [r0] - subs r4, 0xA - adds r1, r4 - ldrh r0, [r1] - mov r1, r9 - bl GetFrontSpritePalFromSpeciesAndPersonality - ldr r1, [r5] - ldr r3, =0x00000cdc - adds r2, r1, r3 - str r0, [r2] - adds r4, r1, r4 - ldrh r0, [r4] - adds r1, r6 - ldr r1, [r1] - bl GetGenderFromSpeciesAndPersonality - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r0, r7, 0 - movs r1, 0xC - bl GetBoxMonData - ldr r1, [r5] - ldr r2, =0x00000ce6 - adds r1, r2 - strh r0, [r1] - b _080CEE26 - .pool -_080CEE1C: - ldr r3, =0x00000ce4 - adds r0, r1, r3 - mov r1, r9 - strh r1, [r0] - strh r1, [r2] -_080CEE26: - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r2, =0x00000ce4 - adds r0, r1, r2 - ldrh r2, [r0] - cmp r2, 0 - bne _080CEE94 -_080CEE34: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r3, =0x00000cee - adds r0, r3 - movs r1, 0 - movs r2, 0x5 - bl StringFill - ldr r0, [r4] - ldr r1, =0x00000cf9 - adds r0, r1 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r2, =0x00000d1d - adds r0, r2 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r3, =0x00000d41 - adds r0, r3 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r1, =0x00000d65 - adds r0, r1 - b _080CEEF2 - .pool -_080CEE94: - ldr r3, =0x00000ced - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, 0 - beq _080CEF14 - mov r0, r10 - cmp r0, 0 - beq _080CEEC0 - ldr r2, =0x00000cf9 - adds r0, r1, r2 - adds r3, 0x1 - adds r1, r3 - movs r2, 0 - movs r3, 0x5 - bl StringCopyPadded - b _080CEECE - .pool -_080CEEC0: - ldr r2, =0x00000cf9 - adds r0, r1, r2 - ldr r1, =gText_EggNickname - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded -_080CEECE: - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r3, =0x00000d1d - adds r0, r3 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r1, =0x00000d41 - adds r0, r1 - movs r1, 0 - movs r2, 0x8 - bl StringFill - ldr r0, [r4] - ldr r2, =0x00000d65 - adds r0, r2 -_080CEEF2: - movs r1, 0 - movs r2, 0x8 - bl StringFill - b _080CF0B8 - .pool -_080CEF14: - cmp r2, 0x1D - beq _080CEF1C - cmp r2, 0x20 - bne _080CEF20 -_080CEF1C: - movs r3, 0xFF - mov r9, r3 -_080CEF20: - ldr r4, =gUnknown_02039D08 - ldr r1, [r4] - ldr r2, =0x00000cf9 - adds r0, r1, r2 - ldr r3, =0x00000cee - adds r1, r3 - movs r2, 0 - movs r3, 0x5 - bl StringCopyPadded - ldr r1, [r4] - ldr r0, =0x00000d1d - adds r2, r1, r0 - movs r0, 0xBA - strb r0, [r2] - ldr r3, =0x00000d1e - adds r2, r1, r3 - ldr r0, [r4] - ldr r1, =0x00000ce4 - adds r0, r1 - ldrh r1, [r0] - movs r0, 0xB - muls r1, r0 - ldr r0, =gSpeciesNames - adds r1, r0 - adds r0, r2, 0 - movs r2, 0 - movs r3, 0x5 - bl StringCopyPadded - ldr r4, [r4] - ldr r3, =0x00000d41 - adds r2, r4, r3 - movs r0, 0xFC - strb r0, [r2] - ldr r0, =0x00000d42 - adds r2, r4, r0 - movs r0, 0x4 - strb r0, [r2] - ldr r1, =0x00000d43 - adds r2, r4, r1 - mov r3, r9 - cmp r3, 0 - beq _080CEFD4 - cmp r3, 0xFE - beq _080CF000 - movs r0, 0x2 - strb r0, [r2] - ldr r0, =0x00000d44 - adds r2, r4, r0 - movs r0, 0x1 - strb r0, [r2] - adds r1, 0x2 - adds r2, r4, r1 - movs r0, 0x3 - strb r0, [r2] - ldr r3, =0x00000d46 - adds r2, r4, r3 - movs r0, 0x77 - strb r0, [r2] - ldr r0, =0x00000d47 - adds r2, r4, r0 - b _080CF020 - .pool -_080CEFD4: - strb r0, [r2] - ldr r1, =0x00000d44 - adds r2, r4, r1 - movs r0, 0x1 - strb r0, [r2] - ldr r3, =0x00000d45 - adds r2, r4, r3 - movs r0, 0x5 - strb r0, [r2] - ldr r0, =0x00000d46 - adds r2, r4, r0 - movs r0, 0xB5 - strb r0, [r2] - adds r1, 0x3 - adds r2, r4, r1 - b _080CF020 - .pool -_080CF000: - movs r0, 0x6 - strb r0, [r2] - ldr r3, =0x00000d44 - adds r2, r4, r3 - movs r0, 0x1 - strb r0, [r2] - ldr r0, =0x00000d45 - adds r2, r4, r0 - movs r0, 0x7 - strb r0, [r2] - ldr r1, =0x00000d46 - adds r2, r4, r1 - movs r0, 0xB6 - strb r0, [r2] - adds r3, 0x3 - adds r2, r4, r3 -_080CF020: - movs r0, 0xFC - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x4 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x2 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x1 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x3 - strb r0, [r2] - adds r2, 0x1 - movs r5, 0 - strb r5, [r2] - adds r2, 0x1 - movs r0, 0xF9 - strb r0, [r2] - adds r2, 0x1 - movs r0, 0x5 - strb r0, [r2] - adds r2, 0x1 - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r1, =0x00000cec - adds r0, r1 - ldrb r1, [r0] - adds r0, r2, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - adds r2, r0, 0 - strb r5, [r2] - movs r0, 0xFF - strb r0, [r2, 0x1] - ldr r4, [r4] - ldr r2, =0x00000ce6 - adds r1, r4, r2 - ldrh r0, [r1] - cmp r0, 0 - beq _080CF0AC - ldr r3, =0x00000d65 - adds r4, r3 - bl ItemId_GetName - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0x8 - bl StringCopyPadded - b _080CF0B8 - .pool -_080CF0AC: - ldr r1, =0x00000d65 - adds r0, r4, r1 - movs r1, 0 - movs r2, 0x8 - bl StringFill -_080CF0B8: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CEC00 - - thumb_func_start sub_80CF0CC -sub_80CF0CC: @ 80CF0CC - push {lr} - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000021ff - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080CF0F4 - cmp r0, 0x1 - ble _080CF0E4 - cmp r0, 0x2 - beq _080CF0FA -_080CF0E4: - bl sub_80CF108 - b _080CF0FE - .pool -_080CF0F4: - bl sub_80CF374 - b _080CF0FE -_080CF0FA: - bl sub_80CF4B0 -_080CF0FE: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CF0CC - - thumb_func_start sub_80CF108 -sub_80CF108: @ 80CF108 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - mov r8, r0 - ldr r2, =sBoxCursorPosition - ldrb r4, [r2] - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - ldr r1, =0x00000cd2 - mov r10, r1 - add r0, r10 - movs r1, 0 - strb r1, [r0] - ldr r0, [r5] - ldr r7, =0x00000cd3 - adds r0, r7 - strb r1, [r0] - ldr r0, [r5] - ldr r3, =0x00000cd7 - mov r9, r3 - add r0, r9 - strb r1, [r0] - ldr r6, =gMain - ldrh r1, [r6, 0x30] - movs r0, 0x40 - ands r0, r1 - adds r3, r2, 0 - cmp r0, 0 - beq _080CF14C - b _080CF33C -_080CF14C: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080CF1A8 - movs r6, 0x1 - lsls r0, r4, 24 - movs r1, 0xC0 - lsls r1, 19 - adds r0, r1 - lsrs r4, r0, 24 - asrs r0, 24 - cmp r0, 0x1D - bgt _080CF168 - b _080CF358 -_080CF168: - movs r2, 0x3 - mov r8, r2 - subs r0, 0x1E - lsls r0, 24 - asrs r0, 24 - movs r1, 0x3 - bl __divsi3 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, [r5] - add r0, r10 - strb r6, [r0] - ldr r0, [r5] - add r0, r9 - strb r6, [r0] - b _080CF358 - .pool -_080CF1A8: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF1DE - movs r6, 0x1 - movs r0, 0 - ldrsb r0, [r3, r0] - movs r1, 0x6 - bl __modsi3 - lsls r0, 24 - cmp r0, 0 - beq _080CF1CA - lsls r0, r4, 24 - movs r3, 0xFF - lsls r3, 24 - b _080CF34C -_080CF1CA: - ldr r0, [r5] - adds r0, r7 - movs r1, 0xFF - strb r1, [r0] - lsls r0, r4, 24 - movs r1, 0xA0 - lsls r1, 19 - adds r0, r1 - lsrs r4, r0, 24 - b _080CF358 -_080CF1DE: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF212 - movs r6, 0x1 - movs r0, 0 - ldrsb r0, [r3, r0] - adds r0, 0x1 - movs r1, 0x6 - bl __modsi3 - cmp r0, 0 - beq _080CF204 - lsls r0, r4, 24 - movs r2, 0x80 - lsls r2, 17 - adds r0, r2 - lsrs r4, r0, 24 - b _080CF358 -_080CF204: - ldr r0, [r5] - adds r0, r7 - strb r6, [r0] - lsls r0, r4, 24 - movs r3, 0xFB - lsls r3, 24 - b _080CF34C -_080CF212: - ldrh r1, [r6, 0x2E] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _080CF220 - movs r6, 0x1 - b _080CF352 -_080CF220: - movs r4, 0x1 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF2E4 - bl sub_80CFA5C - lsls r0, 24 - cmp r0, 0 - beq _080CF2E4 - ldr r0, =sCanOnlyMove - ldrb r0, [r0] - cmp r0, 0 - bne _080CF244 - movs r0, 0x8 - b _080CF366 - .pool -_080CF244: - ldr r1, [r5] - ldrb r0, [r1, 0x1] - cmp r0, 0x2 - bne _080CF254 - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0x1 - bne _080CF2D4 -_080CF254: - movs r0, 0 - bl sub_80CFF98 - subs r0, 0x1 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bhi _080CF2E4 - lsls r0, 2 - ldr r1, =_080CF278 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CF278: - .4byte _080CF2B4 - .4byte _080CF2B8 - .4byte _080CF2BC - .4byte _080CF2C0 - .4byte _080CF2C4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2E4 - .4byte _080CF2C8 - .4byte _080CF2CC - .4byte _080CF2E4 - .4byte _080CF2D0 -_080CF2B4: - movs r0, 0xB - b _080CF366 -_080CF2B8: - movs r0, 0xC - b _080CF366 -_080CF2BC: - movs r0, 0xD - b _080CF366 -_080CF2C0: - movs r0, 0xE - b _080CF366 -_080CF2C4: - movs r0, 0xF - b _080CF366 -_080CF2C8: - movs r0, 0x10 - b _080CF366 -_080CF2CC: - movs r0, 0x11 - b _080CF366 -_080CF2D0: - movs r0, 0x12 - b _080CF366 -_080CF2D4: - ldr r2, =0x000021ff - adds r0, r1, r2 - strb r4, [r0] - movs r0, 0x14 - b _080CF366 - .pool -_080CF2E4: - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF2F8 - movs r0, 0x13 - b _080CF366 - .pool -_080CF2F8: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x1 - bne _080CF326 - ldrh r1, [r2, 0x2C] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _080CF318 - movs r0, 0xA - b _080CF366 - .pool -_080CF318: - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _080CF326 - movs r0, 0x9 - b _080CF366 -_080CF326: - ldrh r1, [r2, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF338 - bl sub_80CFDC4 - movs r0, 0 - b _080CF366 -_080CF338: - movs r6, 0 - b _080CF364 -_080CF33C: - movs r6, 0x1 - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r0, 0x5 - ble _080CF352 - lsls r0, r4, 24 - movs r3, 0xFA - lsls r3, 24 -_080CF34C: - adds r0, r3 - lsrs r4, r0, 24 - b _080CF358 -_080CF352: - movs r0, 0x2 - mov r8, r0 - movs r4, 0 -_080CF358: - cmp r6, 0 - beq _080CF364 - mov r0, r8 - adds r1, r4, 0 - bl sub_80CD894 -_080CF364: - adds r0, r6, 0 -_080CF366: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CF108 - - thumb_func_start sub_80CF374 -sub_80CF374: @ 80CF374 - push {r4,lr} - ldr r1, =gMain - ldrh r0, [r1, 0x2C] - movs r4, 0x1 - ands r4, r0 - cmp r4, 0 - beq _080CF428 - ldrh r1, [r1, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080CF3AC - ldr r4, =sBoxCursorPosition - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __divsi3 - lsls r0, 24 - cmp r0, 0 - beq _080CF420 - ldrb r1, [r4] - subs r1, 0x6 - b _080CF40E - .pool -_080CF3AC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080CF3CC - ldr r1, =sBoxCursorPosition - movs r0, 0 - ldrsb r0, [r1, r0] - adds r0, 0x6 - cmp r0, 0x1D - bgt _080CF420 - ldrb r1, [r1] - adds r1, 0x6 - b _080CF40E - .pool -_080CF3CC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF3F0 - ldr r4, =sBoxCursorPosition - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __modsi3 - lsls r0, 24 - cmp r0, 0 - beq _080CF420 - ldrb r1, [r4] - subs r1, 0x1 - b _080CF40E - .pool -_080CF3F0: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF424 - ldr r4, =sBoxCursorPosition - movs r0, 0 - ldrsb r0, [r4, r0] - adds r0, 0x1 - movs r1, 0x6 - bl __modsi3 - cmp r0, 0 - beq _080CF420 - ldrb r1, [r4] - adds r1, 0x1 -_080CF40E: - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80CD894 - movs r0, 0x15 - b _080CF49C - .pool -_080CF420: - movs r0, 0x18 - b _080CF49C -_080CF424: - movs r0, 0 - b _080CF49C -_080CF428: - bl sub_80D0BA4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - cmp r0, r1 - beq _080CF47C - ldr r2, =sIsMonBeingMoved - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000ce4 - adds r0, r1, r3 - ldrh r0, [r0] - negs r0, r0 - lsrs r0, 31 - strb r0, [r2] - ldr r0, =0x000021ff - adds r1, r0 - movs r0, 0x2 - strb r0, [r1] - bl StorageGetCurrentBox - ldr r1, =sMovingMonOrigBoxId - strb r0, [r1] - movs r0, 0x17 - b _080CF49C - .pool -_080CF47C: - ldr r1, =gUnknown_02039D08 - ldr r0, [r1] - ldr r2, =0x000021ff - adds r0, r2 - strb r4, [r0] - ldr r0, [r1] - ldr r3, =0x00000cb8 - adds r0, r3 - ldr r1, [r0] - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - movs r0, 0x16 -_080CF49C: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80CF374 - - thumb_func_start sub_80CF4B0 -sub_80CF4B0: @ 80CF4B0 - push {r4,lr} - ldr r2, =gMain - ldrh r1, [r2, 0x30] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080CF4DC - movs r0, 0 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF588 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - subs r1, 0x6 - b _080CF53A - .pool -_080CF4DC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080CF4FC - movs r0, 0x1 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF588 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - adds r1, 0x6 - b _080CF53A - .pool -_080CF4FC: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF51C - movs r0, 0x2 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF5A2 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - subs r1, 0x1 - b _080CF53A - .pool -_080CF51C: - movs r0, 0x10 - ands r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - cmp r4, 0 - beq _080CF54C - movs r0, 0x3 - bl sub_80D0580 - lsls r0, 24 - cmp r0, 0 - beq _080CF5B6 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - adds r1, 0x1 -_080CF53A: - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_80CD894 - movs r0, 0x19 - b _080CF5BC - .pool -_080CF54C: - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF580 - bl sub_80D0BC0 - lsls r0, 24 - cmp r0, 0 - beq _080CF588 - ldr r0, =sIsMonBeingMoved - strb r4, [r0] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x000021ff - adds r0, r1 - strb r4, [r0] - movs r0, 0x1A - b _080CF5BC - .pool -_080CF580: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF58C -_080CF588: - movs r0, 0x18 - b _080CF5BC -_080CF58C: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x1 - bne _080CF5BA - ldrh r1, [r2, 0x2C] - movs r0, 0x80 - lsls r0, 2 - ands r0, r1 - cmp r0, 0 - beq _080CF5AC -_080CF5A2: - movs r0, 0xA - b _080CF5BC - .pool -_080CF5AC: - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _080CF5BA -_080CF5B6: - movs r0, 0x9 - b _080CF5BC -_080CF5BA: - movs r0, 0 -_080CF5BC: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80CF4B0 - - thumb_func_start sub_80CF5C4 -sub_80CF5C4: @ 80CF5C4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - mov r9, r0 - ldr r6, =sBoxCursorPosition - ldrb r4, [r6] - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x00000cd3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r3, =0x00000cd2 - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x5 - adds r0, r3 - strb r1, [r0] - mov r8, r1 - movs r7, 0 - ldr r1, =gMain - ldrh r3, [r1, 0x30] - movs r0, 0x40 - ands r0, r3 - adds r5, r6, 0 - mov r12, r1 - cmp r0, 0 - beq _080CF608 - b _080CF7A8 -_080CF608: - movs r0, 0x80 - ands r0, r3 - cmp r0, 0 - beq _080CF64C - lsls r0, r4, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r4, r0, 24 - asrs r0, 24 - cmp r0, 0x6 - ble _080CF622 - movs r4, 0 -_080CF622: - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0 - ldrsb r1, [r5, r1] - cmp r0, r1 - bne _080CF630 - b _080CF7C6 -_080CF630: - movs r7, 0x1 - b _080CF7CA - .pool -_080CF64C: - movs r0, 0x20 - ands r0, r3 - cmp r0, 0 - beq _080CF670 - ldrb r1, [r5] - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - beq _080CF670 - movs r7, 0x1 - ldr r0, [r2] - ldr r2, =0x00000cd6 - adds r0, r2 - strb r1, [r0] - movs r4, 0 - b _080CF7C6 - .pool -_080CF670: - mov r3, r12 - ldrh r1, [r3, 0x30] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF69E - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - bne _080CF694 - movs r7, 0x1 - ldr r0, [r2] - ldr r1, =0x00000cd6 - adds r0, r1 - ldrb r4, [r0] - b _080CF7C6 - .pool -_080CF694: - movs r7, 0x6 - movs r2, 0 - mov r9, r2 - movs r4, 0 - b _080CF7C6 -_080CF69E: - mov r3, r12 - ldrh r1, [r3, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF75C - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0x6 - bne _080CF6C4 - ldr r0, [r2] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - bne _080CF6BE - movs r0, 0x4 - b _080CF7D8 -_080CF6BE: - movs r0, 0x1 - mov r8, r0 - b _080CF75C -_080CF6C4: - bl sub_80CFA5C - lsls r0, 24 - cmp r0, 0 - beq _080CF75C - ldr r0, =sCanOnlyMove - ldrb r0, [r0] - cmp r0, 0 - bne _080CF6E0 - movs r0, 0x8 - b _080CF7D8 - .pool -_080CF6E0: - movs r0, 0 - bl sub_80CFF98 - subs r0, 0x1 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0xE - bhi _080CF75C - lsls r0, 2 - ldr r1, =_080CF700 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080CF700: - .4byte _080CF73C - .4byte _080CF740 - .4byte _080CF744 - .4byte _080CF748 - .4byte _080CF74C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF75C - .4byte _080CF750 - .4byte _080CF754 - .4byte _080CF75C - .4byte _080CF758 -_080CF73C: - movs r0, 0xB - b _080CF7D8 -_080CF740: - movs r0, 0xC - b _080CF7D8 -_080CF744: - movs r0, 0xD - b _080CF7D8 -_080CF748: - movs r0, 0xE - b _080CF7D8 -_080CF74C: - movs r0, 0xF - b _080CF7D8 -_080CF750: - movs r0, 0x10 - b _080CF7D8 -_080CF754: - movs r0, 0x11 - b _080CF7D8 -_080CF758: - movs r0, 0x12 - b _080CF7D8 -_080CF75C: - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - mov r12, r2 - cmp r0, 0 - beq _080CF784 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - bne _080CF780 - movs r0, 0x13 - b _080CF7D8 - .pool -_080CF780: - movs r1, 0x1 - mov r8, r1 -_080CF784: - mov r2, r8 - cmp r2, 0 - beq _080CF794 - movs r7, 0x6 - movs r3, 0 - mov r9, r3 - movs r4, 0 - b _080CF7C6 -_080CF794: - mov r0, r12 - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF7C6 - bl sub_80CFDC4 - movs r0, 0 - b _080CF7D8 -_080CF7A8: - lsls r0, r4, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r4, r0, 24 - cmp r0, 0 - bge _080CF7B8 - movs r4, 0x6 -_080CF7B8: - lsls r0, r4, 24 - asrs r0, 24 - movs r1, 0 - ldrsb r1, [r6, r1] - cmp r0, r1 - beq _080CF7C6 - movs r7, 0x1 -_080CF7C6: - cmp r7, 0 - beq _080CF7D6 -_080CF7CA: - cmp r7, 0x6 - beq _080CF7D6 - mov r0, r9 - adds r1, r4, 0 - bl sub_80CD894 -_080CF7D6: - adds r0, r7, 0 -_080CF7D8: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CF5C4 - - thumb_func_start sub_80CF7E4 -sub_80CF7E4: @ 80CF7E4 - push {r4-r6,lr} - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000cd3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r3] - ldr r2, =0x00000cd2 - adds r0, r2 - strb r1, [r0] - ldr r0, [r3] - ldr r5, =0x00000cd7 - adds r0, r5 - strb r1, [r0] - ldr r1, =gMain - ldrh r2, [r1, 0x30] - movs r0, 0x40 - ands r0, r2 - cmp r0, 0 - bne _080CF8AA - movs r0, 0x80 - ands r0, r2 - cmp r0, 0 - beq _080CF834 - movs r4, 0x1 - movs r1, 0 - movs r6, 0x2 - b _080CF8B6 - .pool -_080CF834: - ldrh r2, [r1, 0x2C] - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - bne _080CF85A - movs r0, 0x10 - ands r0, r2 - cmp r0, 0 - bne _080CF86E - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x13] - cmp r0, 0x1 - bne _080CF872 - movs r0, 0x80 - lsls r0, 2 - ands r0, r2 - cmp r0, 0 - beq _080CF864 -_080CF85A: - movs r0, 0xA - b _080CF8D2 - .pool -_080CF864: - movs r0, 0x80 - lsls r0, 1 - ands r0, r2 - cmp r0, 0 - beq _080CF872 -_080CF86E: - movs r0, 0x9 - b _080CF8D2 -_080CF872: - ldrh r1, [r1, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF88A - movs r0, 0 - bl sub_80CD1A8 - bl sub_80CFA38 - movs r0, 0x7 - b _080CF8D2 -_080CF88A: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF896 - movs r0, 0x13 - b _080CF8D2 -_080CF896: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF8A6 - bl sub_80CFDC4 - movs r0, 0 - b _080CF8D2 -_080CF8A6: - movs r4, 0 - b _080CF8D0 -_080CF8AA: - movs r4, 0x1 - movs r1, 0x3 - movs r6, 0 - ldr r0, [r3] - adds r0, r5 - strb r4, [r0] -_080CF8B6: - cmp r4, 0 - beq _080CF8D0 - lsls r5, r1, 24 - cmp r1, 0x2 - beq _080CF8C6 - movs r0, 0 - bl sub_80CD1A8 -_080CF8C6: - lsrs r0, r5, 24 - lsls r1, r6, 24 - lsrs r1, 24 - bl sub_80CD894 -_080CF8D0: - adds r0, r4, 0 -_080CF8D2: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_80CF7E4 - - thumb_func_start sub_80CF8D8 -sub_80CF8D8: @ 80CF8D8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - mov r8, r0 - ldr r0, =sBoxCursorPosition - mov r12, r0 - ldrb r2, [r0] - ldr r3, =gUnknown_02039D08 - ldr r0, [r3] - ldr r1, =0x00000cd3 - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r3] - ldr r6, =0x00000cd2 - adds r0, r6 - strb r1, [r0] - ldr r0, [r3] - ldr r5, =0x00000cd7 - adds r0, r5 - strb r1, [r0] - ldr r7, =gMain - ldrh r1, [r7, 0x30] - movs r0, 0x40 - ands r0, r1 - adds r4, r3, 0 - cmp r0, 0 - bne _080CF9B2 - movs r0, 0x88 - ands r0, r1 - cmp r0, 0 - beq _080CF944 - movs r7, 0x1 - movs r0, 0x2 - mov r8, r0 - movs r2, 0 - ldr r0, [r4] - b _080CF9D0 - .pool -_080CF944: - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080CF960 - movs r7, 0x1 - lsls r0, r2, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r2, r0, 24 - cmp r0, 0 - bge _080CF9D4 - movs r2, 0x1 - b _080CF9D4 -_080CF960: - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080CF97E - movs r7, 0x1 - lsls r0, r2, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x1 - ble _080CF9D4 - movs r2, 0 - b _080CF9D4 -_080CF97E: - ldrh r1, [r7, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080CF992 - movs r0, 0x4 - cmp r2, 0 - bne _080CF9E2 - movs r0, 0x5 - b _080CF9E2 -_080CF992: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080CF99E - movs r0, 0x13 - b _080CF9E2 -_080CF99E: - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080CF9AE - bl sub_80CFDC4 - movs r0, 0 - b _080CF9E2 -_080CF9AE: - movs r7, 0 - b _080CF9E0 -_080CF9B2: - movs r7, 0x1 - movs r0, 0 - mov r8, r0 - ldr r0, [r3] - adds r0, r6 - movs r1, 0xFF - strb r1, [r0] - mov r1, r12 - movs r0, 0 - ldrsb r0, [r1, r0] - movs r2, 0x1D - cmp r0, 0 - bne _080CF9CE - movs r2, 0x18 -_080CF9CE: - ldr r0, [r3] -_080CF9D0: - adds r0, r5 - strb r7, [r0] -_080CF9D4: - cmp r7, 0 - beq _080CF9E0 - mov r0, r8 - adds r1, r2, 0 - bl sub_80CD894 -_080CF9E0: - adds r0, r7, 0 -_080CF9E2: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80CF8D8 - - thumb_func_start sub_80CF9EC -sub_80CF9EC: @ 80CF9EC - push {r4,r5,lr} - movs r3, 0 - ldr r0, =gUnknown_0857B9BC - ldr r1, [r0] - adds r4, r0, 0 - cmp r1, 0 - beq _080CFA30 - ldr r5, =sBoxCursorArea -_080CF9FC: - lsls r0, r3, 3 - adds r2, r0, r4 - movs r1, 0x4 - ldrsb r1, [r2, r1] - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r1, r0 - bne _080CFA20 - ldr r0, [r2] - bl _call_via_r0 - lsls r0, 24 - lsrs r0, 24 - b _080CFA32 - .pool -_080CFA20: - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - lsls r0, r3, 3 - adds r0, r4 - ldr r0, [r0] - cmp r0, 0 - bne _080CF9FC -_080CFA30: - movs r0, 0 -_080CFA32: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CF9EC - - thumb_func_start sub_80CFA38 -sub_80CFA38: @ 80CFA38 - push {lr} - bl sub_80CFEF0 - movs r0, 0x9 - bl sub_80CFF34 - movs r0, 0xA - bl sub_80CFF34 - movs r0, 0xB - bl sub_80CFF34 - movs r0, 0 - bl sub_80CFF34 - pop {r0} - bx r0 - thumb_func_end sub_80CFA38 - - thumb_func_start sub_80CFA5C -sub_80CFA5C: @ 80CFA5C - push {lr} - bl sub_80CFEF0 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x3 - bne _080CFA78 - bl sub_80CFB44 - b _080CFA7C - .pool -_080CFA78: - bl sub_80CFA84 -_080CFA7C: - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80CFA5C - - thumb_func_start sub_80CFA84 -sub_80CFA84: @ 80CFA84 - push {lr} - bl sub_80CD504 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x1 - beq _080CFAAE - cmp r0, 0x1 - bgt _080CFAA8 - cmp r0, 0 - beq _080CFABA - b _080CFAF4 - .pool -_080CFAA8: - cmp r0, 0x2 - beq _080CFAC6 - b _080CFAF4 -_080CFAAE: - cmp r1, 0 - beq _080CFAF4 - movs r0, 0x1 - bl sub_80CFF34 - b _080CFAF8 -_080CFABA: - cmp r1, 0 - beq _080CFAF4 - movs r0, 0x2 - bl sub_80CFF34 - b _080CFAF8 -_080CFAC6: - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CFAE8 - cmp r1, 0 - beq _080CFAE0 - movs r0, 0x4 - bl sub_80CFF34 - b _080CFAF8 - .pool -_080CFAE0: - movs r0, 0x5 - bl sub_80CFF34 - b _080CFAF8 -_080CFAE8: - cmp r1, 0 - beq _080CFAF4 - movs r0, 0x3 - bl sub_80CFF34 - b _080CFAF8 -_080CFAF4: - movs r0, 0 - b _080CFB3E -_080CFAF8: - movs r0, 0x6 - bl sub_80CFF34 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldrb r0, [r0, 0x1] - cmp r0, 0x2 - bne _080CFB2A - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFB24 - movs r0, 0x2 - bl sub_80CFF34 - b _080CFB2A - .pool -_080CFB24: - movs r0, 0x1 - bl sub_80CFF34 -_080CFB2A: - movs r0, 0x8 - bl sub_80CFF34 - movs r0, 0x7 - bl sub_80CFF34 - movs r0, 0 - bl sub_80CFF34 - movs r0, 0x1 -_080CFB3E: - pop {r1} - bx r1 - thumb_func_end sub_80CFA84 - - thumb_func_start sub_80CFB44 -sub_80CFB44: @ 80CFB44 - push {r4,r5,lr} - ldr r4, =gUnknown_02039D08 - ldr r0, [r4] - ldr r5, =0x00000ce4 - adds r0, r5 - ldrh r1, [r0] - movs r0, 0xCE - lsls r0, 1 - cmp r1, r0 - beq _080CFBDA - bl sub_80D127C - lsls r0, 24 - cmp r0, 0 - bne _080CFBAC - ldr r2, [r4] - ldr r0, =0x00000ce6 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080CFB8C - adds r0, r2, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _080CFBDA - movs r0, 0xE - bl sub_80CFF34 - b _080CFBE4 - .pool -_080CFB8C: - ldrh r0, [r1] - bl ItemIsMail - lsls r0, 24 - cmp r0, 0 - bne _080CFBA4 - movs r0, 0xC - bl sub_80CFF34 - movs r0, 0x10 - bl sub_80CFF34 -_080CFBA4: - movs r0, 0x11 - bl sub_80CFF34 - b _080CFBE4 -_080CFBAC: - ldr r2, [r4] - ldr r0, =0x00000ce6 - adds r1, r2, r0 - ldrh r0, [r1] - cmp r0, 0 - bne _080CFBCC - adds r0, r2, r5 - ldrh r0, [r0] - cmp r0, 0 - beq _080CFBDA - movs r0, 0xD - bl sub_80CFF34 - b _080CFBE4 - .pool -_080CFBCC: - ldrh r0, [r1] - bl ItemIsMail - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080CFBDE -_080CFBDA: - movs r0, 0 - b _080CFBEC -_080CFBDE: - movs r0, 0xF - bl sub_80CFF34 -_080CFBE4: - movs r0, 0 - bl sub_80CFF34 - movs r0, 0x1 -_080CFBEC: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80CFB44 - - thumb_func_start sub_80CFBF4 -sub_80CFBF4: @ 80CFBF4 - ldr r1, =gUnknown_02039D08 - ldr r1, [r1] - ldr r2, =0x00000cb4 - adds r1, r2 - ldr r2, [r1] - ldrh r2, [r2, 0x20] - strh r2, [r0, 0x20] - ldr r1, [r1] - ldrh r1, [r1, 0x22] - adds r1, 0x14 - strh r1, [r0, 0x22] - bx lr - .pool - thumb_func_end sub_80CFBF4 - - thumb_func_start sub_80CFC14 -sub_80CFC14: @ 80CFC14 - push {r4-r6,lr} - sub sp, 0x2C - mov r1, sp - ldr r0, =gHandCursorSpriteSheets - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - add r4, sp, 0x18 - adds r1, r4, 0 - ldr r0, =gHandCursorSpritePalettes - ldm r0!, {r2,r3,r5} - stm r1!, {r2,r3,r5} - ldr r0, [r0] - str r0, [r1] - mov r0, sp - bl LoadSpriteSheets - adds r0, r4, 0 - bl LoadSpritePalettes - ldr r0, =0x0000daca - bl IndexOfSpritePaletteTag - ldr r6, =gUnknown_02039D08 - ldr r1, [r6] - ldr r4, =0x00000cd8 - adds r1, r4 - strb r0, [r1] - ldr r0, =0x0000dac7 - bl IndexOfSpritePaletteTag - ldr r1, [r6] - ldr r5, =0x00000cd9 - adds r1, r5 - strb r0, [r1] - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - ldr r1, =sBoxCursorPosition - ldrb r1, [r1] - add r4, sp, 0x28 - mov r5, sp - adds r5, 0x2A - adds r2, r4, 0 - adds r3, r5, 0 - bl sub_80CD444 - ldr r0, =gSpriteTemplate_857BA50 - movs r2, 0 - ldrsh r1, [r4, r2] - movs r3, 0 - ldrsh r2, [r5, r3] - movs r3, 0x6 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080CFD18 - ldr r2, [r6] - ldr r4, =0x00000cb4 - adds r3, r2, r4 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r3] - ldr r0, =sCanOnlyMove - ldr r5, =0x00000cd8 - adds r2, r5 - ldrb r0, [r0] - adds r2, r0 - ldrb r2, [r2] - lsls r2, 4 - ldrb r3, [r1, 0x5] - movs r0, 0xF - ands r0, r3 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r6] - adds r0, r4 - ldr r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x5] - ldr r0, =sIsMonBeingMoved - ldrb r0, [r0] - cmp r0, 0 - beq _080CFD22 - ldr r0, [r6] - adds r0, r4 - ldr r0, [r0] - movs r1, 0x3 - bl StartSpriteAnim - b _080CFD22 - .pool -_080CFD18: - ldr r0, [r6] - ldr r1, =0x00000cb4 - adds r0, r1 - movs r1, 0 - str r1, [r0] -_080CFD22: - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _080CFD3C - movs r3, 0xD - movs r4, 0x1 - b _080CFD40 - .pool -_080CFD3C: - movs r3, 0x15 - movs r4, 0x2 -_080CFD40: - ldr r0, =gSpriteTemplate_857BA68 - movs r1, 0 - movs r2, 0 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x40 - beq _080CFDA8 - ldr r5, =gUnknown_02039D08 - ldr r2, [r5] - ldr r3, =0x00000cb8 - adds r2, r3 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - ldr r0, =gSprites - adds r1, r0 - str r1, [r2] - lsls r3, r4, 2 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x5] - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - beq _080CFDB4 - ldr r0, [r5] - ldr r4, =0x00000cb8 - adds r0, r4 - ldr r1, [r0] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1] - b _080CFDB4 - .pool -_080CFDA8: - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r5, =0x00000cb8 - adds r0, r5 - movs r1, 0 - str r1, [r0] -_080CFDB4: - add sp, 0x2C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFC14 - - thumb_func_start sub_80CFDC4 -sub_80CFDC4: @ 80CFDC4 - push {lr} - ldr r2, =sCanOnlyMove - movs r1, 0 - ldrb r0, [r2] - cmp r0, 0 - bne _080CFDD2 - movs r1, 0x1 -_080CFDD2: - strb r1, [r2] - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r3, =0x00000cb4 - adds r1, r0, r3 - ldr r3, [r1] - ldr r1, =0x00000cd8 - adds r0, r1 - ldrb r2, [r2] - adds r0, r2 - ldrb r1, [r0] - lsls r1, 4 - ldrb r2, [r3, 0x5] - movs r0, 0xF - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x5] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFDC4 - - thumb_func_start GetBoxCursorPosition -GetBoxCursorPosition: @ 80CFE08 - ldr r0, =sBoxCursorPosition - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetBoxCursorPosition - - thumb_func_start sub_80CFE14 -sub_80CFE14: @ 80CFE14 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFE48 - ldr r4, =sBoxCursorPosition - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __modsi3 - strb r0, [r5] - movs r0, 0 - ldrsb r0, [r4, r0] - movs r1, 0x6 - bl __divsi3 - b _080CFE4C - .pool -_080CFE48: - movs r0, 0 - strb r0, [r5] -_080CFE4C: - strb r0, [r6] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80CFE14 - - thumb_func_start sub_80CFE54 -sub_80CFE54: @ 80CFE54 - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r2, =0x00000cb4 - adds r0, r2 - ldr r0, [r0] - bl StartSpriteAnim - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFE54 - - thumb_func_start sub_80CFE78 -sub_80CFE78: @ 80CFE78 - ldr r0, =sMovingMonOrigBoxId - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_80CFE78 - - thumb_func_start sub_80CFE84 -sub_80CFE84: @ 80CFE84 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - ldr r1, =0x00000cb4 - adds r0, r1 - ldr r2, [r0] - ldrb r1, [r2, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x5] - bx lr - .pool - thumb_func_end sub_80CFE84 - - thumb_func_start sub_80CFEA8 -sub_80CFEA8: @ 80CFEA8 - push {lr} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFEC0 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0E50 -_080CFEC0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFEA8 - - thumb_func_start sub_80CFECC -sub_80CFECC: @ 80CFECC - push {lr} - ldr r0, =sBoxCursorArea - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0 - bne _080CFEE4 - ldr r0, =sBoxCursorPosition - ldrb r1, [r0] - movs r0, 0 - bl sub_80D0D8C -_080CFEE4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFECC - - thumb_func_start sub_80CFEF0 -sub_80CFEF0: @ 80CFEF0 - ldr r2, =gUnknown_02039D08 - ldr r0, [r2] - ldr r1, =0x00000cac - adds r0, r1 - movs r1, 0 - strb r1, [r0] - ldr r0, [r2] - ldr r3, =0x00000cad - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - subs r3, 0x41 - adds r0, r3 - strb r1, [r0] - ldr r0, [r2] - ldr r1, =0x00000c71 - adds r0, r1 - movs r1, 0xF - strb r1, [r0] - ldr r0, [r2] - adds r3, 0x6 - adds r0, r3 - movs r1, 0x5C - strh r1, [r0] - bx lr - .pool - thumb_func_end sub_80CFEF0 - - thumb_func_start sub_80CFF34 -sub_80CFF34: @ 80CFF34 - push {r4,r5,lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r4, =gUnknown_02039D08 - ldr r2, [r4] - ldr r5, =0x00000cac - adds r1, r2, r5 - ldrb r0, [r1] - cmp r0, 0x6 - bhi _080CFF7E - adds r1, r0, 0 - lsls r1, 3 - ldr r0, =0x00000c74 - adds r1, r0 - adds r1, r2, r1 - ldr r2, =gUnknown_0857BA80 - lsls r0, r3, 2 - adds r0, r2 - ldr r0, [r0] - str r0, [r1] - str r3, [r1, 0x4] - bl StringLength - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, [r4] - ldr r2, =0x00000cad - adds r0, r2 - ldrb r2, [r0] - cmp r1, r2 - bls _080CFF74 - strb r1, [r0] -_080CFF74: - ldr r1, [r4] - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080CFF7E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFF34 - - thumb_func_start sub_80CFF98 -sub_80CFF98: @ 80CFF98 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gUnknown_02039D08 - ldr r1, [r0] - ldr r3, =0x00000cac - adds r0, r1, r3 - ldrb r0, [r0] - cmp r2, r0 - bcs _080CFFC8 - lsls r0, r2, 3 - ldr r2, =0x00000c78 - adds r1, r2 - adds r1, r0 - movs r0, 0 - ldrsb r0, [r1, r0] - b _080CFFCC - .pool -_080CFFC8: - movs r0, 0x1 - negs r0, r0 -_080CFFCC: - pop {r1} - bx r1 - thumb_func_end sub_80CFF98 - - thumb_func_start sub_80CFFD0 -sub_80CFFD0: @ 80CFFD0 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r5, =gUnknown_02039D08 - ldr r1, [r5] - ldr r2, =0x00000cad - adds r0, r1, r2 - ldrb r0, [r0] - adds r0, 0x2 - subs r2, 0x3E - adds r1, r2 - strb r0, [r1] - ldr r1, [r5] - ldr r6, =0x00000cac - adds r0, r1, r6 - ldrb r0, [r0] - lsls r0, 1 - movs r3, 0xC7 - lsls r3, 4 - adds r1, r3 - strb r0, [r1] - ldr r1, [r5] - adds r2, r1, r2 - ldrb r2, [r2] - movs r0, 0x1D - subs r0, r2 - ldr r2, =0x00000c6d - adds r1, r2 - strb r0, [r1] - ldr r1, [r5] - adds r3, r1, r3 - ldrb r2, [r3] - movs r0, 0xF - subs r0, r2 - ldr r3, =0x00000c6e - adds r1, r3 - strb r0, [r1] - ldr r0, [r5] - ldr r1, =0x00000c6c - adds r0, r1 - bl AddWindow - ldr r1, [r5] - movs r4, 0xCB - lsls r4, 4 - adds r1, r4 - movs r2, 0 - mov r8, r2 - strh r0, [r1] - lsls r0, 24 - lsrs r0, 24 - bl ClearWindowTilemap - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - movs r1, 0 - movs r2, 0xB - movs r3, 0xE - bl SetWindowBorderStyle - ldr r2, [r5] - adds r0, r2, r4 - ldrb r0, [r0] - adds r1, r2, r6 - ldrb r1, [r1] - ldr r3, =0x00000c74 - adds r2, r3 - bl PrintMenuTable - ldr r1, [r5] - adds r4, r1, r4 - ldrb r0, [r4] - adds r1, r6 - ldrb r1, [r1] - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - ldr r0, [r5] - ldr r1, =0x00000cae - adds r0, r1 - mov r2, r8 - strb r2, [r0] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80CFFD0 - - thumb_func_start sub_80D00A8 -sub_80D00A8: @ 80D00A8 - movs r0, 0 - bx lr - thumb_func_end sub_80D00A8 - - thumb_func_start sub_80D00AC -sub_80D00AC: @ 80D00AC - push {r4,r5,lr} - movs r5, 0x2 - negs r5, r5 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080D0102 - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080D00CE - movs r0, 0x5 - bl PlaySE - adds r5, 0x1 -_080D00CE: - ldrh r1, [r4, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _080D00EC - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - negs r0, r0 - bl MoveMenuCursor - b _080D010A - .pool -_080D00EC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080D010A - movs r0, 0x5 - bl PlaySE - movs r0, 0x1 - bl MoveMenuCursor - b _080D010A -_080D0102: - bl GetMenuCursorPos - lsls r0, 24 - lsrs r5, r0, 24 -_080D010A: - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _080D0116 - bl sub_80D013C -_080D0116: - cmp r5, 0 - blt _080D0128 - ldr r0, =gUnknown_02039D08 - ldr r0, [r0] - lsls r1, r5, 3 - ldr r2, =0x00000c78 - adds r0, r2 - adds r0, r1 - ldr r5, [r0] -_080D0128: - lsls r0, r5, 16 - asrs r0, 16 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80D00AC - - thumb_func_start sub_80D013C -sub_80D013C: @ 80D013C - push {r4,r5,lr} - ldr r5, =gUnknown_02039D08 - ldr r0, [r5] - movs r4, 0xCB - lsls r4, 4 - adds r0, r4 - ldrb r0, [r0] - movs r1, 0x1 - bl sub_8198070 - ldr r0, [r5] - adds r0, r4 - ldrb r0, [r0] - bl RemoveWindow - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80D013C thumb_func_start sub_80D0164 sub_80D0164: @ 80D0164 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 3e07135e6..41d57d7ca 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -14596,7 +14596,7 @@ _0801E1B4: movs r0, 0x5 bl PlaySE movs r0, 0x1 - bl MoveMenuCursor + bl Menu_MoveCursor b _0801E23A .pool _0801E1D4: diff --git a/data/pokemon_storage_system.s b/data/pokemon_storage_system.s index a49793c74..0d1cc375f 100644 --- a/data/pokemon_storage_system.s +++ b/data/pokemon_storage_system.s @@ -5,114 +5,6 @@ - .align 2 -gUnknown_0857B9BC:: @ 857B9BC - .4byte sub_80CF0CC, 0 - .4byte sub_80CF5C4, 1 - .4byte sub_80CF7E4, 2 - .4byte sub_80CF8D8, 3 - .4byte NULL, 0 - - .align 2 -gHandCursorSpriteSheets:: @ 857B9E4 - obj_tiles gHandCursorTiles, 0x0800, 0x0000 - obj_tiles gHandCursorShadowTiles, 0x0080, 0x0001 - null_obj_tiles - - .align 2 -gHandCursorSpritePalettes:: @ 857B9FC - obj_pal gHandCursorPalette, 0xDAC7 - null_obj_pal - - .align 2 -gOamData_857BA0C:: @ 857BA0C - .2byte 0x0000 - .2byte 0x8000 - .2byte 0x0400 - - .align 2 -gOamData_857BA14:: @ 857BA14 - .2byte 0x0000 - .2byte 0x4000 - .2byte 0x0400 - - .align 2 -gSpriteAnim_857BA1C:: @ 857BA1C - obj_image_anim_frame 0, 30 - obj_image_anim_frame 16, 30 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_857BA28:: @ 857BA28 - obj_image_anim_frame 0, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857BA30:: @ 857BA30 - obj_image_anim_frame 32, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_857BA38:: @ 857BA38 - obj_image_anim_frame 48, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_857BA40:: @ 857BA40 - .4byte gSpriteAnim_857BA1C - .4byte gSpriteAnim_857BA28 - .4byte gSpriteAnim_857BA30 - .4byte gSpriteAnim_857BA38 - - .align 2 -gSpriteTemplate_857BA50:: @ 857BA50 - spr_template 0, 0xDACA, gOamData_857BA0C, gSpriteAnimTable_857BA40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gSpriteTemplate_857BA68:: @ 857BA68 - spr_template 1, 0xDACA, gOamData_857BA14, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_80CFBF4 - - .align 2 -gUnknown_0857BA80:: @ 857BA80 - .4byte gPCText_Cancel - .4byte gPCText_Store - .4byte gPCText_Withdraw - .4byte gPCText_Move - .4byte gPCText_Shift - .4byte gPCText_Place - .4byte gPCText_Summary - .4byte gPCText_Release - .4byte gPCText_Mark - .4byte gPCText_Jump - .4byte gPCText_Wallpaper - .4byte gPCText_Name - .4byte gPCText_Take - .4byte gPCText_Give - .4byte gPCText_Give - .4byte gPCText_Switch - .4byte gPCText_Bag - .4byte gPCText_Info - .4byte gPCText_Scenery1 - .4byte gPCText_Scenery2 - .4byte gPCText_Scenery3 - .4byte gPCText_Etcetera - .4byte gPCText_Friends - .4byte gPCText_Forest - .4byte gPCText_City - .4byte gPCText_Desert - .4byte gPCText_Savanna - .4byte gPCText_Crag - .4byte gPCText_Volcano - .4byte gPCText_Snow - .4byte gPCText_Cave - .4byte gPCText_Beach - .4byte gPCText_Seafloor - .4byte gPCText_River - .4byte gPCText_Sky - .4byte gPCText_PolkaDot - .4byte gPCText_Pokecenter - .4byte gPCText_Machine - .4byte gPCText_Simple .align 2 gUnknown_0857BB1C:: @ 857BB1C diff --git a/include/menu.h b/include/menu.h index f9b7c52df..198e7bd4a 100644 --- a/include/menu.h +++ b/include/menu.h @@ -43,7 +43,7 @@ void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palet void schedule_bg_copy_tilemap_to_vram(u8 bgNum); void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos); -u8 GetMenuCursorPos(void); +u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); @@ -71,8 +71,8 @@ u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); -u8 MoveMenuCursor(s8 cursorDelta); -u8 MoveMenuCursorNoWrapAround(s8 cursorDelta); +u8 Menu_MoveCursor(s8 cursorDelta); +u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); u8 sub_81979C4(u8 a1); u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index e9b3302c0..530fb7042 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -21,7 +21,7 @@ struct StorageAction u8 format; }; -struct StorageText +struct StorageMenu { const u8 *text; int textId; @@ -124,7 +124,7 @@ struct PokemonStorageSystemData u8 field_A66; u8 field_A67; u8 *wallpaperTiles; - struct Sprite *field_A6C; + struct Sprite *movingMonSprite; struct Sprite *partySprites[PARTY_SIZE]; struct Sprite *boxMonsSprites[IN_BOX_COUNT]; struct Sprite **field_B00; @@ -145,7 +145,15 @@ struct PokemonStorageSystemData s8 field_C69; u8 field_C6A; u8 field_C6B; - u8 field_C6C[72]; + struct WindowTemplate menuWindow; + struct StorageMenu menuItems[7]; + u8 menuItemsCount; + u8 menuWidth; + u8 field_CAE; + u8 field_CAF; + u16 field_CB0; + u8 field_CB2; + u8 field_CB3; struct Sprite *field_CB4; struct Sprite *field_CB8; s32 field_CBC; @@ -161,21 +169,20 @@ struct PokemonStorageSystemData u8 field_CD5; u8 field_CD6; u8 field_CD7; - u8 field_CD8; - u8 field_CD9; + u8 field_CD8[2]; u8 field_CDA; u8 field_CDB; - u32 *field_CDC; + const u32 *cursorMonPalette; u32 cursorMonPersonality; u16 cursorMonSpecies; - u16 selectedItem; + u16 cursorMonItem; u16 field_CE8; u8 field_CEA; - u8 field_CEB; - u8 field_CEC; - u8 field_CED; - u8 field_CEE[POKEMON_NAME_LENGTH + 1]; - u8 cursorMonNick[36]; + u8 cursorMonMarkings; + u8 cursorMonLevel; + bool8 cursorMonIsEgg; + u8 cursorMonNick[POKEMON_NAME_LENGTH + 1]; + u8 cursorMonNickText[36]; u8 cursorMonSpeciesName[36]; u8 cursorMonGenderLvlText[36]; u8 cursorMonItemName[36]; @@ -187,7 +194,7 @@ struct PokemonStorageSystemData u16 *field_DA0; struct PokemonMarkMenu field_DA4; struct UnkPSSStruct_2002370 field_1E5C; - struct Pokemon field_20A4; + struct Pokemon movingMon; struct Pokemon field_2108; s8 field_216C; u8 field_216D; @@ -207,7 +214,11 @@ struct PokemonStorageSystemData u8 field_2186; u8 field_2187; u8 field_2188; - struct BoxPokemon *field_218C; + union + { + struct Pokemon *mon; + struct BoxPokemon *box; + } field_218C; u8 field_2190[40]; u8 field_21B8[40]; u8 field_21E0[POKEMON_NAME_LENGTH + 1]; @@ -217,7 +228,7 @@ struct PokemonStorageSystemData u8 field_21FC; u8 field_21FD; u8 field_21FE; - u8 field_21FF; + u8 inBoxMovingMode; u8 field_2200; u8 field_2201[51]; u16 movingItem; @@ -242,7 +253,7 @@ extern struct PokemonStorageSystemData *gUnknown_02039D08; u8* GetBoxNamePtr(u8 boxNumber); struct BoxPokemon *GetBoxedMonPtr(u8, u8); void SetBoxMonNickFromAnyBox(u8, u8, u8 *); -void CompactPartySlots(void); +s16 CompactPartySlots(void); u32 GetBoxMonDataAt(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index d0926d388..c08c581c3 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -1,6 +1,8 @@ #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H +extern u8 gUnknown_0203CF20; + void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); diff --git a/include/strings.h b/include/strings.h index 744859c3e..1557baa6b 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1434,5 +1434,44 @@ extern const u8 gText_PutItemInBag[]; extern const u8 gText_ItemIsNowHeld[]; extern const u8 gText_ChangedToNewItem[]; extern const u8 gText_MailCantBeStored[]; +extern const u8 gPCText_Cancel[]; +extern const u8 gPCText_Store[]; +extern const u8 gPCText_Withdraw[]; +extern const u8 gPCText_Move[]; +extern const u8 gPCText_Shift[]; +extern const u8 gPCText_Place[]; +extern const u8 gPCText_Summary[]; +extern const u8 gPCText_Release[]; +extern const u8 gPCText_Mark[]; +extern const u8 gPCText_Jump[]; +extern const u8 gPCText_Wallpaper[]; +extern const u8 gPCText_Name[]; +extern const u8 gPCText_Take[]; +extern const u8 gPCText_Give[]; +extern const u8 gPCText_Give[]; +extern const u8 gPCText_Switch[]; +extern const u8 gPCText_Bag[]; +extern const u8 gPCText_Info[]; +extern const u8 gPCText_Scenery1[]; +extern const u8 gPCText_Scenery2[]; +extern const u8 gPCText_Scenery3[]; +extern const u8 gPCText_Etcetera[]; +extern const u8 gPCText_Friends[]; +extern const u8 gPCText_Forest[]; +extern const u8 gPCText_City[]; +extern const u8 gPCText_Desert[]; +extern const u8 gPCText_Savanna[]; +extern const u8 gPCText_Crag[]; +extern const u8 gPCText_Volcano[]; +extern const u8 gPCText_Snow[]; +extern const u8 gPCText_Cave[]; +extern const u8 gPCText_Beach[]; +extern const u8 gPCText_Seafloor[]; +extern const u8 gPCText_River[]; +extern const u8 gPCText_Sky[]; +extern const u8 gPCText_PolkaDot[]; +extern const u8 gPCText_Pokecenter[]; +extern const u8 gPCText_Machine[]; +extern const u8 gPCText_Simple[]; #endif //GUARD_STRINGS_H diff --git a/src/battle_factory_screen.c b/src/battle_factory_screen.c index 60b233daf..93f3aa9cd 100644 --- a/src/battle_factory_screen.c +++ b/src/battle_factory_screen.c @@ -131,8 +131,6 @@ struct FactorySwapMonsStruct bool8 unk30; }; -extern u8 gUnknown_0203CF20; - extern const u16 gBattleFrontierHeldItems[]; extern const struct FacilityMon gBattleFrontierMons[]; extern const struct FacilityMon gSlateportBattleTentMons[]; diff --git a/src/battle_pyramid_bag.c b/src/battle_pyramid_bag.c index 8a6348522..6d71e4b1d 100644 --- a/src/battle_pyramid_bag.c +++ b/src/battle_pyramid_bag.c @@ -964,7 +964,7 @@ static void HandleMenuActionInput(u8 taskId) { if (sub_81221EC() != TRUE) { - s8 id = GetMenuCursorPos(); + s8 id = Menu_GetCursorPos(); if (gMain.newKeys & DPAD_UP) { if (id > 0 && IsValidMenuAction(id - 2)) diff --git a/src/decoration.c b/src/decoration.c index b45dec334..768b1541b 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -519,7 +519,7 @@ void sub_8126B80(u8 taskId) if (!gPaletteFade.active) { - menuPos = GetMenuCursorPos(); + menuPos = Menu_GetCursorPos(); switch (Menu_ProcessInput()) { default: @@ -527,7 +527,7 @@ void sub_8126B80(u8 taskId) sSecretBasePCMenuActions[sSecretBasePCMenuCursorPos].func.void_u8(taskId); break; case -2: - sSecretBasePCMenuCursorPos = GetMenuCursorPos(); + sSecretBasePCMenuCursorPos = Menu_GetCursorPos(); if ((s8)menuPos != sSecretBasePCMenuCursorPos) { sub_8126C08(); diff --git a/src/item_menu.c b/src/item_menu.c index 2c75a80f2..b0eb7c78b 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1564,7 +1564,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId) { if (sub_81221EC() != TRUE) { - s8 cursorPos = GetMenuCursorPos(); + s8 cursorPos = Menu_GetCursorPos(); if (gMain.newKeys & DPAD_UP) { if (cursorPos > 0 && sub_81ACDFC(cursorPos - 2)) diff --git a/src/main_menu.c b/src/main_menu.c index e11f783eb..4cd5c8e14 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1394,7 +1394,7 @@ static void Task_NewGameBirchSpeech_ChooseGender(u8 taskId) gTasks[taskId].func = Task_NewGameBirchSpeech_WhatsYourName; break; } - gender2 = GetMenuCursorPos(); + gender2 = Menu_GetCursorPos(); if (gender2 != gTasks[taskId].tPlayerGender) { gTasks[taskId].tPlayerGender = gender2; diff --git a/src/menu.c b/src/menu.c index 84a0a23f3..e0e5eb4eb 100644 --- a/src/menu.c +++ b/src/menu.c @@ -132,7 +132,7 @@ extern void sub_8197BB4(u8, u8, u8, u8, u8, u8); extern void sub_8197E30(u8, u8, u8, u8, u8, u8); extern void DrawWindowBorder(u8, u8, u8, u8, u8, u8); extern void sub_81980A8(u8, u8, u8, u8, u8, u8); -extern u8 MoveMenuCursor(s8); +extern u8 Menu_MoveCursor(s8); extern u8 sub_8199134(s8, s8); extern void sub_8198C78(void); extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); @@ -910,7 +910,7 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC else gUnknown_0203CD90.cursorPos = pos; - MoveMenuCursor(0); + Menu_MoveCursor(0); return gUnknown_0203CD90.cursorPos; } @@ -935,7 +935,7 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos) AddTextPrinterParameterized(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0); } -u8 MoveMenuCursor(s8 cursorDelta) +u8 Menu_MoveCursor(s8 cursorDelta) { u8 oldPos = gUnknown_0203CD90.cursorPos; int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; @@ -951,7 +951,7 @@ u8 MoveMenuCursor(s8 cursorDelta) return gUnknown_0203CD90.cursorPos; } -u8 MoveMenuCursorNoWrapAround(s8 cursorDelta) +u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta) { u8 oldPos = gUnknown_0203CD90.cursorPos; int newPos = gUnknown_0203CD90.cursorPos + cursorDelta; @@ -967,7 +967,7 @@ u8 MoveMenuCursorNoWrapAround(s8 cursorDelta) return gUnknown_0203CD90.cursorPos; } -u8 GetMenuCursorPos(void) +u8 Menu_GetCursorPos(void) { return gUnknown_0203CD90.cursorPos; } @@ -987,13 +987,13 @@ s8 Menu_ProcessInput(void) else if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); - MoveMenuCursor(-1); + Menu_MoveCursor(-1); return MENU_NOTHING_CHOSEN; } else if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); - MoveMenuCursor(1); + Menu_MoveCursor(1); return MENU_NOTHING_CHOSEN; } @@ -1016,13 +1016,13 @@ s8 Menu_ProcessInputNoWrap(void) } else if (gMain.newKeys & DPAD_UP) { - if (oldPos != MoveMenuCursorNoWrapAround(-1)) + if (oldPos != Menu_MoveCursorNoWrapAround(-1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } else if (gMain.newKeys & DPAD_DOWN) { - if (oldPos != MoveMenuCursorNoWrapAround(1)) + if (oldPos != Menu_MoveCursorNoWrapAround(1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } @@ -1045,13 +1045,13 @@ s8 ProcessMenuInput_other(void) else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) { PlaySE(SE_SELECT); - MoveMenuCursor(-1); + Menu_MoveCursor(-1); return MENU_NOTHING_CHOSEN; } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) { PlaySE(SE_SELECT); - MoveMenuCursor(1); + Menu_MoveCursor(1); return MENU_NOTHING_CHOSEN; } @@ -1074,13 +1074,13 @@ s8 Menu_ProcessInputNoWrapAround_other(void) } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP) { - if (oldPos != MoveMenuCursorNoWrapAround(-1)) + if (oldPos != Menu_MoveCursorNoWrapAround(-1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN) { - if (oldPos != MoveMenuCursorNoWrapAround(1)) + if (oldPos != Menu_MoveCursorNoWrapAround(1)) PlaySE(SE_SELECT); return MENU_NOTHING_CHOSEN; } @@ -1588,7 +1588,7 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo else gUnknown_0203CD90.cursorPos = pos; - return MoveMenuCursor(0); + return Menu_MoveCursor(0); } u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 itemCount, u8 initialCursorPos) diff --git a/src/player_pc.c b/src/player_pc.c index f42d59147..ec0d250b4 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -462,9 +462,9 @@ static void ItemStorageMenuProcessInput(u8 taskId) s8 r2; s8 inputOptionId; - r5 = GetMenuCursorPos(); + r5 = Menu_GetCursorPos(); inputOptionId = Menu_ProcessInput(); - r2 = GetMenuCursorPos(); + r2 = Menu_GetCursorPos(); switch(inputOptionId) { case -2: diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 86041690c..54c83e329 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -1,6 +1,7 @@ #include "global.h" #include "alloc.h" #include "bg.h" +#include "data2.h" #include "decompress.h" #include "dma3.h" #include "dynamic_placeholder_text_util.h" @@ -193,234 +194,245 @@ extern const u8 gText_JustOnePkmn[]; void CreatePCMenu(u8 whichMenu, s16 *windowIdPtr); void Cb2_EnterPSS(u8 boxOption); u8 GetCurrentBoxOption(void); -u8 sub_80CF9EC(void); +static u8 HandleInput(void); u8 sub_80CDC2C(void); u8 sub_80CB9BC(void); void LoadWallpaperGfx(u8 boxId, s8 direction); -void sub_80CCCFC(u8 boxId, s8 direction); -void sub_80CD0B8(s8 direction); +static void sub_80CCCFC(u8 boxId, s8 direction); +static void sub_80CD0B8(s8 direction); void SetBoxWallpaper(u8 boxId, u8 wallpaperId); void SetCurrentBox(u8 boxId); -void sub_80CC32C(u8 boxId); +static void sub_80CC32C(u8 boxId); void ZeroBoxMonAt(u8 boxId, u8 boxPos); -void sub_80C7958(u8 curBox); -void sub_80CCAE0(void *arg0); +static void sub_80C7958(u8 curBox); +static void sub_80CCAE0(void *arg0); void ResetWaldaWallpaper(void); -void sub_80C7B14(void); -void sub_80C7BB4(void); +static void sub_80C7B14(void); +static void sub_80C7BB4(void); void ScrollBackground(void); -void sub_80C7B80(void); +static void sub_80C7B80(void); void sub_80D2AA4(void); -void sub_80C7BE4(void); -void sub_80CAA14(void); -void sub_80CE790(void); -void sub_80CE8E4(void); +static void sub_80C7BE4(void); +static void sub_80CAA14(void); +static void sub_80CFDC4(void); +static void sub_80CE790(void); +static void sub_80CE8E4(void); void GiveChosenBagItem(void); -void SetUpHidePartyMenu(void); -void DestroyAllPartyMonIcons(void); +static void SetUpHidePartyMenu(void); +static void DestroyAllPartyMonIcons(void); void sub_80D11CC(void); void LoadPSSMenuGfx(void); void LoadWaveformSpritePalette(void); -void sub_80CDC18(void); -void sub_80CD36C(void); -void sub_80CD3EC(void); -void sub_80CAC1C(void); -void sub_80CEBDC(void); -void SetScrollingBackground(void); -void sub_80CABE0(void); -void sub_80CAEAC(void); +static void sub_80CDC18(void); +static void sub_80CD36C(void); +static void sub_80CD3EC(void); +static void sub_80CAC1C(void); +static void sub_80CEBDC(void); +static void SetScrollingBackground(void); +static void sub_80CABE0(void); +static void sub_80CAEAC(void); void sub_80D0C60(void); void sub_80CFEA8(void); -void sub_80CDC0C(void); -void sub_80CAF04(void); -void sub_80CA0D8(void); -void sub_80CFFD0(void); -void sub_80CE250(void); -void sub_80CE3A0(void); +static void sub_80CDC0C(void); +static void sub_80CAF04(void); +static void sub_80CA0D8(void); +static void AddMenu(void); +static void sub_80CE250(void); +void InitCanRelaseMonVars(void); void sub_80D01B8(void); -void sub_80CE2D8(void); +void ReleaseMon(void); void sub_80D25F0(void); -void sub_80CA230(void); +void RefreshCursorMonData(void); void LoadCursorMonSprite(void); -void sub_80CA154(void); -void sub_80CA1C4(void); -void sub_80CC064(void); -void sub_80CE324(void); +static void sub_80CA154(void); +static void sub_80CA1C4(void); +static void sub_80CC064(void); +static void sub_80CE324(void); void ClearBottomWindow(void); -void sub_80CA704(void); +static void sub_80CA704(void); void sub_80D013C(void); -void sub_80CE00C(void); +static void sub_80CE00C(void); void sub_80D1194(void); -void PrintCursorMonInfo(void); -void sub_80CA65C(void); -void sub_80CADD8(void); -void sub_80CD02C(void); -void sub_80CFEF0(void); -void sub_80CD158(void); +static void PrintCursorMonInfo(void); +static void sub_80CA65C(void); +static void AddWallpaperSetsMenu(void); +static void sub_80CD02C(void); +static void InitMenu(void); +static void sub_80CD158(void); void sub_80CFC14(void); -void sub_80CEB40(void); -void sub_80CCEE0(void); +static void sub_80CEB40(void); +static void sub_80CCEE0(void); void sub_80D1818(void); -void sub_80CAA74(void); +static void sub_80CAA74(void); void sub_80D17B4(void); -void sub_80CE760(void); -void sub_80CDBA0(void); -void sub_80CE7E8(void); +static void sub_80CE760(void); +static void sub_80CDBA0(void); +static void sub_80CE7E8(void); void sub_80CFECC(void); -void sub_80CA9EC(void); +static void sub_80CA9EC(void); void FreePSSData(void); -void sub_80CCF9C(void); +static void AddBoxMenu(void); +static void sub_80CCF9C(void); void MoveMon(void); void PlaceMon(void); -void sub_80CAB20(void); -void sub_80CE22C(void); -void sub_80CDA68(void); -void sub_80CB950(void); -void sub_80CA9C0(void); -void SetUpDoShowPartyMenu(void); +static void sub_80CAB20(void); +static void sub_80CE22C(void); +static void sub_80CDA68(void); +static void sub_80CB950(void); +static void sub_80CA9C0(void); +static void SetUpDoShowPartyMenu(void); void BoxSetMosaic(void); -void sub_80C7CF4(struct Sprite *sprite); -void sub_80CC100(struct Sprite *sprite); -void sub_80CB278(struct Sprite *sprite); -void sub_80CD210(struct Sprite *sprite); +static void sub_80C7CF4(struct Sprite *sprite); +static void sub_80CC100(struct Sprite *sprite); +static void sub_80CB278(struct Sprite *sprite); +static void sub_80CD210(struct Sprite *sprite); bool32 WaitForWallpaperGfxLoad(void); bool8 InitPSSWindows(void); -bool8 sub_80CC0A0(void); -bool8 sub_80CE2A8(void); +static bool8 sub_80CC0A0(void); +static bool8 sub_80CE2A8(void); bool8 sub_80D0164(void); -bool8 sub_80CC35C(void); +static bool8 sub_80CC35C(void); bool8 sub_80D01E4(void); -bool8 sub_80CDED4(void); -bool8 sub_80CDF08(void); +static bool8 sub_80CDED4(void); +static bool8 sub_80CDF08(void); bool8 sub_80D184C(void); bool8 sub_80D18E4(void); -bool8 DoShowPartyMenu(void); +static bool8 DoShowPartyMenu(void); bool8 sub_80D1218(void); bool8 ScrollToBox(void); bool8 sub_80CD554(void); -bool8 HidePartyMenu(void); +static bool8 HidePartyMenu(void); bool8 sub_80D127C(void); -bool8 sub_80CA2B8(void); -bool8 DoWallpaperGfxChange(void); +bool8 sub_80D0580(u8 arg0); +bool8 sub_80D0BC0(void); +static bool8 sub_80CA2B8(void); +static bool8 DoWallpaperGfxChange(void); bool8 DoMonPlaceChange(void); bool8 sub_80D00A8(void); -bool8 CanMoveMon(void); -bool8 CanShifMon(void); -bool8 IsCursorOnCloseBox(void); -bool8 IsCursorOnBox(void); -bool8 IsCursorInBox(void); -bool8 IsMonBeingMoved(void); -bool8 TryStorePartyMonInBox(u8 boxId); -void Cb_InitPSS(u8 taskId); -void Cb_PlaceMon(u8 taskId); -void Cb_ChangeScreen(u8 taskId); -void Cb_ShowPSS(u8 taskId); -void Cb_OnBPressed(u8 taskId); -void Cb_HandleBoxOptions(u8 taskId); -void Cb_OnSelectedMon(u8 taskId); -void Cb_OnCloseBoxPressed(u8 taskId); -void Cb_HidePartyPokemon(u8 taskId); -void Cb_DepositMenu(u8 taskId); -void Cb_MoveMon(u8 taskId); -void Cb_GiveMovingItemToMon(u8 taskId); -void Cb_SwitchSelectedItem(u8 taskId); -void Cb_TakeItemForMoving(u8 taskId); -void Cb_WithdrawMon(u8 taskId); -void Cb_ShiftMon(u8 taskId); -void Cb_ShowPartyPokemon(u8 taskId); -void Cb_ShowItemInfo(u8 taskId); -void Cb_GiveItemFromBag(u8 taskId); -void Cb_ItemToBag(u8 taskId); -void Cb_TakeItemForMoving(u8 taskId); -void Cb_ShowMarkMenu(u8 taskId); -void Cb_ShowMonSummary(u8 taskId); -void Cb_ReleaseMon(u8 taskId); -void task_pokemon_box_related(u8 taskId); -void Cb_ReshowPSS(u8 taskId); -void Cb_MainPSS(u8 taskId); -void Cb_JumpBox(u8 taskId); -void Cb_HandleWallpapers(u8 taskId); -void Cb_NameBox(u8 taskId); -void Cb_PrintCantStoreMail(u8 taskId); -void Cb_HandleMovingMonFromParty(u8 taskId); +static bool8 CanMovePartyMon(void); +static bool8 CanShifMon(void); +static bool8 IsCursorOnCloseBox(void); +static bool8 IsCursorOnBox(void); +static bool8 IsCursorInBox(void); +static bool8 IsMonBeingMoved(void); +static bool8 TryStorePartyMonInBox(u8 boxId); +static void Cb_InitPSS(u8 taskId); +static void Cb_PlaceMon(u8 taskId); +static void Cb_ChangeScreen(u8 taskId); +static void Cb_ShowPSS(u8 taskId); +static void Cb_OnBPressed(u8 taskId); +static void Cb_HandleBoxOptions(u8 taskId); +static void Cb_OnSelectedMon(u8 taskId); +static void Cb_OnCloseBoxPressed(u8 taskId); +static void Cb_HidePartyPokemon(u8 taskId); +static void Cb_DepositMenu(u8 taskId); +static void Cb_MoveMon(u8 taskId); +static void Cb_GiveMovingItemToMon(u8 taskId); +static void Cb_SwitchSelectedItem(u8 taskId); +static void Cb_TakeItemForMoving(u8 taskId); +static void Cb_WithdrawMon(u8 taskId); +static void Cb_ShiftMon(u8 taskId); +static void Cb_ShowPartyPokemon(u8 taskId); +static void Cb_ShowItemInfo(u8 taskId); +static void Cb_GiveItemFromBag(u8 taskId); +static void Cb_ItemToBag(u8 taskId); +static void Cb_TakeItemForMoving(u8 taskId); +static void Cb_ShowMarkMenu(u8 taskId); +static void Cb_ShowMonSummary(u8 taskId); +static void Cb_ReleaseMon(u8 taskId); +static void Cb_ReshowPSS(u8 taskId); +static void Cb_MainPSS(u8 taskId); +static void Cb_JumpBox(u8 taskId); +static void Cb_HandleWallpapers(u8 taskId); +static void Cb_NameBox(u8 taskId); +static void Cb_PrintCantStoreMail(u8 taskId); +static void Cb_HandleMovingMonFromParty(u8 taskId); void sub_80D2A90(struct UnkStruct_2000020 *arg0, struct UnkStruct_2000028 *arg1, u32 arg2); void sub_80D259C(u8 arg0); -void SetUpScrollToBox(u8 boxId); -void sub_80CFE54(u8 arg0); +static void SetUpScrollToBox(u8 boxId); +void sub_80CFE54(u8 animNum); void sub_80D2918(u8 arg0); -void sub_80CC0D4(u8 priority); +static void SetMovingMonPriority(u8 priority); void InitMonPlaceChange(u8 arg0); -void sub_80CE9A8(u8 markings); +static void SetMonMarkings(u8 markings); void ShowYesNoWindow(s8 cursorPos); -void sub_80CDBF8(u8 arg0); +static void sub_80CDBF8(u8 cursorBoxPosition); void sub_80D01D0(u8 arg0); -void sub_80CD1A8(bool8 arg0); -void sub_80CA984(bool8 arg0); +static void sub_80CD1A8(bool8 arg0); +static void sub_80CA984(bool8 arg0); void CreatePartyMonsSprites(bool8 arg0); void sub_80D2644(u8 arg0, u16 arg1, const void *arg2, u16 arg3, u16 arg4); void sub_80D2770(u8 arg0, u16 arg1, u16 arg2); void PrintStorageActionText(u8 id); s16 sub_80D00AC(void); -s8 sub_80CE580(void); +s8 RunCanReleaseMon(void); u8 GetBoxCursorPosition(void); void sub_80D0E90(bool8 inParty, u8 boxPosition); void sub_80D1080(bool8 inParty, u8 boxPosition); void sub_80D1114(bool8 inParty, u8 boxPosition); void sub_80D0FAC(bool8 inParty, u8 boxPosition); struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority); -void SetWallpaperForCurrentBox(u8 wallpaperId); -void sub_80CAE0C(u8 wallpaperSet); +static void SetWallpaperForCurrentBox(u8 wallpaperId); +static void AddWallpapersMenu(u8 wallpaperSet); u16 GetMovingItem(void); -void SetCurrentBoxMonData(s32 monId, s32 request, const void *value); +void SetCurrentBoxMonData(u8 monId, s32 request, const void *value); s32 GetCurrentBoxMonData(u8 boxPosition, s32 request); void LoadCursorMonGfx(u16 species, u32 pid); -void sub_80CA2D0(struct Sprite *sprite); -void sub_80CCF64(struct Sprite *sprite); -void sub_80CBA3C(struct Sprite *sprite); -void sub_80CCF30(struct Sprite *sprite); +static void sub_80CA2D0(struct Sprite *sprite); +static void sub_80CCF64(struct Sprite *sprite); +static void sub_80CBA3C(struct Sprite *sprite); +static void sub_80CCF30(struct Sprite *sprite); void sub_80D27AC(u8 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); void sub_80D27F4(u8 arg0, u8 arg1, s8 arg2); -void sub_80CBAF0(s16 yDelta); -void sub_80CAAA8(u8 arg0, bool8 isPartyMon); +static void sub_80CBAF0(s16 yDelta); +static void sub_80CAAA8(u8 arg0, bool8 isPartyMon); const u8 *GetMovingItemName(void); bool32 IsWaldaWallpaperUnlocked(void); -void sub_80CFF34(u8 arg0); +static void SetMenuText(u8 textId); void sub_80D0D8C(u8 arg0, u8 cursorPos); void sub_80D0E50(u8 arg0, u8 cursorPos); void sub_80D0F38(u16 item); static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s16 y, u8 oamPriority, u8 subpriority); -void DestroyBoxMonIcon(struct Sprite *sprite); -void SetBoxSpeciesAndPersonalities(u8 boxId); -void sub_80CB9D0(struct Sprite *sprite, u16 partyId); -void sub_80CC370(u8 taskId); -void sub_80CCB50(u8 boxId); +static void DestroyBoxMonIcon(struct Sprite *sprite); +static void SetBoxSpeciesAndPersonalities(u8 boxId); +static void sub_80CB9D0(struct Sprite *sprite, u16 partyId); +static void sub_80CC370(u8 taskId); +static void sub_80CCB50(u8 boxId); s8 sub_80CC644(u8 boxId); u8 GetBoxWallpaper(u8 boxId); u32 GetWaldaWallpaperPatternId(void); u32 GetWaldaWallpaperIconId(void); -void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); +static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2); u16 *GetWaldaWallpaperColorsPtr(void); void sub_80C6D80(u8 *arg0, void *arg1, u8 arg2, u8 arg3, s32 arg4); -s16 sub_80CD00C(const u8 *string); -bool8 MonPlaceChange_Shift(void); -bool8 MonPlaceChange_Move(void); -bool8 MonPlaceChange_Place(void); -bool8 sub_80CDEC4(void); -bool8 sub_80CDEB4(void); -void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3); -void SetShiftedMonData(u8 boxId, u8 position); -void SetMovedMonData(u8 boxId, u8 position); -void SetPlacedMonData(u8 boxId, u8 position); +static s16 sub_80CD00C(const u8 *string); +static bool8 MonPlaceChange_Shift(void); +static bool8 MonPlaceChange_Move(void); +static bool8 MonPlaceChange_Place(void); +static bool8 sub_80CDEC4(void); +static bool8 sub_80CDEB4(void); +void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y); +static void SetShiftedMonData(u8 boxId, u8 position); +static void SetMovedMonData(u8 boxId, u8 position); +static void SetPlacedMonData(u8 boxId, u8 position); void PurgeMonOrBoxMon(u8 boxId, u8 position); void BoxMonAtToMon(u8 boxId, u8 position, struct Pokemon *dst); void SetBoxMonAt(u8 boxId, u8 position, struct BoxPokemon *src); -void sub_80CEC00(struct Pokemon *mon, u8 arg1); +static void SetCursorMonData(void *pokemon, u8 mode); bool32 AtLeastThreeUsableMons(void); bool32 CheckBoxedMonSanity(s32 boxId, s32 boxPosition); s32 GetAndCopyBoxMonDataAt(u8 boxId, u8 boxPosition, s32 request, void *dst); +static u8 InBoxInput_Normal(void); +static u8 InBoxInput_MovingMultiple(void); +static u8 InBoxInput_GrabbingMultiple(void); +s8 sub_80CFF98(u8 arg0); +u8 sub_80CFA5C(void); +u8 sub_80D0BA4(void); +static bool8 sub_80CFA84(void); +static bool8 sub_80CFB44(void); -// const rom data -const struct PSS_MenuStringPtrs gUnknown_085716C0[] = +// static const rom data +static const struct PSS_MenuStringPtrs gUnknown_085716C0[] = { {gText_WithdrawPokemon, gText_WithdrawMonDescription}, {gText_DepositPokemon, gText_DepositMonDescription}, @@ -429,7 +441,7 @@ const struct PSS_MenuStringPtrs gUnknown_085716C0[] = {gText_SeeYa, gText_SeeYaDescription} }; -const struct WindowTemplate gUnknown_085716E8 = +static const struct WindowTemplate gUnknown_085716E8 = { .bg = 0, .tilemapLeft = 1, @@ -440,31 +452,31 @@ const struct WindowTemplate gUnknown_085716E8 = .baseBlock = 0x1, }; -const union AnimCmd sSpriteAnim_85716F0[] = +static const union AnimCmd sSpriteAnim_85716F0[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_85716F8[] = +static const union AnimCmd sSpriteAnim_85716F8[] = { ANIMCMD_FRAME(4, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_8571700[] = +static const union AnimCmd sSpriteAnim_8571700[] = { ANIMCMD_FRAME(6, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_8571708[] = +static const union AnimCmd sSpriteAnim_8571708[] = { ANIMCMD_FRAME(10, 5), ANIMCMD_END }; -const union AnimCmd *const sSpriteAnimTable_8571710[] = +static const union AnimCmd *const sSpriteAnimTable_8571710[] = { sSpriteAnim_85716F0, sSpriteAnim_85716F8, @@ -472,60 +484,60 @@ const union AnimCmd *const sSpriteAnimTable_8571710[] = sSpriteAnim_8571708 }; -const union AffineAnimCmd sSpriteAffineAnim_8571720[] = +static const union AffineAnimCmd sSpriteAffineAnim_8571720[] = { AFFINEANIMCMD_FRAME(0xE0, 0xE0, 0, 0), AFFINEANIMCMD_END }; -const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] = +static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] = { sSpriteAffineAnim_8571720 }; -const u8 gUnknown_08571734[] = {4, 0xF, 0xE}; -const u8 gUnknown_08571737[] = _("/30"); +static const u8 gUnknown_08571734[] = {4, 0xF, 0xE}; +static const u8 gUnknown_08571737[] = _("/30"); -const u16 gBoxSelectionPopupPalette[] = INCBIN_U16("graphics/unknown/unknown_57173C.gbapal"); -const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp"); -const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); -const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); -const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); -const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal"); -const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz"); +static const u16 gBoxSelectionPopupPalette[] = INCBIN_U16("graphics/unknown/unknown_57173C.gbapal"); +static const u8 gBoxSelectionPopupCenterTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_center.4bpp"); +static const u8 gBoxSelectionPopupSidesTiles[] = INCBIN_U8("graphics/pokemon_storage/box_selection_popup_sides.4bpp"); +static const u32 gPokemonStorageScrollingBGTileset[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.4bpp.lz"); +static const u32 gPokemonStorageScrollingBGTilemap[] = INCBIN_U32("graphics/pokemon_storage/scrolling_bg.bin.lz"); +static const u32 gUnknown_08572280[] = INCBIN_U32("graphics/unknown/unknown_572280.gbapal"); +static const u32 gUnknown_085722A0[] = INCBIN_U32("graphics/unknown/unknown_5722A0.bin.lz"); -const u16 gUnknown_0857239C[] = +static const u16 gUnknown_0857239C[] = { 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118, }; -const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); // Left-most part and Close Box. -const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal"); -const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal"); -const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal"); +static const u16 gUnknown_085723DC[] = INCBIN_U16("graphics/unknown/unknown_5723DC.gbapal"); // Left-most part and Close Box. +static const u16 gUnknown_085723FC[] = INCBIN_U16("graphics/unknown/unknown_5723FC.gbapal"); +static const u16 gUnknown_0857241C[] = INCBIN_U16("graphics/unknown/unknown_57241C.gbapal"); +static const u16 gUnknown_0857243C[] = INCBIN_U16("graphics/unknown/unknown_57243C.gbapal"); -const u16 gUnknown_0857245C[] = +static const u16 gUnknown_0857245C[] = { 0x014c, 0x014d, 0x014e, 0x014f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x015c, 0x015d, 0x015e, 0x015f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018a, 0x018b, 0x018c, 0x018d }; -const u16 gUnknown_085724A4[] = +static const u16 gUnknown_085724A4[] = { 0x1140, 0x1141, 0x1141, 0x1142, 0x1150, 0x1151, 0x1151, 0x1152, 0x1160, 0x1161, 0x1161, 0x1162, }; -const u16 gUnknown_085724BC[] = +static const u16 gUnknown_085724BC[] = { 0x1143, 0x1144, 0x1144, 0x1145, 0x1153, 0x1154, 0x1154, 0x1155, 0x1163, 0x1164, 0x1164, 0x1165, }; -const u16 gWaveformPalette[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal"); -const u32 gWaveformTiles[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp"); -const u32 gUnknown_085726B4[] = INCBIN_U32("graphics/unused/unknown_5726B4.gbapal"); -const u32 gUnknown_085726F4[] = INCBIN_U32("graphics/unknown/unknown_5726F4.gbapal"); +static const u16 gWaveformPalette[] = INCBIN_U16("graphics/pokemon_storage/waveform.gbapal"); +static const u32 gWaveformTiles[] = INCBIN_U32("graphics/pokemon_storage/waveform.4bpp"); +static const u32 gUnknown_085726B4[] = INCBIN_U32("graphics/unused/unknown_5726B4.gbapal"); +static const u32 gUnknown_085726F4[] = INCBIN_U32("graphics/unknown/unknown_5726F4.gbapal"); -const struct WindowTemplate gUnknown_08572714[] = +static const struct WindowTemplate gUnknown_08572714[] = { { // 0 .bg = 1, @@ -557,7 +569,7 @@ const struct WindowTemplate gUnknown_08572714[] = DUMMY_WIN_TEMPLATE }; -const struct BgTemplate gUnknown_08572734[] = +static const struct BgTemplate gUnknown_08572734[] = { { .bg = 0, @@ -597,18 +609,18 @@ const struct BgTemplate gUnknown_08572734[] = }, }; -const struct SpritePalette gWaveformSpritePalette = +static const struct SpritePalette gWaveformSpritePalette = { gWaveformPalette, TAG_PAL_WAVEFORM }; -const struct SpriteSheet gWaveformSpriteSheet = +static const struct SpriteSheet gWaveformSpriteSheet = { gWaveformTiles, sizeof(gWaveformTiles), TAG_TILE_WAVEFORM }; -const struct OamData sOamData_857286C; -const struct SpriteTemplate sSpriteTemplate_CursorMon = +static const struct OamData sOamData_857286C; +static const struct SpriteTemplate sSpriteTemplate_CursorMon = { .tileTag = TAG_TILE_2, .paletteTag = TAG_PAL_DAC6, @@ -619,7 +631,7 @@ const struct SpriteTemplate sSpriteTemplate_CursorMon = .callback = SpriteCallbackDummy, }; -const struct StorageAction gPCStorageActionTexts[] = +static const struct StorageAction gPCStorageActionTexts[] = { [PC_TEXT_EXIT_BOX] = {gText_ExitFromBox, PC_TEXT_FMT_NORMAL}, [PC_TEXT_WHAT_YOU_DO] = {gText_WhatDoYouWantToDo, PC_TEXT_FMT_NORMAL}, @@ -654,7 +666,7 @@ const struct StorageAction gPCStorageActionTexts[] = [PC_TEXT_CANT_STORE_MAIL] = {gText_MailCantBeStored, PC_TEXT_FMT_NORMAL}, }; -const struct WindowTemplate sYesNoWindowTemplate = +static const struct WindowTemplate sYesNoWindowTemplate = { .bg = 0, .tilemapLeft = 24, @@ -665,7 +677,7 @@ const struct WindowTemplate sYesNoWindowTemplate = .baseBlock = 0x5C, }; -const struct OamData sOamData_857286C = +static const struct OamData sOamData_857286C = { .y = 0, .affineMode = 0, @@ -682,7 +694,7 @@ const struct OamData sOamData_857286C = .affineParam = 0 }; -const struct OamData sOamData_8572874 = +static const struct OamData sOamData_8572874 = { .y = 0, .affineMode = 0, @@ -699,13 +711,13 @@ const struct OamData sOamData_8572874 = .affineParam = 0 }; -const union AnimCmd sSpriteAnim_857287C[] = +static const union AnimCmd sSpriteAnim_857287C[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_8572884[] = +static const union AnimCmd sSpriteAnim_8572884[] = { ANIMCMD_FRAME(2, 8), ANIMCMD_FRAME(4, 8), @@ -713,13 +725,13 @@ const union AnimCmd sSpriteAnim_8572884[] = ANIMCMD_JUMP(0) }; -const union AnimCmd sSpriteAnim_8572894[] = +static const union AnimCmd sSpriteAnim_8572894[] = { ANIMCMD_FRAME(8, 5), ANIMCMD_END }; -const union AnimCmd sSpriteAnim_857289C[] = +static const union AnimCmd sSpriteAnim_857289C[] = { ANIMCMD_FRAME(10, 8), ANIMCMD_FRAME(4, 8), @@ -727,7 +739,7 @@ const union AnimCmd sSpriteAnim_857289C[] = ANIMCMD_JUMP(0) }; -const union AnimCmd *const sSpriteAnimTable_85728AC[] = +static const union AnimCmd *const sSpriteAnimTable_85728AC[] = { sSpriteAnim_857287C, sSpriteAnim_8572884, @@ -735,7 +747,7 @@ const union AnimCmd *const sSpriteAnimTable_85728AC[] = sSpriteAnim_857289C }; -const struct SpriteTemplate gUnknown_085728BC = +static const struct SpriteTemplate gUnknown_085728BC = { .tileTag = 5, .paletteTag = 0xDACA, @@ -746,8 +758,8 @@ const struct SpriteTemplate gUnknown_085728BC = .callback = SpriteCallbackDummy, }; -const struct OamData sOamData_85728EC; -const struct SpriteTemplate gUnknown_085728D4 = +static const struct OamData sOamData_85728EC; +static const struct SpriteTemplate gUnknown_085728D4 = { .tileTag = 18, .paletteTag = 0xDAC0, @@ -758,7 +770,7 @@ const struct SpriteTemplate gUnknown_085728D4 = .callback = SpriteCallbackDummy, }; -const struct OamData sOamData_85728EC = +static const struct OamData sOamData_85728EC = { .y = 0, .affineMode = 0, @@ -775,156 +787,156 @@ const struct OamData sOamData_85728EC = .affineParam = 0 }; -const union AffineAnimCmd gSpriteAffineAnim_85728F4[] = +static const union AffineAnimCmd gSpriteAffineAnim_85728F4[] = { AFFINEANIMCMD_FRAME(-2, -2, 0, 120), AFFINEANIMCMD_END }; -const union AffineAnimCmd gSpriteAffineAnim_8572904[] = +static const union AffineAnimCmd gSpriteAffineAnim_8572904[] = { AFFINEANIMCMD_FRAME(16, 16, 0, 0), AFFINEANIMCMD_FRAME(16, 16, 0, 15), AFFINEANIMCMD_END }; -const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = +static const union AffineAnimCmd *const gSpriteAffineAnimTable_857291C[] = { gSpriteAffineAnim_85728F4, gSpriteAffineAnim_8572904 }; -const u16 gWallpaperPalettes_Forest[][16] = +static const u16 gWallpaperPalettes_Forest[][16] = { INCBIN_U16("graphics/pokemon_storage/forest_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/forest_bg.gbapal"), }; -const u32 gWallpaperTiles_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.4bpp.lz"); -const u32 gWallpaperTilemap_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.bin.lz"); +static const u32 gWallpaperTiles_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.4bpp.lz"); +static const u32 gWallpaperTilemap_Forest[] = INCBIN_U32("graphics/pokemon_storage/forest.bin.lz"); -const u16 gWallpaperPalettes_City[][16] = +static const u16 gWallpaperPalettes_City[][16] = { INCBIN_U16("graphics/pokemon_storage/city_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/city_bg.gbapal"), }; -const u32 gWallpaperTiles_City[] = INCBIN_U32("graphics/pokemon_storage/city.4bpp.lz"); -const u32 gWallpaperTilemap_City[] = INCBIN_U32("graphics/pokemon_storage/city.bin.lz"); +static const u32 gWallpaperTiles_City[] = INCBIN_U32("graphics/pokemon_storage/city.4bpp.lz"); +static const u32 gWallpaperTilemap_City[] = INCBIN_U32("graphics/pokemon_storage/city.bin.lz"); -const u16 gWallpaperPalettes_Desert[][16] = +static const u16 gWallpaperPalettes_Desert[][16] = { INCBIN_U16("graphics/pokemon_storage/desert_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/desert_bg.gbapal"), }; -const u32 gWallpaperTiles_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.4bpp.lz"); -const u32 gWallpaperTilemap_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.bin.lz"); +static const u32 gWallpaperTiles_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.4bpp.lz"); +static const u32 gWallpaperTilemap_Desert[] = INCBIN_U32("graphics/pokemon_storage/desert.bin.lz"); -const u16 gWallpaperPalettes_Savanna[][16] = +static const u16 gWallpaperPalettes_Savanna[][16] = { INCBIN_U16("graphics/pokemon_storage/savanna_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/savanna_bg.gbapal"), }; -const u32 gWallpaperTiles_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.4bpp.lz"); -const u32 gWallpaperTilemap_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.bin.lz"); +static const u32 gWallpaperTiles_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.4bpp.lz"); +static const u32 gWallpaperTilemap_Savanna[] = INCBIN_U32("graphics/pokemon_storage/savanna.bin.lz"); -const u16 gWallpaperPalettes_Crag[][16] = +static const u16 gWallpaperPalettes_Crag[][16] = { INCBIN_U16("graphics/pokemon_storage/crag_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/crag_bg.gbapal"), }; -const u32 gWallpaperTiles_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.4bpp.lz"); -const u32 gWallpaperTilemap_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.bin.lz"); +static const u32 gWallpaperTiles_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.4bpp.lz"); +static const u32 gWallpaperTilemap_Crag[] = INCBIN_U32("graphics/pokemon_storage/crag.bin.lz"); -const u16 gWallpaperPalettes_Volcano[][16] = +static const u16 gWallpaperPalettes_Volcano[][16] = { INCBIN_U16("graphics/pokemon_storage/volcano_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/volcano_bg.gbapal"), }; -const u32 gWallpaperTiles_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.4bpp.lz"); -const u32 gWallpaperTilemap_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.bin.lz"); +static const u32 gWallpaperTiles_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.4bpp.lz"); +static const u32 gWallpaperTilemap_Volcano[] = INCBIN_U32("graphics/pokemon_storage/volcano.bin.lz"); -const u16 gWallpaperPalettes_Snow[][16] = +static const u16 gWallpaperPalettes_Snow[][16] = { INCBIN_U16("graphics/pokemon_storage/snow_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/snow_bg.gbapal"), }; -const u32 gWallpaperTiles_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.4bpp.lz"); -const u32 gWallpaperTilemap_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.bin.lz"); +static const u32 gWallpaperTiles_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.4bpp.lz"); +static const u32 gWallpaperTilemap_Snow[] = INCBIN_U32("graphics/pokemon_storage/snow.bin.lz"); -const u16 gWallpaperPalettes_Cave[][16] = +static const u16 gWallpaperPalettes_Cave[][16] = { INCBIN_U16("graphics/pokemon_storage/cave_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/cave_bg.gbapal"), }; -const u32 gWallpaperTiles_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.4bpp.lz"); -const u32 gWallpaperTilemap_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.bin.lz"); +static const u32 gWallpaperTiles_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.4bpp.lz"); +static const u32 gWallpaperTilemap_Cave[] = INCBIN_U32("graphics/pokemon_storage/cave.bin.lz"); -const u16 gWallpaperPalettes_Beach[][16] = +static const u16 gWallpaperPalettes_Beach[][16] = { INCBIN_U16("graphics/pokemon_storage/beach_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/beach_bg.gbapal"), }; -const u32 gWallpaperTiles_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.4bpp.lz"); -const u32 gWallpaperTilemap_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.bin.lz"); +static const u32 gWallpaperTiles_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.4bpp.lz"); +static const u32 gWallpaperTilemap_Beach[] = INCBIN_U32("graphics/pokemon_storage/beach.bin.lz"); -const u16 gWallpaperPalettes_Seafloor[][16] = +static const u16 gWallpaperPalettes_Seafloor[][16] = { INCBIN_U16("graphics/pokemon_storage/seafloor_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/seafloor_bg.gbapal"), }; -const u32 gWallpaperTiles_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.4bpp.lz"); -const u32 gWallpaperTilemap_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.bin.lz"); +static const u32 gWallpaperTiles_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.4bpp.lz"); +static const u32 gWallpaperTilemap_Seafloor[] = INCBIN_U32("graphics/pokemon_storage/seafloor.bin.lz"); -const u16 gWallpaperPalettes_River[][16] = +static const u16 gWallpaperPalettes_River[][16] = { INCBIN_U16("graphics/pokemon_storage/river_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/river_bg.gbapal"), }; -const u32 gWallpaperTiles_River[] = INCBIN_U32("graphics/pokemon_storage/river.4bpp.lz"); -const u32 gWallpaperTilemap_River[] = INCBIN_U32("graphics/pokemon_storage/river.bin.lz"); -const u16 gWallpaperPalettes_Sky[][16] = +static const u32 gWallpaperTiles_River[] = INCBIN_U32("graphics/pokemon_storage/river.4bpp.lz"); +static const u32 gWallpaperTilemap_River[] = INCBIN_U32("graphics/pokemon_storage/river.bin.lz"); +static const u16 gWallpaperPalettes_Sky[][16] = { INCBIN_U16("graphics/pokemon_storage/sky_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/sky_bg.gbapal"), }; -const u32 gWallpaperTiles_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.4bpp.lz"); -const u32 gWallpaperTilemap_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.bin.lz"); +static const u32 gWallpaperTiles_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.4bpp.lz"); +static const u32 gWallpaperTilemap_Sky[] = INCBIN_U32("graphics/pokemon_storage/sky.bin.lz"); -const u16 gWallpaperPalettes_PolkaDot[][16] = +static const u16 gWallpaperPalettes_PolkaDot[][16] = { INCBIN_U16("graphics/pokemon_storage/polkadot_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/polkadot_bg.gbapal"), }; -const u32 gWallpaperTiles_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.4bpp.lz"); -const u32 gWallpaperTilemap_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.bin.lz"); +static const u32 gWallpaperTiles_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.4bpp.lz"); +static const u32 gWallpaperTilemap_PolkaDot[] = INCBIN_U32("graphics/pokemon_storage/polkadot.bin.lz"); -const u16 gWallpaperPalettes_Pokecenter[][16] = +static const u16 gWallpaperPalettes_Pokecenter[][16] = { INCBIN_U16("graphics/pokemon_storage/pokecenter_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/pokecenter_bg.gbapal"), }; -const u32 gWallpaperTiles_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.4bpp.lz"); -const u32 gWallpaperTilemap_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.bin.lz"); +static const u32 gWallpaperTiles_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.4bpp.lz"); +static const u32 gWallpaperTilemap_Pokecenter[] = INCBIN_U32("graphics/pokemon_storage/pokecenter.bin.lz"); -const u16 gWallpaperPalettes_Machine[][16] = +static const u16 gWallpaperPalettes_Machine[][16] = { INCBIN_U16("graphics/pokemon_storage/machine_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/machine_bg.gbapal"), }; -const u32 gWallpaperTiles_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.4bpp.lz"); -const u32 gWallpaperTilemap_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.bin.lz"); +static const u32 gWallpaperTiles_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.4bpp.lz"); +static const u32 gWallpaperTilemap_Machine[] = INCBIN_U32("graphics/pokemon_storage/machine.bin.lz"); -const u16 gWallpaperPalettes_Plain[][16] = +static const u16 gWallpaperPalettes_Plain[][16] = { INCBIN_U16("graphics/pokemon_storage/plain_frame.gbapal"), INCBIN_U16("graphics/pokemon_storage/plain_bg.gbapal"), }; -const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz"); -const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz"); +static const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz"); +static const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz"); // 12×18 tilemap -const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); +static const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); -const u16 gUnknown_08577574[][2] = +static const u16 gUnknown_08577574[][2] = { {0x1CE7, 0x7FFF}, {0x1CE7, 0x7FFF}, @@ -947,7 +959,7 @@ const u16 gUnknown_08577574[][2] = #define WALLPAPER_ENTRY(name) {gWallpaperTiles_##name, gWallpaperTilemap_##name, gWallpaperPalettes_##name[0]} -const struct WallpaperTable gWallpaperTable[] = +static const struct WallpaperTable gWallpaperTable[] = { [WALLPAPER_FOREST] = WALLPAPER_ENTRY(Forest), [WALLPAPER_CITY] = WALLPAPER_ENTRY(City), @@ -967,149 +979,149 @@ const struct WallpaperTable gWallpaperTable[] = [WALLPAPER_PLAIN] = WALLPAPER_ENTRY(Plain), }; -const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); +static const u8 gPCGfx_Arrow[] = INCBIN_U8("graphics/pokemon_storage/arrow.4bpp"); -const u16 gWallpaperPalettes_Zigzagoon[][16] = +static const u16 gWallpaperPalettes_Zigzagoon[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), }; -const u32 gWallpaperTiles_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.4bpp.lz"); -const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.bin.lz"); +static const u32 gWallpaperTiles_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.4bpp.lz"); +static const u32 gWallpaperTilemap_Zigzagoon[] = INCBIN_U32("graphics/pokemon_storage/zigzagoon.bin.lz"); -const u16 gWallpaperPalettes_Screen[][16] = +static const u16 gWallpaperPalettes_Screen[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/screen_bg.gbapal"), }; -const u32 gWallpaperTiles_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.4bpp.lz"); -const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.bin.lz"); +static const u32 gWallpaperTiles_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.4bpp.lz"); +static const u32 gWallpaperTilemap_Screen[] = INCBIN_U32("graphics/pokemon_storage/screen.bin.lz"); -const u16 gWallpaperPalettes_Diagonal[][16] = +static const u16 gWallpaperPalettes_Diagonal[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/diagonal_bg.gbapal"), }; -const u32 gWallpaperTiles_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.4bpp.lz"); -const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.bin.lz"); +static const u32 gWallpaperTiles_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.4bpp.lz"); +static const u32 gWallpaperTilemap_Diagonal[] = INCBIN_U32("graphics/pokemon_storage/diagonal.bin.lz"); -const u16 gWallpaperPalettes_Block[][16] = +static const u16 gWallpaperPalettes_Block[][16] = { INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), INCBIN_U16("graphics/pokemon_storage/block_bg.gbapal"), }; -const u32 gWallpaperTiles_Block[] = INCBIN_U32("graphics/pokemon_storage/block.4bpp.lz"); -const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storage/block.bin.lz"); +static const u32 gWallpaperTiles_Block[] = INCBIN_U32("graphics/pokemon_storage/block.4bpp.lz"); +static const u32 gWallpaperTilemap_Block[] = INCBIN_U32("graphics/pokemon_storage/block.bin.lz"); -const u16 gWallpaperPalettes_Pokecenter2[][16] = +static const u16 gWallpaperPalettes_Pokecenter2[][16] = { INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), INCBIN_U16("graphics/pokemon_storage/pokecenter2_bg.gbapal"), }; -const u32 gWallpaperTiles_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.4bpp.lz"); -const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.bin.lz"); +static const u32 gWallpaperTiles_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.4bpp.lz"); +static const u32 gWallpaperTilemap_Pokecenter2[] = INCBIN_U32("graphics/pokemon_storage/pokecenter2.bin.lz"); -const u16 gWallpaperPalettes_Frame[][16] = +static const u16 gWallpaperPalettes_Frame[][16] = { INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), INCBIN_U16("graphics/pokemon_storage/frame_bg.gbapal"), }; -const u32 gWallpaperTiles_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.4bpp.lz"); -const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.bin.lz"); +static const u32 gWallpaperTiles_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.4bpp.lz"); +static const u32 gWallpaperTilemap_Frame[] = INCBIN_U32("graphics/pokemon_storage/frame.bin.lz"); -const u16 gWallpaperPalettes_Blank[][16] = +static const u16 gWallpaperPalettes_Blank[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame1.gbapal"), INCBIN_U16("graphics/pokemon_storage/zigzagoon_bg.gbapal"), }; -const u32 gWallpaperTiles_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.4bpp.lz"); -const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.bin.lz"); +static const u32 gWallpaperTiles_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.4bpp.lz"); +static const u32 gWallpaperTilemap_Blank[] = INCBIN_U32("graphics/pokemon_storage/blank.bin.lz"); -const u16 gWallpaperPalettes_Circles[][16] = +static const u16 gWallpaperPalettes_Circles[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/circles_bg.gbapal"), }; -const u32 gWallpaperTiles_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.4bpp.lz"); -const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.bin.lz"); +static const u32 gWallpaperTiles_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.4bpp.lz"); +static const u32 gWallpaperTilemap_Circles[] = INCBIN_U32("graphics/pokemon_storage/circles.bin.lz"); -const u16 gWallpaperPalettes_Azumarill[][16] = +static const u16 gWallpaperPalettes_Azumarill[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/azumarill_bg.gbapal"), }; -const u32 gWallpaperTiles_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.4bpp.lz"); -const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.bin.lz"); +static const u32 gWallpaperTiles_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.4bpp.lz"); +static const u32 gWallpaperTilemap_Azumarill[] = INCBIN_U32("graphics/pokemon_storage/azumarill.bin.lz"); -const u16 gWallpaperPalettes_Pikachu[][16] = +static const u16 gWallpaperPalettes_Pikachu[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/pikachu_bg.gbapal"), }; -const u32 gWallpaperTiles_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.4bpp.lz"); -const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.bin.lz"); +static const u32 gWallpaperTiles_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.4bpp.lz"); +static const u32 gWallpaperTilemap_Pikachu[] = INCBIN_U32("graphics/pokemon_storage/pikachu.bin.lz"); -const u16 gWallpaperPalettes_Legendary[][16] = +static const u16 gWallpaperPalettes_Legendary[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/legendary_bg.gbapal"), }; -const u32 gWallpaperTiles_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.4bpp.lz"); -const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.bin.lz"); +static const u32 gWallpaperTiles_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.4bpp.lz"); +static const u32 gWallpaperTilemap_Legendary[] = INCBIN_U32("graphics/pokemon_storage/legendary.bin.lz"); -const u16 gWallpaperPalettes_Dusclops[][16] = +static const u16 gWallpaperPalettes_Dusclops[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/dusclops_bg.gbapal"), }; -const u32 gWallpaperTiles_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.4bpp.lz"); -const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.bin.lz"); +static const u32 gWallpaperTiles_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.4bpp.lz"); +static const u32 gWallpaperTilemap_Dusclops[] = INCBIN_U32("graphics/pokemon_storage/dusclops.bin.lz"); -const u16 gWallpaperPalettes_Ludicolo[][16] = +static const u16 gWallpaperPalettes_Ludicolo[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/ludicolo_bg.gbapal"), }; -const u32 gWallpaperTiles_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.4bpp.lz"); -const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.bin.lz"); +static const u32 gWallpaperTiles_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.4bpp.lz"); +static const u32 gWallpaperTilemap_Ludicolo[] = INCBIN_U32("graphics/pokemon_storage/ludicolo.bin.lz"); -const u16 gWallpaperPalettes_Whiscash[][16] = +static const u16 gWallpaperPalettes_Whiscash[][16] = { INCBIN_U16("graphics/pokemon_storage/friends_frame2.gbapal"), INCBIN_U16("graphics/pokemon_storage/whiscash_bg.gbapal"), }; -const u32 gWallpaperTiles_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.4bpp.lz"); -const u32 gWallpaperTilemap_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.bin.lz"); +static const u32 gWallpaperTiles_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.4bpp.lz"); +static const u32 gWallpaperTilemap_Whiscash[] = INCBIN_U32("graphics/pokemon_storage/whiscash.bin.lz"); -const u32 gWallpaperIcon_Aqua[] = INCBIN_U32("graphics/pokemon_storage/aqua_icon.4bpp.lz"); -const u32 gWallpaperIcon_Heart[] = INCBIN_U32("graphics/pokemon_storage/heart_icon.4bpp.lz"); -const u32 gWallpaperIcon_FiveStar[] = INCBIN_U32("graphics/pokemon_storage/five_star_icon.4bpp.lz"); -const u32 gWallpaperIcon_Brick[] = INCBIN_U32("graphics/pokemon_storage/brick_icon.4bpp.lz"); -const u32 gWallpaperIcon_FourStar[] = INCBIN_U32("graphics/pokemon_storage/four_star_icon.4bpp.lz"); -const u32 gWallpaperIcon_Asterisk[] = INCBIN_U32("graphics/pokemon_storage/asterisk_icon.4bpp.lz"); -const u32 gWallpaperIcon_Dot[] = INCBIN_U32("graphics/pokemon_storage/dot_icon.4bpp.lz"); -const u32 gWallpaperIcon_LineCircle[] = INCBIN_U32("graphics/pokemon_storage/line_circle_icon.4bpp.lz"); -const u32 gWallpaperIcon_PokeBall[] = INCBIN_U32("graphics/pokemon_storage/pokeball_icon.4bpp.lz"); -const u32 gWallpaperIcon_Maze[] = INCBIN_U32("graphics/pokemon_storage/maze_icon.4bpp.lz"); -const u32 gWallpaperIcon_Footprint[] = INCBIN_U32("graphics/pokemon_storage/footprint_icon.4bpp.lz"); -const u32 gWallpaperIcon_BigAsterisk[] = INCBIN_U32("graphics/pokemon_storage/big_asterisk_icon.4bpp.lz"); -const u32 gWallpaperIcon_Circle[] = INCBIN_U32("graphics/pokemon_storage/circle_icon.4bpp.lz"); -const u32 gWallpaperIcon_Koffing[] = INCBIN_U32("graphics/pokemon_storage/koffing_icon.4bpp.lz"); -const u32 gWallpaperIcon_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon_icon.4bpp.lz"); -const u32 gWallpaperIcon_FourCircles[] = INCBIN_U32("graphics/pokemon_storage/four_circles_icon.4bpp.lz"); -const u32 gWallpaperIcon_Lotad[] = INCBIN_U32("graphics/pokemon_storage/lotad_icon.4bpp.lz"); -const u32 gWallpaperIcon_Crystal[] = INCBIN_U32("graphics/pokemon_storage/crystal_icon.4bpp.lz"); -const u32 gWallpaperIcon_Pichu[] = INCBIN_U32("graphics/pokemon_storage/pichu_icon.4bpp.lz"); -const u32 gWallpaperIcon_Diglett[] = INCBIN_U32("graphics/pokemon_storage/diglett_icon.4bpp.lz"); -const u32 gWallpaperIcon_Luvdisc[] = INCBIN_U32("graphics/pokemon_storage/luvdisc_icon.4bpp.lz"); -const u32 gWallpaperIcon_StarInCircle[] = INCBIN_U32("graphics/pokemon_storage/star_in_circle_icon.4bpp.lz"); -const u32 gWallpaperIcon_Spinda[] = INCBIN_U32("graphics/pokemon_storage/spinda_icon.4bpp.lz"); -const u32 gWallpaperIcon_Latis[] = INCBIN_U32("graphics/pokemon_storage/latis_icon.4bpp.lz"); -const u32 gWallpaperIcon_Minun[] = INCBIN_U32("graphics/pokemon_storage/minun_icon.4bpp.lz"); -const u32 gWallpaperIcon_Togepi[] = INCBIN_U32("graphics/pokemon_storage/togepi_icon.4bpp.lz"); -const u32 gWallpaperIcon_Magma[] = INCBIN_U32("graphics/pokemon_storage/magma_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Aqua[] = INCBIN_U32("graphics/pokemon_storage/aqua_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Heart[] = INCBIN_U32("graphics/pokemon_storage/heart_icon.4bpp.lz"); +static const u32 gWallpaperIcon_FiveStar[] = INCBIN_U32("graphics/pokemon_storage/five_star_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Brick[] = INCBIN_U32("graphics/pokemon_storage/brick_icon.4bpp.lz"); +static const u32 gWallpaperIcon_FourStar[] = INCBIN_U32("graphics/pokemon_storage/four_star_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Asterisk[] = INCBIN_U32("graphics/pokemon_storage/asterisk_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Dot[] = INCBIN_U32("graphics/pokemon_storage/dot_icon.4bpp.lz"); +static const u32 gWallpaperIcon_LineCircle[] = INCBIN_U32("graphics/pokemon_storage/line_circle_icon.4bpp.lz"); +static const u32 gWallpaperIcon_PokeBall[] = INCBIN_U32("graphics/pokemon_storage/pokeball_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Maze[] = INCBIN_U32("graphics/pokemon_storage/maze_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Footprint[] = INCBIN_U32("graphics/pokemon_storage/footprint_icon.4bpp.lz"); +static const u32 gWallpaperIcon_BigAsterisk[] = INCBIN_U32("graphics/pokemon_storage/big_asterisk_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Circle[] = INCBIN_U32("graphics/pokemon_storage/circle_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Koffing[] = INCBIN_U32("graphics/pokemon_storage/koffing_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Ribbon[] = INCBIN_U32("graphics/pokemon_storage/ribbon_icon.4bpp.lz"); +static const u32 gWallpaperIcon_FourCircles[] = INCBIN_U32("graphics/pokemon_storage/four_circles_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Lotad[] = INCBIN_U32("graphics/pokemon_storage/lotad_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Crystal[] = INCBIN_U32("graphics/pokemon_storage/crystal_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Pichu[] = INCBIN_U32("graphics/pokemon_storage/pichu_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Diglett[] = INCBIN_U32("graphics/pokemon_storage/diglett_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Luvdisc[] = INCBIN_U32("graphics/pokemon_storage/luvdisc_icon.4bpp.lz"); +static const u32 gWallpaperIcon_StarInCircle[] = INCBIN_U32("graphics/pokemon_storage/star_in_circle_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Spinda[] = INCBIN_U32("graphics/pokemon_storage/spinda_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Latis[] = INCBIN_U32("graphics/pokemon_storage/latis_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Minun[] = INCBIN_U32("graphics/pokemon_storage/minun_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Togepi[] = INCBIN_U32("graphics/pokemon_storage/togepi_icon.4bpp.lz"); +static const u32 gWallpaperIcon_Magma[] = INCBIN_U32("graphics/pokemon_storage/magma_icon.4bpp.lz"); -const struct WallpaperTable gFriendsWallpaperTable[] = +static const struct WallpaperTable gFriendsWallpaperTable[] = { WALLPAPER_ENTRY(Zigzagoon), WALLPAPER_ENTRY(Screen), @@ -1129,7 +1141,7 @@ const struct WallpaperTable gFriendsWallpaperTable[] = WALLPAPER_ENTRY(Whiscash), }; -const u32 *const gFriendsIcons[] = +static const u32 *const gFriendsIcons[] = { gWallpaperIcon_Aqua, gWallpaperIcon_Heart, @@ -1164,36 +1176,36 @@ const u32 *const gFriendsIcons[] = }; // Unknown Unused data. -const u16 gUnknown_0857B07C = 0x23BA; +static const u16 gUnknown_0857B07C = 0x23BA; -const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; +static const struct SpriteSheet gUnknown_0857B080 = {gPCGfx_Arrow, 0x80, 6}; -const struct OamData gOamData_83BB298 = +static const struct OamData gOamData_83BB298 = { .shape = ST_OAM_H_RECTANGLE, .size = 2, .priority = 2 }; -const union AnimCmd gSpriteAnim_83BB2A0[] = +static const union AnimCmd gSpriteAnim_83BB2A0[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_83BB2A8[] = +static const union AnimCmd gSpriteAnim_83BB2A8[] = { ANIMCMD_FRAME(8, 5), ANIMCMD_END }; -const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = +static const union AnimCmd *const gSpriteAnimTable_83BB2B0[] = { gSpriteAnim_83BB2A0, gSpriteAnim_83BB2A8 }; -const struct SpriteTemplate gSpriteTemplate_857B0A8 = +static const struct SpriteTemplate gSpriteTemplate_857B0A8 = { TAG_TILE_3, TAG_PAL_DAC9, @@ -1204,31 +1216,31 @@ const struct SpriteTemplate gSpriteTemplate_857B0A8 = SpriteCallbackDummy }; -const struct OamData gOamData_83BB2D0 = +static const struct OamData gOamData_83BB2D0 = { .shape = ST_OAM_V_RECTANGLE, .priority = 2 }; -const union AnimCmd gSpriteAnim_83BB2D8[] = +static const union AnimCmd gSpriteAnim_83BB2D8[] = { ANIMCMD_FRAME(0, 5), ANIMCMD_END }; -const union AnimCmd gSpriteAnim_83BB2E0[] = +static const union AnimCmd gSpriteAnim_83BB2E0[] = { ANIMCMD_FRAME(2, 5), ANIMCMD_END }; -const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = +static const union AnimCmd *const gSpriteAnimTable_83BB2E8[] = { gSpriteAnim_83BB2D8, gSpriteAnim_83BB2E0 }; -const struct SpriteTemplate gUnknown_0857B0E0 = +static const struct SpriteTemplate gUnknown_0857B0E0 = { 6, 0xDACA, @@ -1243,28 +1255,6 @@ const u16 gHandCursorPalette[] = INCBIN_U16("graphics/pokemon_storage/hand_curso const u8 gHandCursorTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor.4bpp"); const u8 gHandCursorShadowTiles[] = INCBIN_U8("graphics/pokemon_storage/hand_cursor_shadow.4bpp"); -bool8 (*const gUnknown_0857B998[])(void) = -{ - MonPlaceChange_Move, - MonPlaceChange_Place, - MonPlaceChange_Shift, -}; - -struct -{ - s8 mapGroup; - s8 mapNum; - u16 move; -} const gUnknown_0857B9A4[] = -{ - {MAP_GROUPS_COUNT, 0, MOVE_SURF}, - {MAP_GROUPS_COUNT, 0, MOVE_DIVE}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_STRENGTH}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_ROCK_SMASH}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_STRENGTH}, - {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_ROCK_SMASH}, -}; - // code u8 CountMonsInBox(u8 boxId) { @@ -1357,7 +1347,7 @@ u8 *StringCopyAndFillWithSpaces(u8 *dst, const u8 *src, u16 n) return str; } -void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width) +static void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src_left, u16 src_top, u16 dest_width, u16 dest_height, u16 src_width) { u16 i; @@ -1393,7 +1383,7 @@ void sub_80C7128(u16 *dest, u16 dest_left, u16 dest_top, const u16 *src, u16 src #define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16) #define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32) -void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height) +static void sub_80C71A4(u16 *dest, u16 dest_left, u16 dest_top, u16 width, u16 height) { u16 i; @@ -1483,8 +1473,8 @@ void Task_PokemonStorageSystemPC(u8 taskId) { if (--task->data[1] < 0) task->data[1] = 4; - MoveMenuCursor(-1); - task->data[1] = GetMenuCursorPos(); + Menu_MoveCursor(-1); + task->data[1] = Menu_GetCursorPos(); FillWindowPixelBuffer(0, 0x11); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; @@ -1493,8 +1483,8 @@ void Task_PokemonStorageSystemPC(u8 taskId) { if (++task->data[1] > 3) task->data[1] = 0; - MoveMenuCursor(1); - task->data[1] = GetMenuCursorPos(); + Menu_MoveCursor(1); + task->data[1] = Menu_GetCursorPos(); FillWindowPixelBuffer(0, 0x11); AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3); task->data[0] = 2; @@ -1607,7 +1597,7 @@ void ResetPokemonStorageSystem(void) ResetWaldaWallpaper(); } -void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3, bool32 loadPal) +static void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3, bool32 loadPal) { struct SpritePalette palette = { @@ -1631,7 +1621,7 @@ void sub_80C77E8(struct UnkPSSStruct_2002370 *a0, u16 tileTag, u16 palTag, u8 a3 a0->unk_023c = loadPal; } -void sub_80C7890(void) +static void sub_80C7890(void) { if (gUnknown_02039D04->unk_023c) FreeSpritePaletteByTag(gUnknown_02039D04->unk_0242); @@ -1639,12 +1629,12 @@ void sub_80C7890(void) FreeSpriteTilesByTag(gUnknown_02039D04->unk_0240 + 1); } -void sub_80C78D4(u8 curBox) +static void sub_80C78D4(u8 curBox) { sub_80C7958(curBox); } -void sub_80C78E4(void) +static void sub_80C78E4(void) { sub_80C7B14(); } @@ -1674,7 +1664,7 @@ u8 sub_80C78F0(void) return 200; } -void sub_80C7958(u8 curBox) +static void sub_80C7958(u8 curBox) { u16 i; u8 spriteId; @@ -1728,7 +1718,7 @@ void sub_80C7958(u8 curBox) sub_80C7BE4(); } -void sub_80C7B14(void) +static void sub_80C7B14(void) { u16 i; if (gUnknown_02039D04->unk_0000) @@ -1751,20 +1741,20 @@ void sub_80C7B14(void) } } -void sub_80C7B80(void) +static void sub_80C7B80(void) { if (++gUnknown_02039D04->curBox >= TOTAL_BOXES_COUNT) gUnknown_02039D04->curBox = 0; sub_80C7BE4(); } -void sub_80C7BB4(void) +static void sub_80C7BB4(void) { gUnknown_02039D04->curBox = (gUnknown_02039D04->curBox == 0 ? TOTAL_BOXES_COUNT - 1 : gUnknown_02039D04->curBox - 1); sub_80C7BE4(); } -void sub_80C7BE4(void) +static void sub_80C7BE4(void) { u8 text[16]; struct WindowTemplate winTemplate; @@ -1795,7 +1785,7 @@ void sub_80C7BE4(void) RemoveWindow(windowId); } -void sub_80C7CF4(struct Sprite *sprite) +static void sub_80C7CF4(struct Sprite *sprite) { if (++sprite->data[1] > 3) { @@ -1879,7 +1869,7 @@ void ResetAllBgCoords(void) SetGpuReg(REG_OFFSET_BG3VOFS, 0); } -void sub_80C7E98(void) +static void sub_80C7E98(void) { ResetPaletteFade(); ResetSpriteData(); @@ -1896,14 +1886,14 @@ void sub_80C7E98(void) gUnknown_02039D08->unk_02C7 = 0; } -void sub_80C7F1C(void) +static void sub_80C7F1C(void) { sub_80CDC0C(); sInPartyMenu = (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT); gUnknown_02039D0E = 0; } -void sub_80C7F4C(void) +static void sub_80C7F4C(void) { if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_ITEMS) { @@ -1913,13 +1903,13 @@ void sub_80C7F4C(void) SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP); } -void SetPSSCallback(TaskFunc newFunc) +static void SetPSSCallback(TaskFunc newFunc) { gTasks[gUnknown_02039D08->taskId].func = newFunc; gUnknown_02039D08->state = 0; } -void Cb_InitPSS(u8 taskId) +static void Cb_InitPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2029,7 +2019,7 @@ void Cb_InitPSS(u8 taskId) gUnknown_02039D08->state++; } -void Cb_ShowPSS(u8 taskId) +static void Cb_ShowPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2045,7 +2035,7 @@ void Cb_ShowPSS(u8 taskId) } } -void Cb_ReshowPSS(u8 taskId) +static void Cb_ReshowPSS(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2081,12 +2071,12 @@ void Cb_ReshowPSS(u8 taskId) } } -void Cb_MainPSS(u8 taskId) +static void Cb_MainPSS(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - switch (sub_80CF9EC()) + switch (HandleInput()) { case 1: PlaySE(SE_SELECT); @@ -2107,7 +2097,7 @@ void Cb_MainPSS(u8 taskId) case 6: if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS) { - if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->selectedItem)) + if (IsMonBeingMoved() && ItemIsMail(gUnknown_02039D08->cursorMonItem)) gUnknown_02039D08->state = 5; else SetPSSCallback(Cb_HidePartyPokemon); @@ -2163,9 +2153,9 @@ void Cb_MainPSS(u8 taskId) } break; case 11: - if (!CanMoveMon()) + if (!CanMovePartyMon()) { - if (ItemIsMail(gUnknown_02039D08->selectedItem)) + if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) { gUnknown_02039D08->state = 5; } @@ -2181,7 +2171,7 @@ void Cb_MainPSS(u8 taskId) } break; case 13: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 4; } @@ -2343,7 +2333,7 @@ void Cb_MainPSS(u8 taskId) } } -void Cb_ShowPartyPokemon(u8 taskId) +static void Cb_ShowPartyPokemon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2358,7 +2348,7 @@ void Cb_ShowPartyPokemon(u8 taskId) } } -void Cb_HidePartyPokemon(u8 taskId) +static void Cb_HidePartyPokemon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2385,7 +2375,7 @@ void Cb_HidePartyPokemon(u8 taskId) } } -void Cb_OnSelectedMon(u8 taskId) +static void Cb_OnSelectedMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2395,12 +2385,12 @@ void Cb_OnSelectedMon(u8 taskId) PlaySE(SE_SELECT); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) PrintStorageActionText(PC_TEXT_IS_SELECTED); - else if (sub_80D127C() || gUnknown_02039D08->selectedItem != 0) + else if (sub_80D127C() || gUnknown_02039D08->cursorMonItem != 0) PrintStorageActionText(PC_TEXT_IS_SELECTED2); else PrintStorageActionText(PC_TEXT_GIVE_TO_MON); - sub_80CFFD0(); + AddMenu(); gUnknown_02039D08->state = 1; } break; @@ -2417,7 +2407,7 @@ void Cb_OnSelectedMon(u8 taskId) SetPSSCallback(Cb_MainPSS); break; case 3: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 3; } @@ -2451,11 +2441,11 @@ void Cb_OnSelectedMon(u8 taskId) SetPSSCallback(Cb_WithdrawMon); break; case 1: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 3; } - else if (ItemIsMail(gUnknown_02039D08->selectedItem)) + else if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) { gUnknown_02039D08->state = 4; } @@ -2467,15 +2457,15 @@ void Cb_OnSelectedMon(u8 taskId) } break; case 7: - if (CanMoveMon()) + if (CanMovePartyMon()) { gUnknown_02039D08->state = 3; } - else if (gUnknown_02039D08->field_CED) + else if (gUnknown_02039D08->cursorMonIsEgg) { gUnknown_02039D08->state = 5; // Cannot release an Egg. } - else if (ItemIsMail(gUnknown_02039D08->selectedItem)) + else if (ItemIsMail(gUnknown_02039D08->cursorMonItem)) { gUnknown_02039D08->state = 4; } @@ -2542,7 +2532,7 @@ void Cb_OnSelectedMon(u8 taskId) } } -void Cb_MoveMon(u8 taskId) +static void Cb_MoveMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2562,7 +2552,7 @@ void Cb_MoveMon(u8 taskId) } } -void Cb_PlaceMon(u8 taskId) +static void Cb_PlaceMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2582,7 +2572,7 @@ void Cb_PlaceMon(u8 taskId) } } -void Cb_ShiftMon(u8 taskId) +static void Cb_ShiftMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2600,7 +2590,7 @@ void Cb_ShiftMon(u8 taskId) } } -void Cb_WithdrawMon(u8 taskId) +static void Cb_WithdrawMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2627,7 +2617,7 @@ void Cb_WithdrawMon(u8 taskId) case 2: if (!DoMonPlaceChange()) { - sub_80CC0D4(1); + SetMovingMonPriority(1); SetUpDoShowPartyMenu(); gUnknown_02039D08->state++; } @@ -2652,7 +2642,7 @@ void Cb_WithdrawMon(u8 taskId) } } -void Cb_DepositMenu(u8 taskId) +static void Cb_DepositMenu(u8 taskId) { u8 boxId; @@ -2715,7 +2705,7 @@ void Cb_DepositMenu(u8 taskId) } } -void Cb_ReleaseMon(u8 taskId) +static void Cb_ReleaseMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2734,25 +2724,25 @@ void Cb_ReleaseMon(u8 taskId) break; case 0: ClearBottomWindow(); - sub_80CE3A0(); + InitCanRelaseMonVars(); sub_80CE250(); gUnknown_02039D08->state++; break; } break; case 2: - sub_80CE580(); + RunCanReleaseMon(); if (!sub_80CE2A8()) { while (1) { - s8 r0 = sub_80CE580(); + s8 r0 = RunCanReleaseMon(); if (r0 == 1) { gUnknown_02039D08->state++; break; } - if (r0 == 0) + else if (r0 == 0) { gUnknown_02039D08->state = 8; // Can't release the mon. break; @@ -2761,8 +2751,8 @@ void Cb_ReleaseMon(u8 taskId) } break; case 3: - sub_80CE2D8(); - sub_80CA230(); + ReleaseMon(); + RefreshCursorMonData(); PrintStorageActionText(PC_TEXT_WAS_RELEASED); gUnknown_02039D08->state++; break; @@ -2845,14 +2835,14 @@ void Cb_ReleaseMon(u8 taskId) } } -void Cb_ShowMarkMenu(u8 taskId) +static void Cb_ShowMarkMenu(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: PrintStorageActionText(PC_TEXT_MARK_POKE); - gUnknown_02039D08->field_DA4.markings = gUnknown_02039D08->field_CEB; - sub_811FAA4(gUnknown_02039D08->field_CEB, 0xb0, 0x10); + gUnknown_02039D08->field_DA4.markings = gUnknown_02039D08->cursorMonMarkings; + sub_811FAA4(gUnknown_02039D08->cursorMonMarkings, 0xb0, 0x10); gUnknown_02039D08->state++; break; case 1: @@ -2860,20 +2850,20 @@ void Cb_ShowMarkMenu(u8 taskId) { sub_811FAF8(); ClearBottomWindow(); - sub_80CE9A8(gUnknown_02039D08->field_DA4.markings); - sub_80CA230(); + SetMonMarkings(gUnknown_02039D08->field_DA4.markings); + RefreshCursorMonData(); SetPSSCallback(Cb_MainPSS); } break; } } -void Cb_TakeItemForMoving(u8 taskId) +static void Cb_TakeItemForMoving(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - if (!ItemIsMail(gUnknown_02039D08->selectedItem)) + if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) { ClearBottomWindow(); gUnknown_02039D08->state++; @@ -2905,7 +2895,7 @@ void Cb_TakeItemForMoving(u8 taskId) } } -void Cb_GiveMovingItemToMon(u8 taskId) +static void Cb_GiveMovingItemToMon(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -2942,12 +2932,12 @@ void Cb_GiveMovingItemToMon(u8 taskId) } } -void Cb_ItemToBag(u8 taskId) +static void Cb_ItemToBag(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - if (!AddBagItem(gUnknown_02039D08->selectedItem, 1)) + if (!AddBagItem(gUnknown_02039D08->cursorMonItem, 1)) { PlaySE(SE_HAZURE); PrintStorageActionText(PC_TEXT_BAG_FULL); @@ -2990,12 +2980,12 @@ void Cb_ItemToBag(u8 taskId) } } -void Cb_SwitchSelectedItem(u8 taskId) +static void Cb_SwitchSelectedItem(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - if (!ItemIsMail(gUnknown_02039D08->selectedItem)) + if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) { ClearBottomWindow(); gUnknown_02039D08->state++; @@ -3034,7 +3024,7 @@ void Cb_SwitchSelectedItem(u8 taskId) } } -void Cb_ShowItemInfo(u8 taskId) +static void Cb_ShowItemInfo(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3077,7 +3067,7 @@ void Cb_ShowItemInfo(u8 taskId) } } -void Cb_CloseBoxWhileHoldingItem(u8 taskId) +static void Cb_CloseBoxWhileHoldingItem(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3134,7 +3124,7 @@ void Cb_CloseBoxWhileHoldingItem(u8 taskId) } } -void Cb_HandleMovingMonFromParty(u8 taskId) +static void Cb_HandleMovingMonFromParty(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3153,7 +3143,7 @@ void Cb_HandleMovingMonFromParty(u8 taskId) } } -void Cb_PrintCantStoreMail(u8 taskId) +static void Cb_PrintCantStoreMail(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3179,13 +3169,13 @@ void Cb_PrintCantStoreMail(u8 taskId) } } -void Cb_HandleBoxOptions(u8 taskId) +static void Cb_HandleBoxOptions(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: PrintStorageActionText(PC_TEXT_WHAT_YOU_DO); - sub_80CFFD0(); + AddMenu(); gUnknown_02039D08->state++; break; case 1: @@ -3220,12 +3210,12 @@ void Cb_HandleBoxOptions(u8 taskId) } } -void Cb_HandleWallpapers(u8 taskId) +static void Cb_HandleWallpapers(u8 taskId) { switch (gUnknown_02039D08->state) { case 0: - sub_80CADD8(); + AddWallpaperSetsMenu(); PrintStorageActionText(PC_TEXT_PICK_A_THEME); gUnknown_02039D08->state++; break; @@ -3261,7 +3251,7 @@ void Cb_HandleWallpapers(u8 taskId) case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - sub_80CAE0C(gUnknown_02039D08->wallpaperSetId); + AddWallpapersMenu(gUnknown_02039D08->wallpaperSetId); PrintStorageActionText(PC_TEXT_PICK_A_WALLPAPER); gUnknown_02039D08->state++; } @@ -3302,7 +3292,7 @@ void Cb_HandleWallpapers(u8 taskId) } } -void Cb_JumpBox(u8 taskId) +static void Cb_JumpBox(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3348,7 +3338,7 @@ void Cb_JumpBox(u8 taskId) } } -void Cb_NameBox(u8 taskId) +static void Cb_NameBox(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3368,7 +3358,7 @@ void Cb_NameBox(u8 taskId) } } -void Cb_ShowMonSummary(u8 taskId) +static void Cb_ShowMonSummary(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3388,7 +3378,7 @@ void Cb_ShowMonSummary(u8 taskId) } } -void Cb_GiveItemFromBag(u8 taskId) +static void Cb_GiveItemFromBag(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3407,7 +3397,7 @@ void Cb_GiveItemFromBag(u8 taskId) } } -void Cb_OnCloseBoxPressed(u8 taskId) +static void Cb_OnCloseBoxPressed(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3468,7 +3458,7 @@ void Cb_OnCloseBoxPressed(u8 taskId) } } -void Cb_OnBPressed(u8 taskId) +static void Cb_OnBPressed(u8 taskId) { switch (gUnknown_02039D08->state) { @@ -3529,7 +3519,7 @@ void Cb_OnBPressed(u8 taskId) } } -void Cb_ChangeScreen(u8 taskId) +static void Cb_ChangeScreen(u8 taskId) { struct BoxPokemon *boxMons; u8 mode, monIndex, maxMonIndex; @@ -3548,7 +3538,7 @@ void Cb_ChangeScreen(u8 taskId) SetMainCallback2(Cb2_ExitPSS); break; case SCREEN_CHANGE_SUMMARY_SCREEN: - boxMons = gUnknown_02039D08->field_218C; + boxMons = gUnknown_02039D08->field_218C.box; monIndex = gUnknown_02039D08->field_2187; maxMonIndex = gUnknown_02039D08->field_2186; mode = gUnknown_02039D08->field_2188; @@ -3596,7 +3586,7 @@ void FreePSSData(void) FreeAllWindowBuffers(); } -void SetScrollingBackground(void) +static void SetScrollingBackground(void) { SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(3) | BGCNT_16COLOR | BGCNT_SCREENBASE(31)); DecompressAndLoadBgGfxUsingHeap(3, gPokemonStorageScrollingBGTileset, 0, 0, 0); @@ -3637,7 +3627,7 @@ void LoadWaveformSpritePalette(void) LoadSpritePalette(&gWaveformSpritePalette); } -void sub_80CA0D8(void) +static void sub_80CA0D8(void) { LoadPalette(gUnknown_085723DC, 0, 0x20); LoadPalette(gUnknown_085723FC, 0x20, 0x20); @@ -3651,10 +3641,10 @@ void sub_80CA0D8(void) LoadCursorMonSprite(); sub_80CA154(); sub_80CA1C4(); - sub_80CA230(); + RefreshCursorMonData(); } -void sub_80CA154(void) +static void sub_80CA154(void) { gUnknown_02039D08->field_D94 = sub_811FFB4(TAG_TILE_10, TAG_PAL_DAC8, NULL); gUnknown_02039D08->field_D94->oam.priority = 1; @@ -3664,7 +3654,7 @@ void sub_80CA154(void) gUnknown_02039D08->field_DA0 = (void*) OBJ_VRAM0 + 32 * GetSpriteTileStartByTag(TAG_TILE_10); } -void sub_80CA1C4(void) +static void sub_80CA1C4(void) { u16 i; struct SpriteSheet sheet = gWaveformSpriteSheet; @@ -3677,7 +3667,7 @@ void sub_80CA1C4(void) } } -void sub_80CA230(void) +void RefreshCursorMonData(void) { LoadCursorMonGfx(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); PrintCursorMonInfo(); @@ -3687,7 +3677,7 @@ void sub_80CA230(void) void BoxSetMosaic(void) { - sub_80CA230(); + RefreshCursorMonData(); if (gUnknown_02039D08->cursorMonSprite) { gUnknown_02039D08->cursorMonSprite->oam.mosaic = TRUE; @@ -3703,7 +3693,7 @@ u8 sub_80CA2B8(void) return gUnknown_02039D08->cursorMonSprite->oam.mosaic; } -void sub_80CA2D0(struct Sprite *sprite) +static void sub_80CA2D0(struct Sprite *sprite) { sprite->data[0] -= sprite->data[1]; if (sprite->data[0] < 0) @@ -3767,7 +3757,7 @@ void LoadCursorMonGfx(u16 species, u32 pid) if (species != SPECIES_NONE) { LoadSpecialPokePic(&gMonFrontPicTable[species], gUnknown_02039D08->field_22C4, species, pid, TRUE); - LZ77UnCompWram(gUnknown_02039D08->field_CDC, gUnknown_02039D08->field_2244); + LZ77UnCompWram(gUnknown_02039D08->cursorMonPalette, gUnknown_02039D08->field_2244); CpuCopy32(gUnknown_02039D08->field_22C4, gUnknown_02039D08->field_223C, 0x800); LoadPalette(gUnknown_02039D08->field_2244, gUnknown_02039D08->field_223A, 0x20); gUnknown_02039D08->cursorMonSprite->invisible = FALSE; @@ -3778,12 +3768,12 @@ void LoadCursorMonGfx(u16 species, u32 pid) } } -void PrintCursorMonInfo(void) +static void PrintCursorMonInfo(void) { FillWindowPixelBuffer(0, 0x11); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNick, 6, 0, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNickText, 6, 0, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 15, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 29, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 43, TEXT_SPEED_FF, NULL); @@ -3791,7 +3781,7 @@ void PrintCursorMonInfo(void) else { AddTextPrinterParameterized(0, 0, gUnknown_02039D08->cursorMonItemName, 6, 0, TEXT_SPEED_FF, NULL); - AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNick, 6, 13, TEXT_SPEED_FF, NULL); + AddTextPrinterParameterized(0, 1, gUnknown_02039D08->cursorMonNickText, 6, 13, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonSpeciesName, 6, 28, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(0, 2, gUnknown_02039D08->cursorMonGenderLvlText, 10, 42, TEXT_SPEED_FF, NULL); } @@ -3799,7 +3789,7 @@ void PrintCursorMonInfo(void) CopyWindowToVram(0, 2); if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) { - sub_8120084(gUnknown_02039D08->field_CEB, gUnknown_02039D08->field_DA0); + sub_8120084(gUnknown_02039D08->cursorMonMarkings, gUnknown_02039D08->field_DA0); gUnknown_02039D08->field_D94->invisible = FALSE; } else @@ -3808,7 +3798,7 @@ void PrintCursorMonInfo(void) } } -void sub_80CA65C(void) +static void sub_80CA65C(void) { u16 i; @@ -3829,7 +3819,7 @@ void sub_80CA65C(void) schedule_bg_copy_tilemap_to_vram(1); } -void sub_80CA704(void) +static void sub_80CA704(void) { LZ77UnCompWram(gUnknown_08DD36C8, gUnknown_02039D08->field_B0); LoadPalette(gPSSMenu_Pal, 0x10, 0x20); @@ -3857,7 +3847,7 @@ void sub_80CA704(void) gUnknown_02039D08->unk_02C7 = 0; } -void SetUpShowPartyMenu(void) +static void SetUpShowPartyMenu(void) { gUnknown_02039D08->field_2C0 = 20; gUnknown_02039D08->field_2C2 = 2; @@ -3865,7 +3855,7 @@ void SetUpShowPartyMenu(void) CreatePartyMonsSprites(FALSE); } -bool8 ShowPartyMenu(void) +static bool8 ShowPartyMenu(void) { if (gUnknown_02039D08->field_2C5 == 20) return FALSE; @@ -3887,7 +3877,7 @@ bool8 ShowPartyMenu(void) } } -void SetUpHidePartyMenu(void) +static void SetUpHidePartyMenu(void) { gUnknown_02039D08->field_2C0 = 0; gUnknown_02039D08->field_2C2 = 22; @@ -3896,7 +3886,7 @@ void SetUpHidePartyMenu(void) sub_80D11CC(); } -bool8 HidePartyMenu(void) +static bool8 HidePartyMenu(void) { if (gUnknown_02039D08->field_2C5 != 20) { @@ -3926,7 +3916,7 @@ bool8 HidePartyMenu(void) return FALSE; } -void sub_80CA984(bool8 arg0) +static void sub_80CA984(bool8 arg0) { if (arg0) sub_80D27AC(2, 0, 0, 9, 2); @@ -3937,14 +3927,14 @@ void sub_80CA984(bool8 arg0) schedule_bg_copy_tilemap_to_vram(1); } -void sub_80CA9C0(void) +static void sub_80CA9C0(void) { gUnknown_02039D08->unk_02C7 = 1; gUnknown_02039D08->unk_02C8 = 30; gUnknown_02039D08->unk_02C9 = TRUE; } -void sub_80CA9EC(void) +static void sub_80CA9EC(void) { if (gUnknown_02039D08->unk_02C7) { @@ -3953,7 +3943,7 @@ void sub_80CA9EC(void) } } -void sub_80CAA14(void) +static void sub_80CAA14(void) { if (gUnknown_02039D08->unk_02C7 && ++gUnknown_02039D08->unk_02C8 > 30) { @@ -3963,7 +3953,7 @@ void sub_80CAA14(void) } } -void sub_80CAA74(void) +static void sub_80CAA74(void) { u8 i; @@ -3974,7 +3964,7 @@ void sub_80CAA74(void) } } -void sub_80CAAA8(u8 arg0, bool8 isPartyMon) +static void sub_80CAAA8(u8 arg0, bool8 isPartyMon) { u16 i, j, index; const u16 *data; @@ -3998,7 +3988,7 @@ void sub_80CAAA8(u8 arg0, bool8 isPartyMon) } } -void sub_80CAB20(void) +static void sub_80CAB20(void) { sub_80CAA74(); sub_80D27AC(1, 0, 0, 12, 22); @@ -4006,14 +3996,14 @@ void sub_80CAB20(void) schedule_bg_copy_tilemap_to_vram(1); } -void SetUpDoShowPartyMenu(void) +static void SetUpDoShowPartyMenu(void) { gUnknown_02039D08->showPartyMenuState = 0; PlaySE(SE_WIN_OPEN); SetUpShowPartyMenu(); } -bool8 DoShowPartyMenu(void) +static bool8 DoShowPartyMenu(void) { switch (gUnknown_02039D08->showPartyMenuState) { @@ -4038,7 +4028,7 @@ bool8 DoShowPartyMenu(void) return TRUE; } -void sub_80CABE0(void) +static void sub_80CABE0(void) { if (gUnknown_02039D10 != StorageGetCurrentBox()) { @@ -4047,7 +4037,7 @@ void sub_80CABE0(void) } } -void sub_80CAC1C(void) +static void sub_80CAC1C(void) { SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29)); LoadUserWindowBorderGfx(1, 2, 208); @@ -4067,7 +4057,7 @@ void PrintStorageActionText(u8 id) case PC_TEXT_FMT_MON_NAME_1: case PC_TEXT_FMT_MON_NAME_2: case PC_TEXT_FMT_MON_NAME_3: - DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->field_CEE); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_02039D08->cursorMonNick); break; case PC_TEXT_FMT_MON_NAME_4: case PC_TEXT_FMT_MON_NAME_5: @@ -4100,7 +4090,7 @@ void PrintStorageActionText(u8 id) void ShowYesNoWindow(s8 cursorPos) { CreateYesNoMenu(&sYesNoWindowTemplate, 11, 14, 0); - MoveMenuCursorNoWrapAround(cursorPos); + Menu_MoveCursorNoWrapAround(cursorPos); } void ClearBottomWindow(void) @@ -4109,49 +4099,49 @@ void ClearBottomWindow(void) schedule_bg_copy_tilemap_to_vram(0); } -void sub_80CADD8(void) +static void AddWallpaperSetsMenu(void) { - sub_80CFEF0(); - sub_80CFF34(18); - sub_80CFF34(19); - sub_80CFF34(20); - sub_80CFF34(21); + InitMenu(); + SetMenuText(18); + SetMenuText(19); + SetMenuText(20); + SetMenuText(21); if (IsWaldaWallpaperUnlocked()) - sub_80CFF34(22); - sub_80CFFD0(); + SetMenuText(22); + AddMenu(); } -void sub_80CAE0C(u8 wallpaperSet) +static void AddWallpapersMenu(u8 wallpaperSet) { - sub_80CFEF0(); + InitMenu(); switch (wallpaperSet) { case 0: - sub_80CFF34(23); - sub_80CFF34(24); - sub_80CFF34(25); - sub_80CFF34(26); + SetMenuText(23); + SetMenuText(24); + SetMenuText(25); + SetMenuText(26); break; case 1: - sub_80CFF34(27); - sub_80CFF34(28); - sub_80CFF34(29); - sub_80CFF34(30); + SetMenuText(27); + SetMenuText(28); + SetMenuText(29); + SetMenuText(30); break; case 2: - sub_80CFF34(31); - sub_80CFF34(32); - sub_80CFF34(33); - sub_80CFF34(34); + SetMenuText(31); + SetMenuText(32); + SetMenuText(33); + SetMenuText(34); break; case 3: - sub_80CFF34(35); - sub_80CFF34(36); - sub_80CFF34(37); - sub_80CFF34(38); + SetMenuText(35); + SetMenuText(36); + SetMenuText(37); + SetMenuText(38); break; } - sub_80CFFD0(); + AddMenu(); } u8 GetCurrentBoxOption(void) @@ -4159,7 +4149,7 @@ u8 GetCurrentBoxOption(void) return sCurrentBoxOption; } -void sub_80CAEAC(void) +static void sub_80CAEAC(void) { if (!IsCursorOnBox()) { @@ -4176,7 +4166,7 @@ void sub_80CAEAC(void) } } -void sub_80CAF04(void) +static void sub_80CAF04(void) { u16 i; @@ -4190,7 +4180,7 @@ void sub_80CAF04(void) for (i = 0; i < IN_BOX_COUNT; i++) gUnknown_02039D08->boxMonsSprites[i] = NULL; - gUnknown_02039D08->field_A6C = NULL; + gUnknown_02039D08->movingMonSprite = NULL; gUnknown_02039D08->field_78C = 0; } @@ -4199,17 +4189,17 @@ u8 sub_80CAFAC(void) return (IsCursorInBox() ? 2 : 1); } -void sub_80CAFC4(void) +void CreateMovingMonIcon(void) { - u32 personality = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_PERSONALITY); - u16 species = GetMonData(&gUnknown_02039D08->field_20A4, MON_DATA_SPECIES2); + u32 personality = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_PERSONALITY); + u16 species = GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_SPECIES2); u8 priority = sub_80CAFAC(); - gUnknown_02039D08->field_A6C = CreateMonIconSprite(species, personality, 0, 0, priority, 7); - gUnknown_02039D08->field_A6C->callback = sub_80CC100; + gUnknown_02039D08->movingMonSprite = CreateMonIconSprite(species, personality, 0, 0, priority, 7); + gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; } -void sub_80CB028(u8 boxId) +static void sub_80CB028(u8 boxId) { u8 boxPosition; u16 i, j, count; @@ -4263,7 +4253,7 @@ void sub_80CB140(u8 boxPosition) } } -void sub_80CB1F0(s16 arg0) +static void sub_80CB1F0(s16 arg0) { u16 i; @@ -4278,7 +4268,7 @@ void sub_80CB1F0(s16 arg0) } } -void sub_80CB234(struct Sprite *sprite) +static void sub_80CB234(struct Sprite *sprite) { if (sprite->data[1] != 0) { @@ -4293,7 +4283,7 @@ void sub_80CB234(struct Sprite *sprite) } } -void sub_80CB278(struct Sprite *sprite) +static void sub_80CB278(struct Sprite *sprite) { if (sprite->data[4] != 0) { @@ -4308,7 +4298,7 @@ void sub_80CB278(struct Sprite *sprite) } } -void DestroyAllIconsInRow(u8 row) +static void DestroyAllIconsInRow(u8 row) { u16 column; u8 boxPosition = row; @@ -4384,7 +4374,7 @@ u8 sub_80CB2F8(u8 row, u16 times, s16 xDelta) return count; } -void sub_80CB4CC(u8 boxId, s8 direction) +static void sub_80CB4CC(u8 boxId, s8 direction) { gUnknown_02039D08->field_C6A = 0; gUnknown_02039D08->field_C6B = boxId; @@ -4402,7 +4392,7 @@ void sub_80CB4CC(u8 boxId, s8 direction) sub_80CB1F0(gUnknown_02039D08->field_C64); } -bool8 sub_80CB584(void) +static bool8 sub_80CB584(void) { if (gUnknown_02039D08->field_C60 != 0) gUnknown_02039D08->field_C60--; @@ -4446,7 +4436,7 @@ bool8 sub_80CB584(void) return TRUE; } -void SetBoxSpeciesAndPersonalities(u8 boxId) +static void SetBoxSpeciesAndPersonalities(u8 boxId) { s32 i, j, boxPosition; @@ -4524,7 +4514,7 @@ void CreatePartyMonsSprites(bool8 arg0) } } -void sub_80CB950(void) +static void sub_80CB950(void) { u16 i, count; @@ -4549,7 +4539,7 @@ u8 sub_80CB9BC(void) return gUnknown_02039D08->field_C5E; } -void sub_80CB9D0(struct Sprite *sprite, u16 partyId) +static void sub_80CB9D0(struct Sprite *sprite, u16 partyId) { s16 x, y; @@ -4567,7 +4557,7 @@ void sub_80CB9D0(struct Sprite *sprite, u16 partyId) sprite->callback = sub_80CBA3C; } -void sub_80CBA3C(struct Sprite *sprite) +static void sub_80CBA3C(struct Sprite *sprite) { if (sprite->data[6] != 0) { @@ -4595,16 +4585,16 @@ void sub_80CBA3C(struct Sprite *sprite) } } -void sub_80CBAC4(void) +static void DestroyMovingMonIcon(void) { - if (gUnknown_02039D08->field_A6C != NULL) + if (gUnknown_02039D08->movingMonSprite != NULL) { - DestroyBoxMonIcon(gUnknown_02039D08->field_A6C); - gUnknown_02039D08->field_A6C = NULL; + DestroyBoxMonIcon(gUnknown_02039D08->movingMonSprite); + gUnknown_02039D08->movingMonSprite = NULL; } } -void sub_80CBAF0(s16 yDelta) +static void sub_80CBAF0(s16 yDelta) { u16 i, posY; @@ -4623,7 +4613,7 @@ void sub_80CBAF0(s16 yDelta) } } -void DestroyPartyMonIcon(u8 partyId) +static void DestroyPartyMonIcon(u8 partyId) { if (gUnknown_02039D08->partySprites[partyId] != NULL) { @@ -4632,7 +4622,7 @@ void DestroyPartyMonIcon(u8 partyId) } } -void DestroyAllPartyMonIcons(void) +static void DestroyAllPartyMonIcons(void) { u16 i; @@ -4654,16 +4644,16 @@ void SetPartyMonIconObjMode(u8 partyId, u8 objMode) } } -void sub_80CBC14(u8 mode, u8 id) +static void sub_80CBC14(u8 mode, u8 id) { if (mode == MODE_PARTY) { - gUnknown_02039D08->field_A6C = gUnknown_02039D08->partySprites[id]; + gUnknown_02039D08->movingMonSprite = gUnknown_02039D08->partySprites[id]; gUnknown_02039D08->partySprites[id] = NULL; } else if (mode == MODE_BOX) { - gUnknown_02039D08->field_A6C = gUnknown_02039D08->boxMonsSprites[id]; + gUnknown_02039D08->movingMonSprite = gUnknown_02039D08->boxMonsSprites[id]; gUnknown_02039D08->boxMonsSprites[id] = NULL; } else @@ -4671,41 +4661,41 @@ void sub_80CBC14(u8 mode, u8 id) return; } - gUnknown_02039D08->field_A6C->callback = sub_80CC100; - gUnknown_02039D08->field_A6C->oam.priority = sub_80CAFAC(); - gUnknown_02039D08->field_A6C->subpriority = 7; + gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; + gUnknown_02039D08->movingMonSprite->oam.priority = sub_80CAFAC(); + gUnknown_02039D08->movingMonSprite->subpriority = 7; } -void sub_80CBCAC(u8 boxId, u8 position) +static void sub_80CBCAC(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) // party mon { - gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->partySprites[position] = gUnknown_02039D08->movingMonSprite; gUnknown_02039D08->partySprites[position]->oam.priority = 1; gUnknown_02039D08->partySprites[position]->subpriority = 12; } else { - gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->field_A6C; + gUnknown_02039D08->boxMonsSprites[position] = gUnknown_02039D08->movingMonSprite; gUnknown_02039D08->boxMonsSprites[position]->oam.priority = 2; gUnknown_02039D08->boxMonsSprites[position]->subpriority = 19 - (position % IN_BOX_ROWS); } - gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; - gUnknown_02039D08->field_A6C = NULL; + gUnknown_02039D08->movingMonSprite->callback = SpriteCallbackDummy; + gUnknown_02039D08->movingMonSprite = NULL; } -void sub_80CBD5C(u8 boxId, u8 position) +static void sub_80CBD5C(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) // party mon gUnknown_02039D08->field_B00 = &gUnknown_02039D08->partySprites[position]; else gUnknown_02039D08->field_B00 = &gUnknown_02039D08->boxMonsSprites[position]; - gUnknown_02039D08->field_A6C->callback = SpriteCallbackDummy; + gUnknown_02039D08->movingMonSprite->callback = SpriteCallbackDummy; gUnknown_02039D08->field_C5D = 0; } -bool8 sub_80CBDC4(void) +static bool8 sub_80CBDC4(void) { if (gUnknown_02039D08->field_C5D == 16) return FALSE; @@ -4714,33 +4704,33 @@ bool8 sub_80CBDC4(void) if (gUnknown_02039D08->field_C5D & 1) { (*gUnknown_02039D08->field_B00)->pos1.y--; - gUnknown_02039D08->field_A6C->pos1.y++; + gUnknown_02039D08->movingMonSprite->pos1.y++; } (*gUnknown_02039D08->field_B00)->pos2.x = gSineTable[gUnknown_02039D08->field_C5D * 8] / 16; - gUnknown_02039D08->field_A6C->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); + gUnknown_02039D08->movingMonSprite->pos2.x = -(gSineTable[gUnknown_02039D08->field_C5D * 8] / 16); if (gUnknown_02039D08->field_C5D == 8) { - gUnknown_02039D08->field_A6C->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; - gUnknown_02039D08->field_A6C->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; + gUnknown_02039D08->movingMonSprite->oam.priority = (*gUnknown_02039D08->field_B00)->oam.priority; + gUnknown_02039D08->movingMonSprite->subpriority = (*gUnknown_02039D08->field_B00)->subpriority; (*gUnknown_02039D08->field_B00)->oam.priority = sub_80CAFAC(); (*gUnknown_02039D08->field_B00)->subpriority = 7; } if (gUnknown_02039D08->field_C5D == 16) { - struct Sprite *sprite = gUnknown_02039D08->field_A6C; - gUnknown_02039D08->field_A6C = (*gUnknown_02039D08->field_B00); + struct Sprite *sprite = gUnknown_02039D08->movingMonSprite; + gUnknown_02039D08->movingMonSprite = (*gUnknown_02039D08->field_B00); *gUnknown_02039D08->field_B00 = sprite; - gUnknown_02039D08->field_A6C->callback = sub_80CC100; + gUnknown_02039D08->movingMonSprite->callback = sub_80CC100; (*gUnknown_02039D08->field_B00)->callback = SpriteCallbackDummy; } return TRUE; } -void sub_80CBF14(u8 mode, u8 position) +static void sub_80CBF14(u8 mode, u8 position) { switch (mode) { @@ -4751,7 +4741,7 @@ void sub_80CBF14(u8 mode, u8 position) gUnknown_02039D08->field_B04 = &gUnknown_02039D08->boxMonsSprites[position]; break; case MODE_2: - gUnknown_02039D08->field_B04 = &gUnknown_02039D08->field_A6C; + gUnknown_02039D08->field_B04 = &gUnknown_02039D08->movingMonSprite; break; default: return; @@ -4766,7 +4756,7 @@ void sub_80CBF14(u8 mode, u8 position) } } -bool8 sub_80CBFD8(void) +static bool8 sub_80CBFD8(void) { if (*gUnknown_02039D08->field_B04 == NULL || (*gUnknown_02039D08->field_B04)->invisible) return FALSE; @@ -4777,7 +4767,7 @@ bool8 sub_80CBFD8(void) return TRUE; } -void sub_80CC020(void) +static void sub_80CC020(void) { if (*gUnknown_02039D08->field_B04 != NULL) { @@ -4787,7 +4777,7 @@ void sub_80CC020(void) } } -void sub_80CC064(void) +static void sub_80CC064(void) { if (*gUnknown_02039D08->field_B04 != NULL) { @@ -4796,7 +4786,7 @@ void sub_80CC064(void) } } -bool8 sub_80CC0A0(void) +static bool8 sub_80CC0A0(void) { if (gUnknown_02039D08->field_B04 == NULL) return FALSE; @@ -4807,18 +4797,18 @@ bool8 sub_80CC0A0(void) return TRUE; } -void sub_80CC0D4(u8 priority) +static void SetMovingMonPriority(u8 priority) { - gUnknown_02039D08->field_A6C->oam.priority = priority; + gUnknown_02039D08->movingMonSprite->oam.priority = priority; } -void sub_80CC100(struct Sprite *sprite) +static void sub_80CC100(struct Sprite *sprite) { sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + gUnknown_02039D08->field_CB4->pos2.y + 4; } -u16 sub_80CC124(u16 species) +static u16 sub_80CC124(u16 species) { u16 i, var; @@ -4847,7 +4837,7 @@ u16 sub_80CC124(u16 species) return var; } -void sub_80CC1E0(u16 species) +static void sub_80CC1E0(u16 species) { u16 i; @@ -4887,25 +4877,25 @@ static struct Sprite *CreateMonIconSprite(u16 species, u32 personality, s16 x, s return &gSprites[spriteId]; } -void DestroyBoxMonIcon(struct Sprite *sprite) +static void DestroyBoxMonIcon(struct Sprite *sprite) { sub_80CC1E0(sprite->data[0]); DestroySprite(sprite); } -void sub_80CC32C(u8 boxId) +static void sub_80CC32C(u8 boxId) { u8 taskId = CreateTask(sub_80CC370, 2); gTasks[taskId].data[2] = boxId; } -bool8 sub_80CC35C(void) +static bool8 sub_80CC35C(void) { return FuncIsActiveTask(sub_80CC370); } -void sub_80CC370(u8 taskId) +static void sub_80CC370(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -4946,7 +4936,7 @@ void sub_80CC370(u8 taskId) task->data[0]++; } -void SetUpScrollToBox(u8 boxId) +static void SetUpScrollToBox(u8 boxId) { s8 direction = sub_80CC644(boxId); @@ -5014,14 +5004,14 @@ s8 sub_80CC644(u8 boxId) return (i < TOTAL_BOXES_COUNT / 2) ? 1 : -1; } -void SetWallpaperForCurrentBox(u8 wallpaperId) +static void SetWallpaperForCurrentBox(u8 wallpaperId) { u8 boxId = StorageGetCurrentBox(); SetBoxWallpaper(boxId, wallpaperId); gUnknown_02039D08->wallpaperChangeState = 0; } -bool8 DoWallpaperGfxChange(void) +static bool8 DoWallpaperGfxChange(void) { switch (gUnknown_02039D08->wallpaperChangeState) { @@ -5125,7 +5115,7 @@ bool32 WaitForWallpaperGfxLoad(void) return TRUE; } -void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) +static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) { s16 var = (arg2 * 2) + 3; s16 x = ((gUnknown_02039D08->bg2_X / 8 + 10) + (direction * 24)) & 0x3F; @@ -5142,7 +5132,7 @@ void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2) FillBgTilemapBufferRect(2, 0, x, 2, 4, 0x12, 0x11); } -void sub_80CCAE0(void *arg0) +static void sub_80CCAE0(void *arg0) { u16 i; u16 *dest = arg0; @@ -5164,7 +5154,7 @@ void sub_80CCAE0(void *arg0) } } -void sub_80CCB50(u8 boxId) +static void sub_80CCB50(u8 boxId) { u8 tagIndex; s16 r6; @@ -5205,7 +5195,7 @@ void sub_80CCB50(u8 boxId) gUnknown_02039D08->field_6F8 = 0; } -void sub_80CCCFC(u8 boxId, s8 direction) +static void sub_80CCCFC(u8 boxId, s8 direction) { u16 r8; s16 x, x2; @@ -5252,7 +5242,7 @@ void sub_80CCCFC(u8 boxId, s8 direction) } } -void sub_80CCEE0(void) +static void sub_80CCEE0(void) { if (gUnknown_02039D08->field_6F8 == 0) FreeSpriteTilesByTag(TAG_TILE_4); @@ -5263,7 +5253,7 @@ void sub_80CCEE0(void) gUnknown_02039D08->field_720[1] = gUnknown_02039D08->field_728[1]; } -void sub_80CCF30(struct Sprite *sprite) +static void sub_80CCF30(struct Sprite *sprite) { if (sprite->data[2] != 0) sprite->data[2]--; @@ -5271,7 +5261,7 @@ void sub_80CCF30(struct Sprite *sprite) sprite->callback = SpriteCallbackDummy; } -void sub_80CCF64(struct Sprite *sprite) +static void sub_80CCF64(struct Sprite *sprite) { if (sprite->data[1] != 0) { @@ -5286,7 +5276,7 @@ void sub_80CCF64(struct Sprite *sprite) } } -void sub_80CCF9C(void) +static void sub_80CCF9C(void) { u8 boxId = StorageGetCurrentBox(); u8 wallpaperId = GetBoxWallpaper(boxId); @@ -5296,12 +5286,12 @@ void sub_80CCF9C(void) CpuCopy16(gUnknown_08577574[wallpaperId], gPlttBufferUnfaded + gUnknown_02039D08->field_71E, 4); } -s16 sub_80CD00C(const u8 *string) +static s16 sub_80CD00C(const u8 *string) { return 0xB0 - GetStringWidth(1, string, 0) / 2; } -void sub_80CD02C(void) +static void sub_80CD02C(void) { u16 i; @@ -5321,7 +5311,7 @@ void sub_80CD02C(void) sub_80CD1A8(TRUE); } -void sub_80CD0B8(s8 direction) +static void sub_80CD0B8(s8 direction) { u16 i; @@ -5348,7 +5338,7 @@ void sub_80CD0B8(s8 direction) gUnknown_02039D08->field_730[1]->data[7] = 1; } -void sub_80CD158(void) +static void sub_80CD158(void) { u16 i; @@ -5361,7 +5351,7 @@ void sub_80CD158(void) sub_80CD1A8(TRUE); } -void sub_80CD1A8(bool8 a0) +static void sub_80CD1A8(bool8 a0) { u16 i; @@ -5384,7 +5374,7 @@ void sub_80CD1A8(bool8 a0) } } -void sub_80CD210(struct Sprite *sprite) +static void sub_80CD210(struct Sprite *sprite) { switch (sprite->data[0]) { @@ -5436,7 +5426,7 @@ struct Sprite *sub_80CD2E8(u16 x, u16 y, u8 animId, u8 priority, u8 subpriority) return &gSprites[spriteId]; } -void sub_80CD36C(void) +static void sub_80CD36C(void) { if (gUnknown_02039D08->boxOption != BOX_OPTION_DEPOSIT) sBoxCursorArea = CURSOR_AREA_IN_BOX; @@ -5451,64 +5441,64 @@ void sub_80CD36C(void) sub_80CDC0C(); sub_80CFC14(); gUnknown_02039D08->field_CD6 = 1; - gUnknown_02039D08->field_21FF = 0; + gUnknown_02039D08->inBoxMovingMode = 0; sub_80CEB40(); } -void sub_80CD3EC(void) +static void sub_80CD3EC(void) { sub_80CFC14(); sub_80CEBDC(); gUnknown_02039D08->field_CD6 = 1; - gUnknown_02039D08->field_21FF = 0; + gUnknown_02039D08->inBoxMovingMode = 0; if (sIsMonBeingMoved) { - gUnknown_02039D08->field_20A4 = gUnknown_02039D14; - sub_80CAFC4(); + gUnknown_02039D08->movingMon = gUnknown_02039D14; + CreateMovingMonIcon(); } } -void sub_80CD444(u8 a0, u8 a1, u16 *a2, u16 *a3) +void sub_80CD444(u8 cursorArea, u8 cursorPosition, u16 *x, u16 *y) { - switch (a0) + switch (cursorArea) { - case 0: - *a2 = (a1 % 6) * 24 + 100; - *a3 = (a1 / 6) * 24 + 32; + case CURSOR_AREA_IN_BOX: + *x = (cursorPosition % IN_BOX_ROWS) * 24 + 100; + *y = (cursorPosition / IN_BOX_ROWS) * 24 + 32; break; - case 1: - if (a1 == 0) + case CURSOR_AREA_IN_PARTY: + if (cursorPosition == 0) { - *a2 = 0x68; - *a3 = 0x34; + *x = 0x68; + *y = 0x34; } - else if (a1 == 6) + else if (cursorPosition == PARTY_SIZE) { - *a2 = 0x98; - *a3 = 0x84; + *x = 0x98; + *y = 0x84; } else { - *a2 = 0x98; - *a3 = (a1 - 1) * 24 + 4; + *x = 0x98; + *y = (cursorPosition - 1) * 24 + 4; } break; - case 2: - *a2 = 0xa2; - *a3 = 0x0c; + case CURSOR_AREA_BOX: + *x = 0xa2; + *y = 0x0c; break; - case 3: - *a3 = sIsMonBeingMoved ? 8 : 14; - *a2 = a1 * 0x58 + 0x78; + case CURSOR_AREA_BUTTONS: + *y = sIsMonBeingMoved ? 8 : 14; + *x = cursorPosition * 0x58 + 0x78; break; case 4: - *a2 = 0xa0; - *a3 = 0x60; + *x = 0xa0; + *y = 0x60; break; } } -u16 sub_80CD504(void) +static u16 sub_80CD504(void) { switch (sBoxCursorArea) { @@ -5571,18 +5561,18 @@ bool8 sub_80CD554(void) return TRUE; } -void sub_80CD6AC(u8 a0, u8 a1) +static void sub_80CD6AC(u8 newCurosrArea, u8 newCursorPosition) { u16 x, y; - sub_80CD444(a0, a1, &x, &y); - gUnknown_02039D08->field_CD4 = a0; - gUnknown_02039D08->field_CD5 = a1; + sub_80CD444(newCurosrArea, newCursorPosition, &x, &y); + gUnknown_02039D08->field_CD4 = newCurosrArea; + gUnknown_02039D08->field_CD5 = newCursorPosition; gUnknown_02039D08->field_CCC = x; gUnknown_02039D08->field_CCE = y; } -void sub_80CD70C(void) +static void sub_80CD70C(void) { int r7, r0; @@ -5628,13 +5618,13 @@ void sub_80CD70C(void) gUnknown_02039D08->field_CC0 = gUnknown_02039D08->field_CB4->pos1.y << 8; } -void sub_80CD894(u8 a0, u8 a1) +static void sub_80CD894(u8 newCurosrArea, u8 newCursorPosition) { - sub_80CD6AC(a0, a1); + sub_80CD6AC(newCurosrArea, newCursorPosition); sub_80CD70C(); if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + if (gUnknown_02039D08->inBoxMovingMode == 0 && !sIsMonBeingMoved) StartSpriteAnim(gUnknown_02039D08->field_CB4, 1); } else @@ -5650,27 +5640,29 @@ void sub_80CD894(u8 a0, u8 a1) else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) sub_80D0E50(1, sBoxCursorPosition); - if (a0 == 0) - sub_80D0D8C(0, a1); - else if (a0 == 1) - sub_80D0D8C(1, a1); + if (newCurosrArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(0, newCursorPosition); + else if (newCurosrArea == CURSOR_AREA_IN_PARTY) + sub_80D0D8C(1, newCursorPosition); } - if (a0 == 1 && sBoxCursorArea != CURSOR_AREA_IN_PARTY) + if (newCurosrArea == CURSOR_AREA_IN_PARTY && sBoxCursorArea != CURSOR_AREA_IN_PARTY) { - gUnknown_02039D08->field_CD6 = a0; + gUnknown_02039D08->field_CD6 = newCurosrArea; gUnknown_02039D08->field_CB8->invisible = TRUE; } - switch (a0) + switch (newCurosrArea) { - case 1 ... 3: + case CURSOR_AREA_IN_PARTY: + case CURSOR_AREA_BOX: + case CURSOR_AREA_BUTTONS: gUnknown_02039D08->field_CB4->oam.priority = 1; gUnknown_02039D08->field_CB8->invisible = TRUE; gUnknown_02039D08->field_CB8->oam.priority = 1; break; - case 0: - if (gUnknown_02039D08->field_21FF != 0) + case CURSOR_AREA_IN_BOX: + if (gUnknown_02039D08->inBoxMovingMode != 0) { gUnknown_02039D08->field_CB4->oam.priority = 0; gUnknown_02039D08->field_CB8->invisible = TRUE; @@ -5679,19 +5671,19 @@ void sub_80CD894(u8 a0, u8 a1) { gUnknown_02039D08->field_CB4->oam.priority = 2; if (sBoxCursorArea == CURSOR_AREA_IN_BOX && sIsMonBeingMoved) - sub_80CC0D4(2); + SetMovingMonPriority(2); } break; } } -void sub_80CDA68(void) +static void sub_80CDA68(void) { sBoxCursorArea = gUnknown_02039D08->field_CD4; sBoxCursorPosition = gUnknown_02039D08->field_CD5; if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) { - if (gUnknown_02039D08->field_21FF == 0 && !sIsMonBeingMoved) + if (gUnknown_02039D08->inBoxMovingMode == 0 && !sIsMonBeingMoved) StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); } else @@ -5704,29 +5696,29 @@ void sub_80CDA68(void) switch (sBoxCursorArea) { case CURSOR_AREA_BUTTONS: - sub_80CC0D4(1); + SetMovingMonPriority(1); break; case CURSOR_AREA_BOX: sub_80CD1A8(TRUE); break; case CURSOR_AREA_IN_PARTY: gUnknown_02039D08->field_CB8->subpriority = 13; - sub_80CC0D4(1); + SetMovingMonPriority(1); break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->field_21FF == 0) + if (gUnknown_02039D08->inBoxMovingMode == 0) { gUnknown_02039D08->field_CB4->oam.priority = 1; gUnknown_02039D08->field_CB8->oam.priority = 2; gUnknown_02039D08->field_CB8->subpriority = 21; gUnknown_02039D08->field_CB8->invisible = FALSE; - sub_80CC0D4(2); + SetMovingMonPriority(2); } break; } } -void sub_80CDBA0(void) +static void sub_80CDBA0(void) { u8 partyCount; @@ -5742,20 +5734,20 @@ void sub_80CDBA0(void) } if (gUnknown_02039D08->field_CB4->vFlip) gUnknown_02039D08->field_CD7 = 1; - sub_80CD894(1, partyCount); + sub_80CD894(CURSOR_AREA_IN_PARTY, partyCount); } -void sub_80CDBF8(u8 a0) +static void sub_80CDBF8(u8 cursorBoxPosition) { - sub_80CD894(0, a0); + sub_80CD894(CURSOR_AREA_IN_BOX, cursorBoxPosition); } -void sub_80CDC0C(void) +static void sub_80CDC0C(void) { gUnknown_02039D7E = 0; } -void sub_80CDC18(void) +static void sub_80CDC18(void) { gUnknown_02039D7E = sBoxCursorPosition; } @@ -5767,7 +5759,14 @@ u8 sub_80CDC2C(void) void InitMonPlaceChange(u8 a0) { - gUnknown_02039D08->monPlaceChangeFunc = gUnknown_0857B998[a0]; + static bool8 (*const placeChangeFuncs[])(void) = + { + MonPlaceChange_Move, + MonPlaceChange_Place, + MonPlaceChange_Shift, + }; + + gUnknown_02039D08->monPlaceChangeFunc = placeChangeFuncs[a0]; gUnknown_02039D08->monPlaceChangeState = 0; } @@ -5786,7 +5785,7 @@ bool8 DoMonPlaceChange(void) return gUnknown_02039D08->monPlaceChangeFunc(); } -bool8 MonPlaceChange_Move(void) +static bool8 MonPlaceChange_Move(void) { switch (gUnknown_02039D08->monPlaceChangeState) { @@ -5815,7 +5814,7 @@ bool8 MonPlaceChange_Move(void) return TRUE; } -bool8 MonPlaceChange_Place(void) +static bool8 MonPlaceChange_Place(void) { switch (gUnknown_02039D08->monPlaceChangeState) { @@ -5841,7 +5840,7 @@ bool8 MonPlaceChange_Place(void) return TRUE; } -bool8 MonPlaceChange_Shift(void) +static bool8 MonPlaceChange_Shift(void) { switch (gUnknown_02039D08->monPlaceChangeState) { @@ -5876,17 +5875,17 @@ bool8 MonPlaceChange_Shift(void) return TRUE; } -bool8 sub_80CDEB4(void) +static bool8 sub_80CDEB4(void) { return sub_80CDED4(); } -bool8 sub_80CDEC4(void) +static bool8 sub_80CDEC4(void) { return sub_80CDF08(); } -bool8 sub_80CDED4(void) +static bool8 sub_80CDED4(void) { switch (gUnknown_02039D08->field_CB4->pos2.y) { @@ -5903,7 +5902,7 @@ bool8 sub_80CDED4(void) return TRUE; } -bool8 sub_80CDF08(void) +static bool8 sub_80CDF08(void) { switch (gUnknown_02039D08->field_CB4->pos2.y) { @@ -5926,7 +5925,7 @@ void MoveMon(void) sub_80CBC14(MODE_PARTY, sBoxCursorPosition); break; case CURSOR_AREA_IN_BOX: - if (gUnknown_02039D08->field_21FF == 0) + if (gUnknown_02039D08->inBoxMovingMode == 0) { SetMovedMonData(StorageGetCurrentBox(), sBoxCursorPosition); sub_80CBC14(MODE_BOX, sBoxCursorPosition); @@ -5961,33 +5960,33 @@ void PlaceMon(void) sIsMonBeingMoved = FALSE; } -void sub_80CE00C(void) +static void sub_80CE00C(void) { sub_80CEB40(); } -void SetMovedMonData(u8 boxId, u8 position) +static void SetMovedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) - gUnknown_02039D08->field_20A4 = gPlayerParty[sBoxCursorPosition]; + gUnknown_02039D08->movingMon = gPlayerParty[sBoxCursorPosition]; else - BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_20A4); + BoxMonAtToMon(boxId, position, &gUnknown_02039D08->movingMon); PurgeMonOrBoxMon(boxId, position); sMovingMonOrigBoxId = boxId; sMovingMonOrigBoxPos = position; } -void SetPlacedMonData(u8 boxId, u8 position) +static void SetPlacedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) { - gPlayerParty[position] = gUnknown_02039D08->field_20A4; + gPlayerParty[position] = gUnknown_02039D08->movingMon; } else { - BoxMonRestorePP(&gUnknown_02039D08->field_20A4.box); - SetBoxMonAt(boxId, position, &gUnknown_02039D08->field_20A4.box); + BoxMonRestorePP(&gUnknown_02039D08->movingMon.box); + SetBoxMonAt(boxId, position, &gUnknown_02039D08->movingMon.box); } } @@ -5999,7 +5998,7 @@ void PurgeMonOrBoxMon(u8 boxId, u8 position) ZeroBoxMonAt(boxId, position); } -void SetShiftedMonData(u8 boxId, u8 position) +static void SetShiftedMonData(u8 boxId, u8 position) { if (boxId == TOTAL_BOXES_COUNT) gUnknown_02039D08->field_2108 = gPlayerParty[position]; @@ -6007,13 +6006,13 @@ void SetShiftedMonData(u8 boxId, u8 position) BoxMonAtToMon(boxId, position, &gUnknown_02039D08->field_2108); SetPlacedMonData(boxId, position); - gUnknown_02039D08->field_20A4 = gUnknown_02039D08->field_2108; - sub_80CEC00(&gUnknown_02039D08->field_20A4, 0); + gUnknown_02039D08->movingMon = gUnknown_02039D08->field_2108; + SetCursorMonData(&gUnknown_02039D08->movingMon, MODE_PARTY); sMovingMonOrigBoxId = boxId; sMovingMonOrigBoxPos = position; } -bool8 TryStorePartyMonInBox(u8 boxId) +static bool8 TryStorePartyMonInBox(u8 boxId) { s16 boxPosition = GetFirstFreeBoxSpot(boxId); if (boxPosition == -1) @@ -6022,7 +6021,7 @@ bool8 TryStorePartyMonInBox(u8 boxId) if (sIsMonBeingMoved) { SetPlacedMonData(boxId, boxPosition); - sub_80CBAC4(); + DestroyMovingMonIcon(); sIsMonBeingMoved = FALSE; } else @@ -6039,13 +6038,13 @@ bool8 TryStorePartyMonInBox(u8 boxId) return TRUE; } -void sub_80CE22C(void) +static void sub_80CE22C(void) { StartSpriteAnim(gUnknown_02039D08->field_CB4, 0); sub_80CEB40(); } -void sub_80CE250(void) +static void sub_80CE250(void) { u8 mode; @@ -6057,10 +6056,10 @@ void sub_80CE250(void) mode = MODE_BOX; sub_80CBF14(mode, sBoxCursorPosition); - StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->field_CEE); + StringCopy(gUnknown_02039D08->field_21E0, gUnknown_02039D08->cursorMonNick); } -bool8 sub_80CE2A8(void) +static bool8 sub_80CE2A8(void) { if (!sub_80CBFD8()) { @@ -6073,7 +6072,7 @@ bool8 sub_80CE2A8(void) } } -void sub_80CE2D8(void) +void ReleaseMon(void) { u8 boxId; @@ -6094,13 +6093,28 @@ void sub_80CE2D8(void) sub_80CEB40(); } -void sub_80CE324(void) +static void sub_80CE324(void) { if (sIsMonBeingMoved) StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); } -void sub_80CE350(u16 *moves) +struct +{ + s8 mapGroup; + s8 mapNum; + u16 move; +} static const gUnknown_0857B9A4[] = +{ + {MAP_GROUPS_COUNT, 0, MOVE_SURF}, + {MAP_GROUPS_COUNT, 0, MOVE_DIVE}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_STRENGTH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_1F), MOVE_ROCK_SMASH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_STRENGTH}, + {MAP_GROUP(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MAP_NUM(EVER_GRANDE_CITY_POKEMON_LEAGUE_2F), MOVE_ROCK_SMASH}, +}; + +static void sub_80CE350(u16 *moves) { s32 i; @@ -6117,7 +6131,7 @@ void sub_80CE350(u16 *moves) *moves = MOVES_COUNT; } -void sub_80CE3A0(void) +void InitCanRelaseMonVars(void) { if (!AtLeastThreeUsableMons()) { @@ -6128,7 +6142,7 @@ void sub_80CE3A0(void) if (sIsMonBeingMoved) { - gUnknown_02039D08->field_2108 = gUnknown_02039D08->field_20A4; + gUnknown_02039D08->field_2108 = gUnknown_02039D08->movingMon; gUnknown_02039D08->field_2170 = -1; gUnknown_02039D08->field_2171 = -1; } @@ -6191,7 +6205,7 @@ bool32 AtLeastThreeUsableMons(void) return FALSE; } -s8 sub_80CE580(void) +s8 RunCanReleaseMon(void) { u16 i; u16 knownMoves; @@ -6252,3 +6266,2186 @@ s8 sub_80CE580(void) return -1; } + +static void sub_80CE760(void) +{ + if (sIsMonBeingMoved) + gUnknown_02039D14 = gUnknown_02039D08->movingMon; +} + +static void sub_80CE790(void) +{ + if (sIsMonBeingMoved) + { + if (sMovingMonOrigBoxId == TOTAL_BOXES_COUNT) + gUnknown_02039D08->movingMon = gUnknown_02039D14; + else + gUnknown_02039D08->movingMon.box = gUnknown_02039D14.box; + } +} + +static void sub_80CE7E8(void) +{ + if (sIsMonBeingMoved) + { + sub_80CE760(); + gUnknown_02039D08->field_218C.mon = &gUnknown_02039D14; + gUnknown_02039D08->field_2187 = 0; + gUnknown_02039D08->field_2186 = 0; + gUnknown_02039D08->field_2188 = 0; + } + else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + { + gUnknown_02039D08->field_218C.mon = gPlayerParty; + gUnknown_02039D08->field_2187 = sBoxCursorPosition; + gUnknown_02039D08->field_2186 = CountPartyMons() - 1; + gUnknown_02039D08->field_2188 = 0; + } + else + { + gUnknown_02039D08->field_218C.box = GetBoxedMonPtr(StorageGetCurrentBox(), 0); + gUnknown_02039D08->field_2187 = sBoxCursorPosition; + gUnknown_02039D08->field_2186 = IN_BOX_COUNT - 1; + gUnknown_02039D08->field_2188 = 2; + } +} + +static void sub_80CE8E4(void) +{ + if (sIsMonBeingMoved) + sub_80CE790(); + else + sBoxCursorPosition = gUnknown_0203CF20; +} + +s16 CompactPartySlots(void) +{ + s16 retVal = -1; + u16 i, last; + + for (i = 0, last = 0; i < PARTY_SIZE; i++) + { + u16 species = GetMonData(gPlayerParty + i, MON_DATA_SPECIES); + if (species != SPECIES_NONE) + { + if (i != last) + gPlayerParty[last] = gPlayerParty[i]; + last++; + } + else if (retVal == -1) + retVal = i; + } + for (; last < PARTY_SIZE; last++) + ZeroMonData(gPlayerParty + last); + + return retVal; +} + +static void SetMonMarkings(u8 markings) +{ + gUnknown_02039D08->cursorMonMarkings = markings; + if (sIsMonBeingMoved) + { + SetMonData(&gUnknown_02039D08->movingMon, MON_DATA_MARKINGS, &markings); + } + else + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY) + SetMonData(gPlayerParty + sBoxCursorPosition, MON_DATA_MARKINGS, &markings); + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + SetCurrentBoxMonData(sBoxCursorPosition, MON_DATA_MARKINGS, &markings); + } +} + +static bool8 CanMovePartyMon(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY && !sIsMonBeingMoved && CountPartyAliveNonEggMonsExcept(sBoxCursorPosition) == 0) + return TRUE; + else + return FALSE; +} + +static bool8 CanShifMon(void) +{ + if (sIsMonBeingMoved) + { + if (sBoxCursorArea == CURSOR_AREA_IN_PARTY && CountPartyAliveNonEggMonsExcept(sBoxCursorPosition) == 0) + { + if (gUnknown_02039D08->cursorMonIsEgg || GetMonData(&gUnknown_02039D08->movingMon, MON_DATA_HP) == 0) + return FALSE; + } + return TRUE; + } + return FALSE; +} + +static bool8 IsMonBeingMoved(void) +{ + return sIsMonBeingMoved; +} + +static bool8 IsCursorOnBox(void) +{ + return (sBoxCursorArea == CURSOR_AREA_BOX); +} + +static bool8 IsCursorOnCloseBox(void) +{ + return (sBoxCursorArea == CURSOR_AREA_BUTTONS && sBoxCursorPosition == 1); +} + +static bool8 IsCursorInBox(void) +{ + return (sBoxCursorArea == CURSOR_AREA_IN_BOX); +} + +static void sub_80CEB40(void) +{ + gUnknown_02039D08->field_CEA = (sIsMonBeingMoved == FALSE); + if (!sIsMonBeingMoved) + { + switch (sBoxCursorArea) + { + case CURSOR_AREA_IN_PARTY: + if (sBoxCursorPosition < PARTY_SIZE) + { + SetCursorMonData(&gPlayerParty[sBoxCursorPosition], MODE_PARTY); + break; + } + // fallthrough + case CURSOR_AREA_BUTTONS: + case CURSOR_AREA_BOX: + SetCursorMonData(NULL, MODE_2); + break; + case CURSOR_AREA_IN_BOX: + SetCursorMonData(GetBoxedMonPtr(StorageGetCurrentBox(), sBoxCursorPosition), MODE_BOX); + break; + } + } +} + +static void sub_80CEBDC(void) +{ + if (sIsMonBeingMoved) + SetCursorMonData(&gUnknown_02039D14, MODE_PARTY); + else + sub_80CEB40(); +} + +static void SetCursorMonData(void *pokemon, u8 mode) +{ + u8 *txtPtr; + u16 gender; + bool8 sanityIsBagEgg; + + gUnknown_02039D08->cursorMonItem = 0; + gender = MON_MALE; + sanityIsBagEgg = FALSE; + if (mode == MODE_PARTY) + { + struct Pokemon *mon = (struct Pokemon *)pokemon; + + gUnknown_02039D08->cursorMonSpecies = GetMonData(mon, MON_DATA_SPECIES2); + if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + { + sanityIsBagEgg = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBagEgg) + gUnknown_02039D08->cursorMonIsEgg = TRUE; + else + gUnknown_02039D08->cursorMonIsEgg = GetMonData(mon, MON_DATA_IS_EGG); + + GetMonData(mon, MON_DATA_NICKNAME, gUnknown_02039D08->cursorMonNick); + StringGetEnd10(gUnknown_02039D08->cursorMonNick); + gUnknown_02039D08->cursorMonLevel = GetMonData(mon, MON_DATA_LEVEL); + gUnknown_02039D08->cursorMonMarkings = GetMonData(mon, MON_DATA_MARKINGS); + gUnknown_02039D08->cursorMonPersonality = GetMonData(mon, MON_DATA_PERSONALITY); + gUnknown_02039D08->cursorMonPalette = GetMonFrontSpritePal(mon); + gender = GetMonGender(mon); + gUnknown_02039D08->cursorMonItem = GetMonData(mon, MON_DATA_HELD_ITEM); + } + } + else if (mode == MODE_BOX) + { + struct BoxPokemon *boxMon = (struct BoxPokemon *)pokemon; + + gUnknown_02039D08->cursorMonSpecies = GetBoxMonData(pokemon, MON_DATA_SPECIES2); + if (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE) + { + u32 otId = GetBoxMonData(boxMon, MON_DATA_OT_ID); + sanityIsBagEgg = GetBoxMonData(boxMon, MON_DATA_SANITY_IS_BAD_EGG); + if (sanityIsBagEgg) + gUnknown_02039D08->cursorMonIsEgg = TRUE; + else + gUnknown_02039D08->cursorMonIsEgg = GetBoxMonData(boxMon, MON_DATA_IS_EGG); + + + GetBoxMonData(boxMon, MON_DATA_NICKNAME, gUnknown_02039D08->cursorMonNick); + StringGetEnd10(gUnknown_02039D08->cursorMonNick); + gUnknown_02039D08->cursorMonLevel = GetLevelFromBoxMonExp(boxMon); + gUnknown_02039D08->cursorMonMarkings = GetBoxMonData(boxMon, MON_DATA_MARKINGS); + gUnknown_02039D08->cursorMonPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY); + gUnknown_02039D08->cursorMonPalette = GetFrontSpritePalFromSpeciesAndPersonality(gUnknown_02039D08->cursorMonSpecies, otId, gUnknown_02039D08->cursorMonPersonality); + gender = GetGenderFromSpeciesAndPersonality(gUnknown_02039D08->cursorMonSpecies, gUnknown_02039D08->cursorMonPersonality); + gUnknown_02039D08->cursorMonItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM); + } + } + else + { + gUnknown_02039D08->cursorMonSpecies = SPECIES_NONE; + gUnknown_02039D08->cursorMonItem = 0; + } + + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + { + StringFill(gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + StringFill(gUnknown_02039D08->cursorMonNickText, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + } + else if (gUnknown_02039D08->cursorMonIsEgg) + { + if (sanityIsBagEgg) + StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + else + StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gText_EggNickname, CHAR_SPACE, 8); + + StringFill(gUnknown_02039D08->cursorMonSpeciesName, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonGenderLvlText, CHAR_SPACE, 8); + StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + } + else + { + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NIDORAN_F || gUnknown_02039D08->cursorMonSpecies == SPECIES_NIDORAN_M) + gender = MON_GENDERLESS; + + StringCopyPadded(gUnknown_02039D08->cursorMonNickText, gUnknown_02039D08->cursorMonNick, CHAR_SPACE, 5); + + txtPtr = gUnknown_02039D08->cursorMonSpeciesName; + *(txtPtr)++ = CHAR_SLASH; + StringCopyPadded(txtPtr, gSpeciesNames[gUnknown_02039D08->cursorMonSpecies], CHAR_SPACE, 5); + + txtPtr = gUnknown_02039D08->cursorMonGenderLvlText; + *(txtPtr)++ = EXT_CTRL_CODE_BEGIN; + *(txtPtr)++ = 4; + switch (gender) + { + case MON_MALE: + *(txtPtr)++ = 4; + *(txtPtr)++ = 1; + *(txtPtr)++ = 5; + *(txtPtr)++ = CHAR_MALE; + break; + case MON_FEMALE: + *(txtPtr)++ = 6; + *(txtPtr)++ = 1; + *(txtPtr)++ = 7; + *(txtPtr)++ = CHAR_FEMALE; + break; + default: + *(txtPtr)++ = 2; + *(txtPtr)++ = 1; + *(txtPtr)++ = 3; + *(txtPtr)++ = 0x77; + break; + } + + *(txtPtr++) = EXT_CTRL_CODE_BEGIN; + *(txtPtr++) = 4; + *(txtPtr++) = 2; + *(txtPtr++) = 1; + *(txtPtr++) = 3; + *(txtPtr++) = 0; + *(txtPtr++) = CHAR_SPECIAL_F9; + *(txtPtr++) = 5; + + txtPtr = ConvertIntToDecimalStringN(txtPtr, gUnknown_02039D08->cursorMonLevel, STR_CONV_MODE_LEFT_ALIGN, 3); + txtPtr[0] = CHAR_SPACE; + txtPtr[1] = EOS; + + if (gUnknown_02039D08->cursorMonItem != 0) + StringCopyPadded(gUnknown_02039D08->cursorMonItemName, ItemId_GetName(gUnknown_02039D08->cursorMonItem), CHAR_SPACE, 8); + else + StringFill(gUnknown_02039D08->cursorMonItemName, CHAR_SPACE, 8); + } +} + +static u8 HandleInput_InBox(void) +{ + switch (gUnknown_02039D08->inBoxMovingMode) + { + case 0: + default: + return InBoxInput_Normal(); + case 1: + return InBoxInput_GrabbingMultiple(); + case 2: + return InBoxInput_MovingMultiple(); + } +} + +// This group of four functions handling input simply CANNOT be matched. +// GF must have written them in a really weird way, a way not a sane person could dream to reproduce. +#ifdef NONMATCHING +static u8 InBoxInput_Normal(void) +{ + u8 retVal; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD7 = 0; + retVal = 0; + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + retVal = TRUE; + cursorPosition += IN_BOX_ROWS; + if (cursorPosition >= IN_BOX_COUNT) + { + cursorArea = CURSOR_AREA_BUTTONS; + cursorPosition -= IN_BOX_COUNT; + cursorPosition /= 3; + gUnknown_02039D08->field_CD2 = 1; + gUnknown_02039D08->field_CD7 = 1; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + retVal = TRUE; + if (sBoxCursorPosition % IN_BOX_ROWS != 0) + { + cursorPosition--; + } + else + { + gUnknown_02039D08->field_CD3 = -1; + cursorPosition += (IN_BOX_ROWS - 1); + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + retVal = TRUE; + if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) + { + cursorPosition++; + } + else + { + gUnknown_02039D08->field_CD3 = 1; + cursorPosition -= (IN_BOX_ROWS - 1); + } + } + else if (gMain.newKeys & START_BUTTON) + { + retVal = TRUE; + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + } + else + { + if ((gMain.newKeys & A_BUTTON) && sub_80CFA5C()) + { + if (!sCanOnlyMove) + return 8; + + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS || sIsMonBeingMoved == TRUE) + { + switch (sub_80CFF98(0)) + { + case 1: + return 11; + case 2: + return 12; + case 3: + return 13; + case 4: + return 14; + case 5: + return 15; + case 12: + return 16; + case 13: + return 17; + case 15: + return 18; + } + } + else + { + gUnknown_02039D08->inBoxMovingMode = 1; + return 20; + } + } + + if (gMain.newKeys & B_BUTTON) + return 19; + + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) + { + if (gMain.heldKeys & L_BUTTON) + return 10; + if (gMain.heldKeys & R_BUTTON) + return 9; + } + + if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + retVal = FALSE; + } + } + else + { + retVal = TRUE; + if (sBoxCursorPosition >= IN_BOX_ROWS) + { + cursorPosition -= IN_BOX_ROWS; + } + else + { + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + } + } + + if (retVal) + sub_80CD894(cursorArea, cursorPosition); + + return retVal; +} +#else +NAKED +static u8 InBoxInput_Normal(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + ldr r0, =sBoxCursorArea\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldr r2, =sBoxCursorPosition\n\ + ldrb r4, [r2]\n\ + ldr r5, =gUnknown_02039D08\n\ + ldr r0, [r5]\n\ + ldr r1, =0x00000cd2\n\ + mov r10, r1\n\ + add r0, r10\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r5]\n\ + ldr r7, =0x00000cd3\n\ + adds r0, r7\n\ + strb r1, [r0]\n\ + ldr r0, [r5]\n\ + ldr r3, =0x00000cd7\n\ + mov r9, r3\n\ + add r0, r9\n\ + strb r1, [r0]\n\ + ldr r6, =gMain\n\ + ldrh r1, [r6, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r1\n\ + adds r3, r2, 0\n\ + cmp r0, 0\n\ + beq _080CF14C\n\ + b _080CF33C\n\ +_080CF14C:\n\ + movs r0, 0x80\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF1A8\n\ + movs r6, 0x1\n\ + lsls r0, r4, 24\n\ + movs r1, 0xC0\n\ + lsls r1, 19\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x1D\n\ + bgt _080CF168\n\ + b _080CF358\n\ +_080CF168:\n\ + movs r2, 0x3\n\ + mov r8, r2\n\ + subs r0, 0x1E\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + movs r1, 0x3\n\ + bl __divsi3\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldr r0, [r5]\n\ + add r0, r10\n\ + strb r6, [r0]\n\ + ldr r0, [r5]\n\ + add r0, r9\n\ + strb r6, [r0]\n\ + b _080CF358\n\ + .pool\n\ +_080CF1A8:\n\ + movs r0, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF1DE\n\ + movs r6, 0x1\n\ + movs r0, 0\n\ + ldrsb r0, [r3, r0]\n\ + movs r1, 0x6\n\ + bl __modsi3\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080CF1CA\n\ + lsls r0, r4, 24\n\ + movs r3, 0xFF\n\ + lsls r3, 24\n\ + b _080CF34C\n\ +_080CF1CA:\n\ + ldr r0, [r5]\n\ + adds r0, r7\n\ + movs r1, 0xFF\n\ + strb r1, [r0]\n\ + lsls r0, r4, 24\n\ + movs r1, 0xA0\n\ + lsls r1, 19\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + b _080CF358\n\ +_080CF1DE:\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF212\n\ + movs r6, 0x1\n\ + movs r0, 0\n\ + ldrsb r0, [r3, r0]\n\ + adds r0, 0x1\n\ + movs r1, 0x6\n\ + bl __modsi3\n\ + cmp r0, 0\n\ + beq _080CF204\n\ + lsls r0, r4, 24\n\ + movs r2, 0x80\n\ + lsls r2, 17\n\ + adds r0, r2\n\ + lsrs r4, r0, 24\n\ + b _080CF358\n\ +_080CF204:\n\ + ldr r0, [r5]\n\ + adds r0, r7\n\ + strb r6, [r0]\n\ + lsls r0, r4, 24\n\ + movs r3, 0xFB\n\ + lsls r3, 24\n\ + b _080CF34C\n\ +_080CF212:\n\ + ldrh r1, [r6, 0x2E]\n\ + movs r0, 0x8\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF220\n\ + movs r6, 0x1\n\ + b _080CF352\n\ +_080CF220:\n\ + movs r4, 0x1\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF2E4\n\ + bl sub_80CFA5C\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080CF2E4\n\ + ldr r0, =sCanOnlyMove\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _080CF244\n\ + movs r0, 0x8\n\ + b _080CF366\n\ + .pool\n\ +_080CF244:\n\ + ldr r1, [r5]\n\ + ldrb r0, [r1, 0x1]\n\ + cmp r0, 0x2\n\ + bne _080CF254\n\ + ldr r0, =sIsMonBeingMoved\n\ + ldrb r0, [r0]\n\ + cmp r0, 0x1\n\ + bne _080CF2D4\n\ +_080CF254:\n\ + movs r0, 0\n\ + bl sub_80CFF98\n\ + subs r0, 0x1\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0xE\n\ + bhi _080CF2E4\n\ + lsls r0, 2\n\ + ldr r1, =_080CF278\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080CF278:\n\ + .4byte _080CF2B4\n\ + .4byte _080CF2B8\n\ + .4byte _080CF2BC\n\ + .4byte _080CF2C0\n\ + .4byte _080CF2C4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2C8\n\ + .4byte _080CF2CC\n\ + .4byte _080CF2E4\n\ + .4byte _080CF2D0\n\ +_080CF2B4:\n\ + movs r0, 0xB\n\ + b _080CF366\n\ +_080CF2B8:\n\ + movs r0, 0xC\n\ + b _080CF366\n\ +_080CF2BC:\n\ + movs r0, 0xD\n\ + b _080CF366\n\ +_080CF2C0:\n\ + movs r0, 0xE\n\ + b _080CF366\n\ +_080CF2C4:\n\ + movs r0, 0xF\n\ + b _080CF366\n\ +_080CF2C8:\n\ + movs r0, 0x10\n\ + b _080CF366\n\ +_080CF2CC:\n\ + movs r0, 0x11\n\ + b _080CF366\n\ +_080CF2D0:\n\ + movs r0, 0x12\n\ + b _080CF366\n\ +_080CF2D4:\n\ + ldr r2, =0x000021ff\n\ + adds r0, r1, r2\n\ + strb r4, [r0]\n\ + movs r0, 0x14\n\ + b _080CF366\n\ + .pool\n\ +_080CF2E4:\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF2F8\n\ + movs r0, 0x13\n\ + b _080CF366\n\ + .pool\n\ +_080CF2F8:\n\ + ldr r0, =gSaveBlock2Ptr\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x13]\n\ + cmp r0, 0x1\n\ + bne _080CF326\n\ + ldrh r1, [r2, 0x2C]\n\ + movs r0, 0x80\n\ + lsls r0, 2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF318\n\ + movs r0, 0xA\n\ + b _080CF366\n\ + .pool\n\ +_080CF318:\n\ + movs r0, 0x80\n\ + lsls r0, 1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF326\n\ + movs r0, 0x9\n\ + b _080CF366\n\ +_080CF326:\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF338\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF366\n\ +_080CF338:\n\ + movs r6, 0\n\ + b _080CF364\n\ +_080CF33C:\n\ + movs r6, 0x1\n\ + movs r0, 0\n\ + ldrsb r0, [r2, r0]\n\ + cmp r0, 0x5\n\ + ble _080CF352\n\ + lsls r0, r4, 24\n\ + movs r3, 0xFA\n\ + lsls r3, 24\n\ +_080CF34C:\n\ + adds r0, r3\n\ + lsrs r4, r0, 24\n\ + b _080CF358\n\ +_080CF352:\n\ + movs r0, 0x2\n\ + mov r8, r0\n\ + movs r4, 0\n\ +_080CF358:\n\ + cmp r6, 0\n\ + beq _080CF364\n\ + mov r0, r8\n\ + adds r1, r4, 0\n\ + bl sub_80CD894\n\ +_080CF364:\n\ + adds r0, r6, 0\n\ +_080CF366:\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + "); +} +#endif + +static u8 InBoxInput_GrabbingMultiple(void) +{ + if (gMain.heldKeys & A_BUTTON) + { + if (gMain.newAndRepeatedKeys & DPAD_UP) + { + if (sBoxCursorPosition / IN_BOX_ROWS != 0) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - IN_BOX_ROWS); + return 21; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (sBoxCursorPosition + IN_BOX_ROWS < IN_BOX_COUNT) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + IN_BOX_ROWS); + return 21; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + if (sBoxCursorPosition % IN_BOX_ROWS != 0) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - 1); + return 21; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + 1); + return 21; + } + else + { + return 24; + } + } + else + { + return 0; + } + } + else + { + if (sub_80D0BA4() == sBoxCursorPosition) + { + gUnknown_02039D08->inBoxMovingMode = 0; + gUnknown_02039D08->field_CB8->invisible = FALSE; + return 22; + } + else + { + sIsMonBeingMoved = (gUnknown_02039D08->cursorMonSpecies != SPECIES_NONE); + gUnknown_02039D08->inBoxMovingMode = 2; + sMovingMonOrigBoxId = StorageGetCurrentBox(); + return 23; + } + } +} + +static u8 InBoxInput_MovingMultiple(void) +{ + if (gMain.newAndRepeatedKeys & DPAD_UP) + { + if (sub_80D0580(0)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - IN_BOX_ROWS); + return 25; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (sub_80D0580(1)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + IN_BOX_ROWS); + return 25; + } + else + { + return 24; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + if (sub_80D0580(2)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition - 1); + return 25; + } + else + { + return 10; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if (sub_80D0580(3)) + { + sub_80CD894(CURSOR_AREA_IN_BOX, sBoxCursorPosition + 1); + return 25; + } + else + { + return 9; + } + } + else if (gMain.newKeys & A_BUTTON) + { + if (sub_80D0BC0()) + { + sIsMonBeingMoved = FALSE; + gUnknown_02039D08->inBoxMovingMode = 0; + return 26; + } + else + { + return 24; + } + } + else if (gMain.newKeys & B_BUTTON) + { + return 24; + } + else + { + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) + { + if (gMain.heldKeys & L_BUTTON) + return 10; + if (gMain.heldKeys & R_BUTTON) + return 9; + } + + return 0; + } +} + +#ifdef NONMATCHING +static u8 HandleInput_InParty(void) +{ + u8 retVal; + bool8 gotoBox; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->field_CD7 = 0; + gotoBox = FALSE; + retVal = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + if (++cursorPosition > PARTY_SIZE) + cursorPosition = 0; + if (cursorPosition != sBoxCursorPosition) + retVal = 1; + } + else if ((gMain.newAndRepeatedKeys & DPAD_LEFT) && sBoxCursorPosition != 0) + { + retVal = 1; + gUnknown_02039D08->field_CD6 = sBoxCursorPosition; + cursorPosition = 0; + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + if (sBoxCursorPosition == 0) + { + retVal = 1; + cursorPosition = gUnknown_02039D08->field_CD6; + } + else + { + retVal = 6; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 0; + } + } + else + { + if (gMain.newKeys & A_BUTTON) + { + if (sBoxCursorPosition == PARTY_SIZE) + { + if (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT) + return 4; + + gotoBox = TRUE; + } + else if (sub_80CFA5C()) + { + if (!sCanOnlyMove) + return 8; + + switch (sub_80CFF98(0)) + { + case 1: + return 11; + case 2: + return 12; + case 3: + return 13; + case 4: + return 14; + case 5: + return 15; + case 12: + return 16; + case 13: + return 17; + case 15: + return 18; + } + } + } + + if (gMain.newKeys & B_BUTTON) + { + if (gUnknown_02039D08->boxOption == BOX_OPTION_DEPOSIT) + return 19; + + gotoBox = TRUE; + } + + if (gotoBox) + { + retVal = 6; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 0; + } + else if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + } + } + else + { + if (--cursorPosition < 0) + cursorPosition = PARTY_SIZE; + if (cursorPosition != sBoxCursorPosition) + retVal = 1; + } + if (retVal != 0) + { + if (retVal != 6) + sub_80CD894(cursorArea, cursorPosition); + } + + return retVal; +} +#else +NAKED +static u8 HandleInput_InParty(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + ldr r0, =sBoxCursorArea\n\ + ldrb r0, [r0]\n\ + mov r9, r0\n\ + ldr r6, =sBoxCursorPosition\n\ + ldrb r4, [r6]\n\ + ldr r2, =gUnknown_02039D08\n\ + ldr r0, [r2]\n\ + ldr r1, =0x00000cd3\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r2]\n\ + ldr r3, =0x00000cd2\n\ + adds r0, r3\n\ + strb r1, [r0]\n\ + ldr r0, [r2]\n\ + adds r3, 0x5\n\ + adds r0, r3\n\ + strb r1, [r0]\n\ + mov r8, r1\n\ + movs r7, 0\n\ + ldr r1, =gMain\n\ + ldrh r3, [r1, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r3\n\ + adds r5, r6, 0\n\ + mov r12, r1\n\ + cmp r0, 0\n\ + beq _080CF608\n\ + b _080CF7A8\n\ +_080CF608:\n\ + movs r0, 0x80\n\ + ands r0, r3\n\ + cmp r0, 0\n\ + beq _080CF64C\n\ + lsls r0, r4, 24\n\ + movs r1, 0x80\n\ + lsls r1, 17\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x6\n\ + ble _080CF622\n\ + movs r4, 0\n\ +_080CF622:\n\ + lsls r0, r4, 24\n\ + asrs r0, 24\n\ + movs r1, 0\n\ + ldrsb r1, [r5, r1]\n\ + cmp r0, r1\n\ + bne _080CF630\n\ + b _080CF7C6\n\ +_080CF630:\n\ + movs r7, 0x1\n\ + b _080CF7CA\n\ + .pool\n\ +_080CF64C:\n\ + movs r0, 0x20\n\ + ands r0, r3\n\ + cmp r0, 0\n\ + beq _080CF670\n\ + ldrb r1, [r5]\n\ + movs r0, 0\n\ + ldrsb r0, [r5, r0]\n\ + cmp r0, 0\n\ + beq _080CF670\n\ + movs r7, 0x1\n\ + ldr r0, [r2]\n\ + ldr r2, =0x00000cd6\n\ + adds r0, r2\n\ + strb r1, [r0]\n\ + movs r4, 0\n\ + b _080CF7C6\n\ + .pool\n\ +_080CF670:\n\ + mov r3, r12\n\ + ldrh r1, [r3, 0x30]\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF69E\n\ + movs r0, 0\n\ + ldrsb r0, [r5, r0]\n\ + cmp r0, 0\n\ + bne _080CF694\n\ + movs r7, 0x1\n\ + ldr r0, [r2]\n\ + ldr r1, =0x00000cd6\n\ + adds r0, r1\n\ + ldrb r4, [r0]\n\ + b _080CF7C6\n\ + .pool\n\ +_080CF694:\n\ + movs r7, 0x6\n\ + movs r2, 0\n\ + mov r9, r2\n\ + movs r4, 0\n\ + b _080CF7C6\n\ +_080CF69E:\n\ + mov r3, r12\n\ + ldrh r1, [r3, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF75C\n\ + movs r0, 0\n\ + ldrsb r0, [r5, r0]\n\ + cmp r0, 0x6\n\ + bne _080CF6C4\n\ + ldr r0, [r2]\n\ + ldrb r0, [r0, 0x1]\n\ + cmp r0, 0x1\n\ + bne _080CF6BE\n\ + movs r0, 0x4\n\ + b _080CF7D8\n\ +_080CF6BE:\n\ + movs r0, 0x1\n\ + mov r8, r0\n\ + b _080CF75C\n\ +_080CF6C4:\n\ + bl sub_80CFA5C\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080CF75C\n\ + ldr r0, =sCanOnlyMove\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + bne _080CF6E0\n\ + movs r0, 0x8\n\ + b _080CF7D8\n\ + .pool\n\ +_080CF6E0:\n\ + movs r0, 0\n\ + bl sub_80CFF98\n\ + subs r0, 0x1\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0xE\n\ + bhi _080CF75C\n\ + lsls r0, 2\n\ + ldr r1, =_080CF700\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080CF700:\n\ + .4byte _080CF73C\n\ + .4byte _080CF740\n\ + .4byte _080CF744\n\ + .4byte _080CF748\n\ + .4byte _080CF74C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF75C\n\ + .4byte _080CF750\n\ + .4byte _080CF754\n\ + .4byte _080CF75C\n\ + .4byte _080CF758\n\ +_080CF73C:\n\ + movs r0, 0xB\n\ + b _080CF7D8\n\ +_080CF740:\n\ + movs r0, 0xC\n\ + b _080CF7D8\n\ +_080CF744:\n\ + movs r0, 0xD\n\ + b _080CF7D8\n\ +_080CF748:\n\ + movs r0, 0xE\n\ + b _080CF7D8\n\ +_080CF74C:\n\ + movs r0, 0xF\n\ + b _080CF7D8\n\ +_080CF750:\n\ + movs r0, 0x10\n\ + b _080CF7D8\n\ +_080CF754:\n\ + movs r0, 0x11\n\ + b _080CF7D8\n\ +_080CF758:\n\ + movs r0, 0x12\n\ + b _080CF7D8\n\ +_080CF75C:\n\ + ldr r2, =gMain\n\ + ldrh r1, [r2, 0x2E]\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + mov r12, r2\n\ + cmp r0, 0\n\ + beq _080CF784\n\ + ldr r0, =gUnknown_02039D08\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x1]\n\ + cmp r0, 0x1\n\ + bne _080CF780\n\ + movs r0, 0x13\n\ + b _080CF7D8\n\ + .pool\n\ +_080CF780:\n\ + movs r1, 0x1\n\ + mov r8, r1\n\ +_080CF784:\n\ + mov r2, r8\n\ + cmp r2, 0\n\ + beq _080CF794\n\ + movs r7, 0x6\n\ + movs r3, 0\n\ + mov r9, r3\n\ + movs r4, 0\n\ + b _080CF7C6\n\ +_080CF794:\n\ + mov r0, r12\n\ + ldrh r1, [r0, 0x2E]\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF7C6\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF7D8\n\ +_080CF7A8:\n\ + lsls r0, r4, 24\n\ + movs r1, 0xFF\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r4, r0, 24\n\ + cmp r0, 0\n\ + bge _080CF7B8\n\ + movs r4, 0x6\n\ +_080CF7B8:\n\ + lsls r0, r4, 24\n\ + asrs r0, 24\n\ + movs r1, 0\n\ + ldrsb r1, [r6, r1]\n\ + cmp r0, r1\n\ + beq _080CF7C6\n\ + movs r7, 0x1\n\ +_080CF7C6:\n\ + cmp r7, 0\n\ + beq _080CF7D6\n\ +_080CF7CA:\n\ + cmp r7, 0x6\n\ + beq _080CF7D6\n\ + mov r0, r9\n\ + adds r1, r4, 0\n\ + bl sub_80CD894\n\ +_080CF7D6:\n\ + adds r0, r7, 0\n\ +_080CF7D8:\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); +} +#endif + +#ifdef NONMATCHING +static u8 HandleInput_OnBox(void) +{ + u8 retVal; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->field_CD7 = 0; + retVal = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & DPAD_DOWN) + { + retVal = 1; + cursorArea = CURSOR_AREA_IN_BOX; + cursorPosition = 2; + } + else + { + if (gMain.heldKeys & DPAD_LEFT) + return 10; + if (gMain.heldKeys & DPAD_RIGHT) + return 9; + + if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR) + { + if (gMain.heldKeys & L_BUTTON) + return 10; + if (gMain.heldKeys & R_BUTTON) + return 9; + } + + if (gMain.newKeys & A_BUTTON) + { + sub_80CD1A8(FALSE); + AddBoxMenu(); + return 7; + } + + if (gMain.newKeys & B_BUTTON) + return 19; + + if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + + retVal = 0; + } + } + else + { + retVal = 1; + cursorArea = CURSOR_AREA_BUTTONS; + cursorPosition = 0; + gUnknown_02039D08->field_CD7 = 1; + } + + if (retVal) + { + if (cursorArea != CURSOR_AREA_BOX) + sub_80CD1A8(FALSE); + sub_80CD894(cursorArea, cursorPosition); + } + + return retVal; +} +#else +NAKED +static u8 HandleInput_OnBox(void) +{ + asm_unified("\n\ + push {r4-r6,lr}\n\ + ldr r3, =gUnknown_02039D08\n\ + ldr r0, [r3]\n\ + ldr r1, =0x00000cd3\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r2, =0x00000cd2\n\ + adds r0, r2\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r5, =0x00000cd7\n\ + adds r0, r5\n\ + strb r1, [r0]\n\ + ldr r1, =gMain\n\ + ldrh r2, [r1, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _080CF8AA\n\ + movs r0, 0x80\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _080CF834\n\ + movs r4, 0x1\n\ + movs r1, 0\n\ + movs r6, 0x2\n\ + b _080CF8B6\n\ + .pool\n\ +_080CF834:\n\ + ldrh r2, [r1, 0x2C]\n\ + movs r0, 0x20\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _080CF85A\n\ + movs r0, 0x10\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + bne _080CF86E\n\ + ldr r0, =gSaveBlock2Ptr\n\ + ldr r0, [r0]\n\ + ldrb r0, [r0, 0x13]\n\ + cmp r0, 0x1\n\ + bne _080CF872\n\ + movs r0, 0x80\n\ + lsls r0, 2\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _080CF864\n\ +_080CF85A:\n\ + movs r0, 0xA\n\ + b _080CF8D2\n\ + .pool\n\ +_080CF864:\n\ + movs r0, 0x80\n\ + lsls r0, 1\n\ + ands r0, r2\n\ + cmp r0, 0\n\ + beq _080CF872\n\ +_080CF86E:\n\ + movs r0, 0x9\n\ + b _080CF8D2\n\ +_080CF872:\n\ + ldrh r1, [r1, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF88A\n\ + movs r0, 0\n\ + bl sub_80CD1A8\n\ + bl AddBoxMenu\n\ + movs r0, 0x7\n\ + b _080CF8D2\n\ +_080CF88A:\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF896\n\ + movs r0, 0x13\n\ + b _080CF8D2\n\ +_080CF896:\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF8A6\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF8D2\n\ +_080CF8A6:\n\ + movs r4, 0\n\ + b _080CF8D0\n\ +_080CF8AA:\n\ + movs r4, 0x1\n\ + movs r1, 0x3\n\ + movs r6, 0\n\ + ldr r0, [r3]\n\ + adds r0, r5\n\ + strb r4, [r0]\n\ +_080CF8B6:\n\ + cmp r4, 0\n\ + beq _080CF8D0\n\ + lsls r5, r1, 24\n\ + cmp r1, 0x2\n\ + beq _080CF8C6\n\ + movs r0, 0\n\ + bl sub_80CD1A8\n\ +_080CF8C6:\n\ + lsrs r0, r5, 24\n\ + lsls r1, r6, 24\n\ + lsrs r1, 24\n\ + bl sub_80CD894\n\ +_080CF8D0:\n\ + adds r0, r4, 0\n\ +_080CF8D2:\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1\n\ + "); +} +#endif + +#ifdef NONMATCHING +static u8 HandleInput_OnButtons(void) +{ + u8 retVal; + s8 cursorArea = sBoxCursorArea; + s8 cursorPosition = sBoxCursorPosition; + + gUnknown_02039D08->field_CD3 = 0; + gUnknown_02039D08->field_CD2 = 0; + gUnknown_02039D08->field_CD7 = 0; + + if (!(gMain.newAndRepeatedKeys & DPAD_UP)) + { + if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON)) + { + retVal = 1; + cursorArea = CURSOR_AREA_BOX; + cursorPosition = 0; + gUnknown_02039D08->field_CD7 = 1; + } + else if (gMain.newAndRepeatedKeys & DPAD_LEFT) + { + retVal = 1; + if (--cursorPosition < 0) + { + cursorPosition = 1; + } + } + else if (gMain.newAndRepeatedKeys & DPAD_RIGHT) + { + retVal = 1; + if (++cursorPosition > 1) + { + cursorPosition = 0; + } + } + else if (gMain.newKeys & A_BUTTON) + { + return (cursorPosition == 0) ? 5 : 4; + } + else if (gMain.newKeys & B_BUTTON) + { + return 19; + } + else if (gMain.newKeys & SELECT_BUTTON) + { + sub_80CFDC4(); + return 0; + } + else + { + retVal = 0; + } + } + else + { + retVal = 1; + cursorArea = CURSOR_AREA_IN_BOX; + gUnknown_02039D08->field_CD2 = -1; + cursorPosition = (sBoxCursorPosition == 0) ? IN_BOX_COUNT - 1 - 5 : IN_BOX_COUNT - 1; + gUnknown_02039D08->field_CD7 = 1; + } + + if (retVal != 0) + { + sub_80CD894(cursorArea, cursorPosition); + } + + return retVal; +} +#else +NAKED +static u8 HandleInput_OnButtons(void) +{ + asm_unified("\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + ldr r0, =sBoxCursorArea\n\ + ldrb r0, [r0]\n\ + mov r8, r0\n\ + ldr r0, =sBoxCursorPosition\n\ + mov r12, r0\n\ + ldrb r2, [r0]\n\ + ldr r3, =gUnknown_02039D08\n\ + ldr r0, [r3]\n\ + ldr r1, =0x00000cd3\n\ + adds r0, r1\n\ + movs r1, 0\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r6, =0x00000cd2\n\ + adds r0, r6\n\ + strb r1, [r0]\n\ + ldr r0, [r3]\n\ + ldr r5, =0x00000cd7\n\ + adds r0, r5\n\ + strb r1, [r0]\n\ + ldr r7, =gMain\n\ + ldrh r1, [r7, 0x30]\n\ + movs r0, 0x40\n\ + ands r0, r1\n\ + adds r4, r3, 0\n\ + cmp r0, 0\n\ + bne _080CF9B2\n\ + movs r0, 0x88\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF944\n\ + movs r7, 0x1\n\ + movs r0, 0x2\n\ + mov r8, r0\n\ + movs r2, 0\n\ + ldr r0, [r4]\n\ + b _080CF9D0\n\ + .pool\n\ +_080CF944:\n\ + movs r0, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF960\n\ + movs r7, 0x1\n\ + lsls r0, r2, 24\n\ + movs r1, 0xFF\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r2, r0, 24\n\ + cmp r0, 0\n\ + bge _080CF9D4\n\ + movs r2, 0x1\n\ + b _080CF9D4\n\ +_080CF960:\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF97E\n\ + movs r7, 0x1\n\ + lsls r0, r2, 24\n\ + movs r1, 0x80\n\ + lsls r1, 17\n\ + adds r0, r1\n\ + lsrs r2, r0, 24\n\ + asrs r0, 24\n\ + cmp r0, 0x1\n\ + ble _080CF9D4\n\ + movs r2, 0\n\ + b _080CF9D4\n\ +_080CF97E:\n\ + ldrh r1, [r7, 0x2E]\n\ + movs r0, 0x1\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF992\n\ + movs r0, 0x4\n\ + cmp r2, 0\n\ + bne _080CF9E2\n\ + movs r0, 0x5\n\ + b _080CF9E2\n\ +_080CF992:\n\ + movs r0, 0x2\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF99E\n\ + movs r0, 0x13\n\ + b _080CF9E2\n\ +_080CF99E:\n\ + movs r0, 0x4\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080CF9AE\n\ + bl sub_80CFDC4\n\ + movs r0, 0\n\ + b _080CF9E2\n\ +_080CF9AE:\n\ + movs r7, 0\n\ + b _080CF9E0\n\ +_080CF9B2:\n\ + movs r7, 0x1\n\ + movs r0, 0\n\ + mov r8, r0\n\ + ldr r0, [r3]\n\ + adds r0, r6\n\ + movs r1, 0xFF\n\ + strb r1, [r0]\n\ + mov r1, r12\n\ + movs r0, 0\n\ + ldrsb r0, [r1, r0]\n\ + movs r2, 0x1D\n\ + cmp r0, 0\n\ + bne _080CF9CE\n\ + movs r2, 0x18\n\ +_080CF9CE:\n\ + ldr r0, [r3]\n\ +_080CF9D0:\n\ + adds r0, r5\n\ + strb r7, [r0]\n\ +_080CF9D4:\n\ + cmp r7, 0\n\ + beq _080CF9E0\n\ + mov r0, r8\n\ + adds r1, r2, 0\n\ + bl sub_80CD894\n\ +_080CF9E0:\n\ + adds r0, r7, 0\n\ +_080CF9E2:\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1"); +} +#endif + +static u8 HandleInput(void) +{ + struct + { + u8 (*func)(void); + s8 area; + } + static const inputFuncs[] = + { + {HandleInput_InBox, CURSOR_AREA_IN_BOX}, + {HandleInput_InParty, CURSOR_AREA_IN_PARTY}, + {HandleInput_OnBox, CURSOR_AREA_BOX}, + {HandleInput_OnButtons, CURSOR_AREA_BUTTONS}, + {NULL, 0}, + }; + + u16 i = 0; + while (inputFuncs[i].func != NULL) + { + if (inputFuncs[i].area == sBoxCursorArea) + return inputFuncs[i].func(); + i++; + } + + return 0; +} + +void AddBoxMenu(void) +{ + InitMenu(); + SetMenuText(9); + SetMenuText(10); + SetMenuText(11); + SetMenuText(0); +} + +u8 sub_80CFA5C(void) +{ + InitMenu(); + if (gUnknown_02039D08->boxOption != BOX_OPTION_MOVE_ITEMS) + return sub_80CFA84(); + else + return sub_80CFB44(); +} + +static bool8 sub_80CFA84(void) +{ + u16 var0 = sub_80CD504(); + + switch (gUnknown_02039D08->boxOption) + { + case BOX_OPTION_DEPOSIT: + if (var0) + SetMenuText(1); + else + return FALSE; + break; + case BOX_OPTION_WITHDRAW: + if (var0) + SetMenuText(2); + else + return FALSE; + break; + case BOX_OPTION_MOVE_MONS: + if (sIsMonBeingMoved) + { + if (var0) + SetMenuText(4); + else + SetMenuText(5); + } + else + { + if (var0) + SetMenuText(3); + else + return FALSE; + } + break; + case BOX_OPTION_MOVE_ITEMS: + default: + return FALSE; + } + + SetMenuText(6); + if (gUnknown_02039D08->boxOption == BOX_OPTION_MOVE_MONS) + { + if (!sBoxCursorArea) + SetMenuText(2); + else + SetMenuText(1); + } + + SetMenuText(8); + SetMenuText(7); + SetMenuText(0); + return TRUE; +} + +static bool8 sub_80CFB44(void) +{ + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_EGG) + return FALSE; + + if (!sub_80D127C()) + { + if (gUnknown_02039D08->cursorMonItem == 0) + { + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + return FALSE; + + SetMenuText(14); + } + else + { + if (!ItemIsMail(gUnknown_02039D08->cursorMonItem)) + { + SetMenuText(12); + SetMenuText(16); + } + SetMenuText(17); + } + } + else + { + if (gUnknown_02039D08->cursorMonItem == 0) + { + if (gUnknown_02039D08->cursorMonSpecies == SPECIES_NONE) + return FALSE; + + SetMenuText(13); + } + else + { + if (ItemIsMail(gUnknown_02039D08->cursorMonItem) == TRUE) + return FALSE; + + SetMenuText(15); + } + } + + SetMenuText(0); + return TRUE; +} + +void sub_80CFBF4(struct Sprite *sprite) +{ + sprite->pos1.x = gUnknown_02039D08->field_CB4->pos1.x; + sprite->pos1.y = gUnknown_02039D08->field_CB4->pos1.y + 20; +} + +void sub_80CFC14(void) +{ + u16 x, y; + u8 spriteId; + u8 priority, subpriority; + struct SpriteSheet spriteSheets[] = + { + {gHandCursorTiles, 0x800, 0}, + {gHandCursorShadowTiles, 0x80, 1}, + {} + }; + + struct SpritePalette spritePalettes[] = + { + {gHandCursorPalette, 0xDAC7}, + {} + }; + +static const struct OamData sOamData_857BA0C = +{ + .size = 2, + .priority = 1, +}; +static const struct OamData sOamData_857BA14 = +{ + .size = 1, + .priority = 1, +}; + +static const union AnimCmd sSpriteAnim_857BA1C[] = +{ + ANIMCMD_FRAME(0, 30), + ANIMCMD_FRAME(16, 30), + ANIMCMD_JUMP(0) +}; +static const union AnimCmd sSpriteAnim_857BA28[] = +{ + ANIMCMD_FRAME(0, 5), + ANIMCMD_END +}; +static const union AnimCmd sSpriteAnim_857BA30[] = +{ + ANIMCMD_FRAME(32, 5), + ANIMCMD_END +}; +static const union AnimCmd sSpriteAnim_857BA38[] = +{ + ANIMCMD_FRAME(48, 5), + ANIMCMD_END +}; + +static const union AnimCmd *const sSpriteAnimTable_857BA40[] = +{ + sSpriteAnim_857BA1C, + sSpriteAnim_857BA28, + sSpriteAnim_857BA30, + sSpriteAnim_857BA38 +}; + +static const struct SpriteTemplate gSpriteTemplate_857BA50 = +{ + .tileTag = 0, + .paletteTag = 0xDACA, + .oam = &sOamData_857BA0C, + .anims = sSpriteAnimTable_857BA40, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, +}; + +static const struct SpriteTemplate gSpriteTemplate_857BA68 = +{ + .tileTag = 1, + .paletteTag = 0xDACA, + .oam = &sOamData_857BA14, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_80CFBF4, +}; + + LoadSpriteSheets(spriteSheets); + LoadSpritePalettes(spritePalettes); + gUnknown_02039D08->field_CD8[0] = IndexOfSpritePaletteTag(0xDACA); + gUnknown_02039D08->field_CD8[1] = IndexOfSpritePaletteTag(0xDAC7); + + sub_80CD444(sBoxCursorArea, sBoxCursorPosition, &x, &y); + spriteId = CreateSprite(&gSpriteTemplate_857BA50, x, y, 6); + if (spriteId != MAX_SPRITES) + { + gUnknown_02039D08->field_CB4 = &gSprites[spriteId]; + gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; + gUnknown_02039D08->field_CB4->oam.priority = 1; + if (sIsMonBeingMoved) + StartSpriteAnim(gUnknown_02039D08->field_CB4, 3); + } + else + { + gUnknown_02039D08->field_CB4 = NULL; + } + + if (sBoxCursorArea == 1) + { + subpriority = 13; + priority = 1; + } + else + { + subpriority = 21; + priority = 2; + } + + spriteId = CreateSprite(&gSpriteTemplate_857BA68, 0, 0, subpriority); + if (spriteId != MAX_SPRITES) + { + gUnknown_02039D08->field_CB8 = &gSprites[spriteId]; + gUnknown_02039D08->field_CB8->oam.priority = priority; + if (sBoxCursorArea) + gUnknown_02039D08->field_CB8->invisible = 1; + } + else + { + gUnknown_02039D08->field_CB8 = NULL; + } +} + +void sub_80CFDC4(void) +{ + sCanOnlyMove = !sCanOnlyMove; + gUnknown_02039D08->field_CB4->oam.paletteNum = gUnknown_02039D08->field_CD8[sCanOnlyMove]; +} + +u8 GetBoxCursorPosition(void) +{ + return sBoxCursorPosition; +} + +void sub_80CFE14(u8 *arg0, u8 *arg1) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + { + *arg0 = sBoxCursorPosition % IN_BOX_ROWS; + *arg1 = sBoxCursorPosition / IN_BOX_ROWS; + } + else + { + *arg0 = 0; + *arg1 = 0; + } +} + +void sub_80CFE54(u8 animNum) +{ + StartSpriteAnim(gUnknown_02039D08->field_CB4, animNum); +} + +u8 sub_80CFE78(void) +{ + return sMovingMonOrigBoxId; +} + +void sub_80CFE84(void) +{ + gUnknown_02039D08->field_CB4->oam.priority = 1; +} + +void sub_80CFEA8(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0E50(0, sBoxCursorPosition); +} + +void sub_80CFECC(void) +{ + if (sBoxCursorArea == CURSOR_AREA_IN_BOX) + sub_80D0D8C(0, sBoxCursorPosition); +} + +static void InitMenu(void) +{ + gUnknown_02039D08->menuItemsCount = 0; + gUnknown_02039D08->menuWidth = 0; + gUnknown_02039D08->menuWindow.bg = 0; + gUnknown_02039D08->menuWindow.paletteNum = 15; + gUnknown_02039D08->menuWindow.baseBlock = 92; +} + +static const u8 *const gUnknown_0857BA80[] = +{ + gPCText_Cancel, + gPCText_Store, + gPCText_Withdraw, + gPCText_Move, + gPCText_Shift, + gPCText_Place, + gPCText_Summary, + gPCText_Release, + gPCText_Mark, + gPCText_Jump, + gPCText_Wallpaper, + gPCText_Name, + gPCText_Take, + gPCText_Give, + gPCText_Give, + gPCText_Switch, + gPCText_Bag, + gPCText_Info, + gPCText_Scenery1, + gPCText_Scenery2, + gPCText_Scenery3, + gPCText_Etcetera, + gPCText_Friends, + gPCText_Forest, + gPCText_City, + gPCText_Desert, + gPCText_Savanna, + gPCText_Crag, + gPCText_Volcano, + gPCText_Snow, + gPCText_Cave, + gPCText_Beach, + gPCText_Seafloor, + gPCText_River, + gPCText_Sky, + gPCText_PolkaDot, + gPCText_Pokecenter, + gPCText_Machine, + gPCText_Simple, +}; + +static void SetMenuText(u8 textId) +{ + if (gUnknown_02039D08->menuItemsCount < 7) + { + u8 len; + struct StorageMenu *menu = &gUnknown_02039D08->menuItems[gUnknown_02039D08->menuItemsCount]; + + menu->text = gUnknown_0857BA80[textId]; + menu->textId = textId; + len = StringLength(menu->text); + if (len > gUnknown_02039D08->menuWidth) + gUnknown_02039D08->menuWidth = len; + + gUnknown_02039D08->menuItemsCount++; + } +} + +s8 sub_80CFF98(u8 arg0) +{ + if (arg0 >= gUnknown_02039D08->menuItemsCount) + return -1; + else + return gUnknown_02039D08->menuItems[arg0].textId; +} + +static void AddMenu(void) +{ + gUnknown_02039D08->menuWindow.width = gUnknown_02039D08->menuWidth + 2; + gUnknown_02039D08->menuWindow.height = 2 * gUnknown_02039D08->menuItemsCount; + gUnknown_02039D08->menuWindow.tilemapLeft = 29 - gUnknown_02039D08->menuWindow.width; + gUnknown_02039D08->menuWindow.tilemapTop = 15 - gUnknown_02039D08->menuWindow.height; + gUnknown_02039D08->field_CB0 = AddWindow(&gUnknown_02039D08->menuWindow); + ClearWindowTilemap(gUnknown_02039D08->field_CB0); + SetWindowBorderStyle(gUnknown_02039D08->field_CB0, FALSE, 11, 14); + PrintMenuTable(gUnknown_02039D08->field_CB0, gUnknown_02039D08->menuItemsCount, (void*)gUnknown_02039D08->menuItems); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_02039D08->field_CB0, gUnknown_02039D08->menuItemsCount, 0); + schedule_bg_copy_tilemap_to_vram(0); + gUnknown_02039D08->field_CAE = 0; +} + +bool8 sub_80D00A8(void) +{ + return 0; +} + +s16 sub_80D00AC(void) +{ + s32 textId = -2; + + if (!(gMain.newKeys & A_BUTTON)) + { + if (gMain.newKeys & B_BUTTON) + { + PlaySE(SE_SELECT); + textId = -1; + } + + if (gMain.newKeys & DPAD_UP) + { + PlaySE(SE_SELECT); + Menu_MoveCursor(-1); + } + else if (gMain.newKeys & DPAD_DOWN) + { + PlaySE(SE_SELECT); + Menu_MoveCursor(1); + } + } + else + { + textId = Menu_GetCursorPos(); + } + + if (textId != -2) + sub_80D013C(); + + if (textId >= 0) + textId = gUnknown_02039D08->menuItems[textId].textId; + + #ifndef NONMATCHING + asm("":::"r4"); + #endif // NONMATCHING + return textId; +} + +void sub_80D013C(void) +{ + sub_8198070(gUnknown_02039D08->field_CB0, TRUE); + RemoveWindow(gUnknown_02039D08->field_CB0); +} diff --git a/src/script_menu.c b/src/script_menu.c index 2aa546288..6f16b1a8a 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -1640,27 +1640,27 @@ static void sub_80E2A94(u8 multichoiceId) { case 77: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 76: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 78: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 79: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 75: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; case 74: FillWindowPixelBuffer(0, 0x11); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[GetMenuCursorPos()], 0, NULL, 2, 1, 3); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); break; } } diff --git a/src/start_menu.c b/src/start_menu.c index 079f05be0..62fdc07d5 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -574,13 +574,13 @@ static bool8 HandleStartMenuInput(void) if (gMain.newKeys & DPAD_UP) { PlaySE(SE_SELECT); - sStartMenuCursorPos = MoveMenuCursor(-1); + sStartMenuCursorPos = Menu_MoveCursor(-1); } if (gMain.newKeys & DPAD_DOWN) { PlaySE(SE_SELECT); - sStartMenuCursorPos = MoveMenuCursor(1); + sStartMenuCursorPos = Menu_MoveCursor(1); } if (gMain.newKeys & A_BUTTON)