diff --git a/asm/ground_script.s b/asm/ground_script.s index 74e682181..8339688e4 100644 --- a/asm/ground_script.s +++ b/asm/ground_script.s @@ -5,4810 +5,6 @@ .text - thumb_func_start ExecuteScriptCommand -ExecuteScriptCommand: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1BC - mov r9, r0 - movs r0, 0x24 - add r0, r9 - mov r10, r0 -_0809EAE0: - mov r1, r10 - ldr r2, [r1, 0x4] - str r2, [r1, 0x1C] - add r1, sp, 0x8 - adds r0, r2, 0 - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, [r0] - str r0, [r1] - adds r2, 0x10 - mov r0, r10 - str r2, [r0, 0x4] - add r0, sp, 0x8 - ldrb r0, [r0] - mov r1, r10 - adds r1, 0x20 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - subs r0, 0x1 - adds r2, r1, 0 - cmp r0, 0xF5 - bhi _0809EAE0 - lsls r0, 2 - ldr r1, _0809EB18 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0809EB18: .4byte _0809EB1C - .align 2, 0 -_0809EB1C: - .4byte _0809EEF4 - .4byte _0809EF40 - .4byte _0809EFA2 - .4byte _0809EFD6 - .4byte _0809F064 - .4byte _0809F02A - .4byte _0809F06C - .4byte _0809F0D0 - .4byte _0809F0D0 - .4byte _0809F1FC - .4byte _0809F2C8 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F2D6 - .4byte _0809F42A - .4byte _0809F432 - .4byte _0809F43A - .4byte _0809F442 - .4byte _0809F4FE - .4byte _0809F5BE - .4byte _0809F5AE - .4byte _0809F5C6 - .4byte _0809F5C6 - .4byte _0809F660 - .4byte _0809F6EA - .4byte _0809F786 - .4byte _0809F830 - .4byte _0809F842 - .4byte _0809F854 - .4byte _0809F872 - .4byte _0809F884 - .4byte _0809F896 - .4byte _0809F896 - .4byte _0809F8E8 - .4byte _0809F8F4 - .4byte _0809F900 - .4byte _0809F90C - .4byte _0809F93E - .4byte _0809FAF8 - .4byte _0809FB10 - .4byte _0809F92E - .4byte _0809F936 - .4byte _0809FB28 - .4byte _0809FB28 - .4byte _0809FB28 - .4byte _0809FB28 - .4byte _0809FB28 - .4byte _0809FB28 - .4byte _0809FB28 - .4byte _0809FBDA - .4byte _0809FC12 - .4byte _0809FC40 - .4byte _0809FC2E - .4byte _0809FC46 - .4byte _0809FCA4 - .4byte _0809FCC4 - .4byte _0809EAE0 - .4byte _080A0E3A - .4byte _0809FCE8 - .4byte _0809FCF0 - .4byte _0809FD0A - .4byte _0809FD38 - .4byte _0809FD6C - .4byte _0809FDA0 - .4byte _0809FDA8 - .4byte _0809FDC2 - .4byte _0809FDD4 - .4byte _0809FDE2 - .4byte _0809FDC2 - .4byte _0809FDD4 - .4byte _0809FDE2 - .4byte _0809FE04 - .4byte _0809FE28 - .4byte _0809FE86 - .4byte _0809FEBE - .4byte _0809FED0 - .4byte _0809FF00 - .4byte _0809FF32 - .4byte _0809FF46 - .4byte _0809FF62 - .4byte _0809FF78 - .4byte _0809FF9A - .4byte _0809FFBA - .4byte _0809FFE4 - .4byte _080A0010 - .4byte _080A0064 - .4byte _080A0096 - .4byte _080A010E - .4byte _080A0186 - .4byte _080A0198 - .4byte _080A01B8 - .4byte _080A01F0 - .4byte _080A0220 - .4byte _080A0250 - .4byte _080A0282 - .4byte _080A0282 - .4byte _080A0560 - .4byte _080A0198 - .4byte _080A01B8 - .4byte _080A01F0 - .4byte _080A0220 - .4byte _080A0250 - .4byte _080A0282 - .4byte _080A0282 - .4byte _080A0560 - .4byte _080A02B2 - .4byte _080A0310 - .4byte _080A0370 - .4byte _080A03F8 - .4byte _080A0462 - .4byte _080A04F2 - .4byte _080A02B2 - .4byte _080A0310 - .4byte _080A0370 - .4byte _080A03F8 - .4byte _080A0462 - .4byte _080A04F2 - .4byte _080A02B2 - .4byte _080A0310 - .4byte _080A0370 - .4byte _080A03F8 - .4byte _080A0462 - .4byte _080A04F2 - .4byte _080A02B2 - .4byte _080A0310 - .4byte _080A0370 - .4byte _080A03F8 - .4byte _080A0462 - .4byte _080A04F2 - .4byte _080A057C - .4byte _080A05A4 - .4byte _080A05F0 - .4byte _080A060E - .4byte _080A065C - .4byte _080A068A - .4byte _080A068A - .4byte _080A068A - .4byte _080A07CA - .4byte _080A07DC - .4byte _080A07C4 - .4byte _080A07C4 - .4byte _080A07C4 - .4byte _0809EAE0 - .4byte _080A080C - .4byte _080A081E - .4byte _080A086A - .4byte _080A08BE - .4byte _080A08CA - .4byte _080A091E - .4byte _080A0986 - .4byte _080A0998 - .4byte _080A09EA - .4byte _080A0A52 - .4byte _080A0A64 - .4byte _080A0AB6 - .4byte _080A0B1E - .4byte _080A0B30 - .4byte _080A0B42 - .4byte _080A0B54 - .4byte _080A0B6C - .4byte _080A0B88 - .4byte _080A0BA2 - .4byte _080A0BB4 - .4byte _080A0BDA - .4byte _080A0BF6 - .4byte _080A0C08 - .4byte _080A0C20 - .4byte _080A0C38 - .4byte _080A0C50 - .4byte _080A0C68 - .4byte _080A0C80 - .4byte _080A0C90 - .4byte _080A0CA2 - .4byte _080A0CC8 - .4byte _080A0CF2 - .4byte _080A0D16 - .4byte _080A0D40 - .4byte _080A0D6A - .4byte _080A0D7A - .4byte _080A0D94 - .4byte _080A0DAE - .4byte _080A0DD6 - .4byte _080A0E08 - .4byte _080A0DE2 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _080A0E56 - .4byte _0809EAE0 - .4byte _0809EAE0 - .4byte _0809EAE0 - .4byte _080A10A0 - .4byte _0809EAE0 - .4byte _0809EAE0 - .4byte _080A10F8 - .4byte _080A10F8 - .4byte _080A10F8 - .4byte _080A10F8 - .4byte _080A10F8 - .4byte _080A10F8 - .4byte _080A10F8 - .4byte _0809EAE0 - .4byte _080A129E - .4byte _080A12A8 - .4byte _080A12B4 - .4byte _0809F0C4 - .4byte _0809F0C4 - .4byte _0809F0C4 - .4byte _0809F0C4 - .4byte _0809F0C4 - .4byte _0809F0C4 - .4byte _080A12D0 - .4byte _080A12E6 - .4byte _080A12F4 - .4byte _080A1318 - .4byte _080A1324 - .4byte _080A1338 - .4byte _080A1344 - .4byte _080A1368 - .4byte _080A1374 - .4byte _080A13CA - .4byte _080A13F8 - .4byte _080A1404 - .4byte _080A140C - .4byte _080A1428 - .4byte _080A142C - .4byte _0809EAE0 - .4byte _0809EAE0 - .4byte _0809EAE0 - .4byte _0809EAE0 - .4byte _0809EAE0 -_0809EEF4: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r4, r0, 16 - adds r6, r4, 0 - add r0, sp, 0x8 - ldrb r5, [r0, 0x1] - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809EF26 - ldr r1, _0809EF38 - ldr r2, _0809EF3C - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 2 - adds r2, 0x8 - adds r0, r2 - ldr r3, [r0] - str r5, [sp] - movs r0, 0x1 - adds r2, r4, 0 - bl Log -_0809EF26: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r2, [r0, r1] - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundMainGroundRequest - b _0809EAE0 - .align 2, 0 -_0809EF38: .4byte gUnknown_81165D4 -_0809EF3C: .4byte gGroundConversion_811BAF4 -_0809EF40: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r4, r0, 16 - movs r5, 0x1 - negs r5, r5 - cmp r4, r5 - bne _0809EF5A - movs r0, 0 - movs r1, 0x13 - bl sub_8001658 - lsls r0, 16 - asrs r4, r0, 16 -_0809EF5A: - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809EF70 - ldr r1, _0809EF90 - movs r0, 0x1 - adds r2, r4, 0 - bl Log -_0809EF70: - cmp r4, r5 - beq _0809EF94 - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - adds r0, r4, 0 - bl GroundMainRescueRequest - mov r0, r9 - movs r1, 0x1 - bl sub_80A2460 - mov r3, r9 - str r0, [r3, 0x28] - b _0809EAE0 - .align 2, 0 -_0809EF90: .4byte gUnknown_81165F4 -_0809EF94: - mov r0, r9 - movs r1, 0 - bl sub_80A2460 - mov r4, r9 - str r0, [r4, 0x28] - b _0809EAE0 -_0809EFA2: - ldr r0, [sp, 0xC] - bl sub_8021700 - lsls r0, 24 - cmp r0, 0 - beq _0809EFBE - movs r1, 0x1 - negs r1, r1 - mov r0, r9 - bl sub_80A2460 - mov r5, r9 - str r0, [r5, 0x28] - b _0809EAE0 -_0809EFBE: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - bl sub_8098D80 - mov r0, r9 - movs r1, 0 - bl sub_80A2460 - mov r2, r9 - str r0, [r2, 0x28] - b _0809EAE0 -_0809EFD6: - ldr r1, [sp, 0xC] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _0809F00C - bl sub_802FCF0 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _0809F0BC - movs r0, 0xC - movs r1, 0 - movs r2, 0 - bl sub_809B1C0 - lsls r0, 24 - cmp r0, 0 - beq _0809F0BC - movs r0, 0 - movs r1, 0xB - bl sub_80A87AC - mov r0, r9 - adds r0, 0x4C - strh r4, [r0] - b _0809F0C4 -_0809F00C: - lsls r0, r1, 16 - asrs r0, 16 - bl sub_80A26B8 - adds r2, r0, 0 - lsls r2, 16 - asrs r2, 16 - movs r0, 0 - movs r1, 0x12 - bl sub_80018D8 - mov r1, r9 - adds r1, 0x4C - movs r0, 0x1 - b _0809F0C2 -_0809F02A: - ldr r2, [sp, 0xC] - movs r0, 0x1 - negs r0, r0 - cmp r2, r0 - bne _0809F054 - movs r0, 0x24 - movs r1, 0 - movs r2, 0 - bl sub_809B1C0 - lsls r0, 24 - cmp r0, 0 - beq _0809F0BC - movs r0, 0 - movs r1, 0xB - bl sub_80A87AC - mov r1, r9 - adds r1, 0x4C - movs r0, 0 - b _0809F0C2 -_0809F054: - movs r0, 0 - movs r1, 0x13 - bl sub_80018D8 - mov r1, r9 - adds r1, 0x4C - movs r0, 0x1 - b _0809F0C2 -_0809F064: - mov r1, r9 - adds r1, 0x4C - movs r0, 0x1 - b _0809F0C2 -_0809F06C: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r4, r0, 16 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - bne _0809F088 - movs r0, 0 - movs r1, 0x13 - bl sub_8001658 - lsls r0, 16 - asrs r4, r0, 16 - b _0809F092 -_0809F088: - movs r0, 0 - movs r1, 0x13 - adds r2, r4, 0 - bl sub_80018D8 -_0809F092: - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809F0A8 - ldr r1, _0809F0B8 - movs r0, 0x1 - adds r2, r4, 0 - bl Log -_0809F0A8: - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _0809F0BC - mov r1, r9 - adds r1, 0x4C - movs r0, 0x1 - b _0809F0C2 - .align 2, 0 -_0809F0B8: .4byte gUnknown_811660C -_0809F0BC: - mov r1, r9 - adds r1, 0x4C - ldr r0, _0809F0CC -_0809F0C2: - strh r0, [r1] -_0809F0C4: - movs r0, 0x2 - bl _080A142E - .align 2, 0 -_0809F0CC: .4byte 0x0000ffff -_0809F0D0: - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x8 - bne _0809F130 - ldr r5, _0809F11C - ldr r0, [sp, 0xC] - strh r0, [r5] - lsls r0, 16 - asrs r0, 16 - bl sub_80A4D7C - ldr r4, _0809F120 - strh r0, [r4] - ldr r1, _0809F124 - strh r0, [r1] - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809F16A - ldr r1, _0809F128 - movs r3, 0 - ldrsh r2, [r5, r3] - movs r5, 0 - ldrsh r3, [r4, r5] - ldr r4, _0809F12C - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, 0x8 - adds r0, r4 - ldr r0, [r0] - str r0, [sp] - movs r0, 0x1 - bl Log - b _0809F16A - .align 2, 0 -_0809F11C: .4byte gCurrentMap -_0809F120: .4byte gUnknown_2039A32 -_0809F124: .4byte gUnknown_2039A34 -_0809F128: .4byte gUnknown_8116628 -_0809F12C: .4byte gGroundConversion_811BAF4 -_0809F130: - ldr r5, _0809F1E8 - ldr r4, _0809F1EC - ldr r1, [sp, 0xC] - strh r1, [r4] - strh r1, [r5] - ldr r0, _0809F1F0 - strh r1, [r0] - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809F16A - ldr r1, _0809F1F4 - movs r0, 0 - ldrsh r2, [r4, r0] - movs r4, 0 - ldrsh r3, [r5, r4] - ldr r4, _0809F1F8 - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, 0x8 - adds r0, r4 - ldr r0, [r0] - str r0, [sp] - movs r0, 0x1 - bl Log -_0809F16A: - ldr r5, _0809F1EC - movs r0, 0 - ldrsh r2, [r5, r0] - movs r0, 0 - movs r1, 0x10 - bl sub_80018D8 - ldr r6, _0809F1F8 - movs r2, 0 - ldrsh r1, [r5, r2] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r3, 0x2 - ldrsh r2, [r0, r3] - movs r0, 0 - movs r1, 0x11 - bl sub_80018D8 - ldr r4, _0809F1E8 - movs r1, 0 - ldrsh r0, [r4, r1] - bl GroundSprite_Reset - bl sub_809D0BC - bl DeleteBlankGroundEvents - bl DeleteBlankGroundLives - bl DeleteBlankGroundObjects - bl DeleteBlankGroundEffects - movs r2, 0 - ldrsh r0, [r5, r2] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - movs r3, 0x2 - ldrsh r1, [r1, r3] - bl sub_809C770 - movs r5, 0 - ldrsh r0, [r4, r5] - bl GroundMap_Select - movs r1, 0 - ldrsh r0, [r4, r1] - bl GroundLink_Select - movs r2, 0 - ldrsh r0, [r4, r2] - movs r1, 0 - movs r2, 0 - bl GroundLives_Select - movs r3, 0 - ldrsh r0, [r4, r3] - b _0809F2A0 - .align 2, 0 -_0809F1E8: .4byte gUnknown_2039A32 -_0809F1EC: .4byte gCurrentMap -_0809F1F0: .4byte gUnknown_2039A34 -_0809F1F4: .4byte gUnknown_8116644 -_0809F1F8: .4byte gGroundConversion_811BAF4 -_0809F1FC: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A2608 - adds r6, r0, 0 - ldr r1, _0809F2AC - ldr r5, _0809F2B0 - ldr r4, _0809F2B4 - ldr r0, [sp, 0x10] - strh r0, [r4] - strh r0, [r5] - strh r0, [r1] - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809F242 - ldr r1, _0809F2B8 - movs r0, 0 - ldrsh r2, [r4, r0] - movs r4, 0 - ldrsh r3, [r5, r4] - ldr r4, _0809F2BC - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r4, 0x8 - adds r0, r4 - ldr r0, [r0] - str r0, [sp] - movs r0, 0x1 - bl Log -_0809F242: - movs r1, 0 - ldrsh r0, [r5, r1] - bl GroundSprite_Reset - bl sub_809D0BC - bl DeleteBlankGroundEvents - bl DeleteBlankGroundLives - bl DeleteBlankGroundObjects - bl DeleteBlankGroundEffects - ldrb r2, [r6, 0xC] - ldr r1, _0809F2C0 - ldr r0, [sp, 0x58] - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0x58] - add r1, sp, 0x8 - ldrh r2, [r1, 0x2] - lsls r2, 24 - lsrs r2, 16 - ldr r1, _0809F2C4 - ands r0, r1 - orrs r0, r2 - str r0, [sp, 0x58] - movs r2, 0 - ldrsh r0, [r5, r2] - add r1, sp, 0x58 - add r2, sp, 0x8 - ldrb r2, [r2, 0x1] - bl GroundMap_SelectDungeon - movs r3, 0 - ldrsh r0, [r5, r3] - bl GroundLink_Select - movs r4, 0 - ldrsh r0, [r5, r4] - movs r1, 0 - movs r2, 0 - bl GroundLives_Select - movs r1, 0 - ldrsh r0, [r5, r1] -_0809F2A0: - movs r1, 0 - movs r2, 0 - bl GroundObject_Select - b _0809EAE0 - .align 2, 0 -_0809F2AC: .4byte gUnknown_2039A34 -_0809F2B0: .4byte gUnknown_2039A32 -_0809F2B4: .4byte gCurrentMap -_0809F2B8: .4byte gUnknown_8116664 -_0809F2BC: .4byte gGroundConversion_811BAF4 -_0809F2C0: .4byte 0xffffff00 -_0809F2C4: .4byte 0xffff00ff -_0809F2C8: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl GroundWeather_Select - bl _0809EAE0 -_0809F2D6: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - blt _0809F2E8 - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - b _0809F2EE -_0809F2E8: - mov r3, r10 - movs r4, 0xC - ldrsh r0, [r3, r4] -_0809F2EE: - adds r6, r0, 0 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - cmp r0, 0 - blt _0809F302 - add r0, sp, 0x8 - movs r1, 0x1 - ldrsb r1, [r0, r1] - b _0809F308 -_0809F302: - mov r5, r10 - movs r1, 0xE - ldrsb r1, [r5, r1] -_0809F308: - adds r5, r1, 0 - add r0, sp, 0x8 - ldrb r0, [r0] - subs r0, 0xC - cmp r0, 0x9 - bls _0809F318 - bl _0809EAE0 -_0809F318: - lsls r0, 2 - ldr r1, _0809F324 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0809F324: .4byte _0809F328 - .align 2, 0 -_0809F328: - .4byte _0809F350 - .4byte _0809F380 - .4byte _0809F398 - .4byte _0809F3B0 - .4byte _0809F3C8 - .4byte _0809F3E0 - .4byte _0809F3FA - .4byte _0809F406 - .4byte _0809F412 - .4byte _0809F41E -_0809F350: - ldr r4, _0809F37C - movs r1, 0 - ldrsh r0, [r4, r1] - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundLives_Select - movs r2, 0 - ldrsh r0, [r4, r2] - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundObject_Select - movs r3, 0 - ldrsh r0, [r4, r3] - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundEffect_Select - movs r1, 0 - ldrsh r0, [r4, r1] - b _0809F3CE - .align 2, 0 -_0809F37C: .4byte gUnknown_2039A32 -_0809F380: - ldr r0, _0809F394 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundLives_Select - bl _0809EAE0 - .align 2, 0 -_0809F394: .4byte gUnknown_2039A32 -_0809F398: - ldr r0, _0809F3AC - movs r3, 0 - ldrsh r0, [r0, r3] - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundObject_Select - bl _0809EAE0 - .align 2, 0 -_0809F3AC: .4byte gUnknown_2039A32 -_0809F3B0: - ldr r0, _0809F3C4 - movs r4, 0 - ldrsh r0, [r0, r4] - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundEffect_Select - bl _0809EAE0 - .align 2, 0 -_0809F3C4: .4byte gUnknown_2039A32 -_0809F3C8: - ldr r0, _0809F3DC - movs r1, 0 - ldrsh r0, [r0, r1] -_0809F3CE: - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundEvent_Select - bl _0809EAE0 - .align 2, 0 -_0809F3DC: .4byte gUnknown_2039A32 -_0809F3E0: - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundLives_Cancel - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundObject_Cancel - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundEffect_Cancel - b _0809F41E -_0809F3FA: - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundLives_Cancel - bl _0809EAE0 -_0809F406: - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundObject_Cancel - bl _0809EAE0 -_0809F412: - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundEffect_Cancel - bl _0809EAE0 -_0809F41E: - adds r0, r6, 0 - adds r1, r5, 0 - bl GroundEvent_Cancel - bl _0809EAE0 -_0809F42A: - bl GroundLives_CancelBlank_1 - bl _0809EAE0 -_0809F432: - bl GroundObject_CancelBlank - bl _0809EAE0 -_0809F43A: - bl GroundEffect_CancelBlank - bl _0809EAE0 -_0809F442: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - add r4, sp, 0x18 - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - add r6, sp, 0x1C - ldr r0, [sp, 0x10] - add r5, sp, 0x34 - movs r2, 0 - strb r0, [r5] - ldrb r1, [r4] - mov r0, sp - adds r0, 0x35 - strb r1, [r0] - adds r0, 0x1 - movs r1, 0x1 - strb r1, [r0] - adds r0, 0x1 - strb r1, [r0] - str r2, [sp, 0x38] - add r4, sp, 0x3C - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x10 - bl memset - ldr r2, _0809F4AC - ldr r1, [sp, 0xC] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, 0x8 - adds r0, r2 - ldr r0, [r0] - str r0, [r4, 0xC] - adds r0, r6, 0 - adds r1, r5, 0 - movs r2, 0x18 - bl memcpy - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - adds r1, r6, 0 - cmp r0, 0 - blt _0809F4B0 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - b _0809F4B6 - .align 2, 0 -_0809F4AC: .4byte gFunctionScriptTable -_0809F4B0: - mov r4, r10 - movs r5, 0xC - ldrsh r2, [r4, r5] -_0809F4B6: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - cmp r0, 0 - blt _0809F4C8 - add r0, sp, 0x8 - movs r3, 0x1 - ldrsb r3, [r0, r3] - b _0809F4CE -_0809F4C8: - mov r0, r10 - movs r3, 0xE - ldrsb r3, [r0, r3] -_0809F4CE: - movs r0, 0x1 - negs r0, r0 - bl GroundObject_Add - lsls r0, 16 - asrs r5, r0, 16 - cmp r5, 0 - bge _0809F4E2 - bl _0809EAE0 -_0809F4E2: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - add r4, sp, 0x5C - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80AC49C - bl _0809EAE0 -_0809F4FE: - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - add r4, sp, 0x4C - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - add r5, sp, 0x1C - ldr r0, [sp, 0x10] - add r1, sp, 0x28 - movs r3, 0 - strb r0, [r1] - ldrb r2, [r4] - mov r0, sp - adds r0, 0x29 - strb r2, [r0] - adds r0, 0x1 - movs r2, 0x1 - strb r2, [r0] - adds r0, 0x1 - strb r2, [r0] - str r3, [sp, 0x2C] - ldr r3, _0809F55C - ldr r2, [sp, 0xC] - lsls r0, r2, 1 - adds r0, r2 - lsls r0, 2 - adds r3, 0x8 - adds r0, r3 - ldr r0, [r0] - str r0, [sp, 0x30] - adds r0, r5, 0 - movs r2, 0xC - bl memcpy - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - adds r1, r5, 0 - cmp r0, 0 - blt _0809F560 - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - b _0809F566 - .align 2, 0 -_0809F55C: .4byte gFunctionScriptTable -_0809F560: - mov r5, r10 - movs r0, 0xC - ldrsh r2, [r5, r0] -_0809F566: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - cmp r0, 0 - blt _0809F578 - add r0, sp, 0x8 - movs r3, 0x1 - ldrsb r3, [r0, r3] - b _0809F57E -_0809F578: - mov r4, r10 - movs r3, 0xE - ldrsb r3, [r4, r3] -_0809F57E: - movs r0, 0x1 - negs r0, r0 - bl GroundEffect_Add - lsls r0, 16 - asrs r5, r0, 16 - cmp r5, 0 - bge _0809F592 - bl _0809EAE0 -_0809F592: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - add r4, sp, 0x64 - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_80AD3B4 - bl _0809EAE0 -_0809F5AE: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - movs r1, 0x1 - bl GroundMap_ExecuteEvent - bl _0809EAE0 -_0809F5BE: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - b _0809F712 -_0809F5C6: - ldr r1, [sp, 0xC] - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0809F5D6 - lsls r0, r1, 16 - asrs r0, 16 - b _0809F5DC -_0809F5D6: - ldr r0, _0809F5F0 - movs r3, 0 - ldrsh r0, [r0, r3] -_0809F5DC: - adds r4, r0, 0 - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - blt _0809F5F4 - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r0, r5] - b _0809F5FA - .align 2, 0 -_0809F5F0: .4byte gCurrentMap -_0809F5F4: - mov r0, r10 - movs r2, 0xC - ldrsh r1, [r0, r2] -_0809F5FA: - adds r6, r1, 0 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - cmp r0, 0 - blt _0809F60E - add r0, sp, 0x8 - movs r5, 0x1 - ldrsb r5, [r0, r5] - b _0809F614 -_0809F60E: - mov r3, r10 - movs r5, 0xE - ldrsb r5, [r3, r5] -_0809F614: - adds r0, r4, 0 - bl sub_80A4D7C - lsls r0, 16 - asrs r4, r0, 16 - movs r3, 0 - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x1E - bne _0809F62A - movs r3, 0x1 -_0809F62A: - adds r0, r4, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl GroundMap_ExecuteStation - ldr r1, _0809F65C - movs r5, 0 - ldrsh r0, [r1, r5] - cmp r0, r4 - bne _0809F642 - bl _0809EAE0 -_0809F642: - strh r4, [r1] - bl sub_809D940 - mov r1, r9 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _0809F656 - bl _0809EAE0 -_0809F656: - bl _080A142C - .align 2, 0 -_0809F65C: .4byte gUnknown_2039A34 -_0809F660: - movs r0, 0 - movs r1, 0x13 - bl sub_8001658 - lsls r0, 16 - asrs r4, r0, 16 - adds r0, r4, 0 - bl sub_80A2608 - adds r5, r0, 0 - lsls r2, r4, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x30 - bl sub_8001784 - cmp r0, 0 - bne _0809F68A - movs r3, 0x6 - ldrsh r5, [r5, r3] - b _0809F68E -_0809F68A: - movs r0, 0x8 - ldrsh r5, [r5, r0] -_0809F68E: - adds r0, r4, 0 - subs r0, 0x37 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x10 - bls _0809F6DC - adds r0, r4, 0 - bl sub_80A2750 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _0809F6DC - movs r0, 0x1 - negs r0, r0 - cmp r5, r0 - bne _0809F6D8 - movs r0, 0x1 - bl ScriptLoggingEnabled - lsls r0, 24 - cmp r0, 0 - beq _0809F6C6 - ldr r1, _0809F6D4 - movs r0, 0x1 - adds r2, r4, 0 - bl Log -_0809F6C6: - adds r0, r4, 0 - adds r1, r5, 0 - bl GroundMainRescueRequest - bl _0809EAE0 - .align 2, 0 -_0809F6D4: .4byte gUnknown_8116684 -_0809F6D8: - adds r0, r5, 0 - b _0809F712 -_0809F6DC: - movs r1, 0x1 - negs r1, r1 - adds r0, r4, 0 - bl GroundMainRescueRequest - bl _0809EAE0 -_0809F6EA: - mov r1, r9 - movs r2, 0xC - ldrsh r0, [r1, r2] - cmp r0, 0x1 - beq _0809F71C - cmp r0, 0x1 - bgt _0809F700 - cmp r0, 0 - beq _0809F70C - bl _0809EAE0 -_0809F700: - cmp r0, 0x2 - beq _0809F73E - cmp r0, 0x3 - beq _0809F762 - bl _0809EAE0 -_0809F70C: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] -_0809F712: - movs r1, 0 - bl GroundMap_ExecuteEvent - bl _0809EAE0 -_0809F71C: - add r4, sp, 0x1C - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - mov r0, r9 - adds r1, r4, 0 - bl sub_809D710 - mov r1, r9 - movs r2, 0xE - ldrsh r0, [r1, r2] - adds r1, 0x8 - adds r2, r4, 0 - bl GroundLives_ExecuteScript - bl _0809EAE0 -_0809F73E: - add r4, sp, 0x28 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - mov r0, r9 - adds r1, r4, 0 - bl sub_809D710 - mov r5, r9 - movs r1, 0xE - ldrsh r0, [r5, r1] - mov r1, r9 - adds r1, 0x8 - adds r2, r4, 0 - bl GroundObject_ExecuteScript - bl _0809EAE0 -_0809F762: - add r4, sp, 0x34 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - mov r0, r9 - adds r1, r4, 0 - bl sub_809D710 - mov r5, r9 - movs r1, 0xE - ldrsh r0, [r5, r1] - mov r1, r9 - adds r1, 0x8 - adds r2, r4, 0 - bl GroundEffect_ExecuteScript - bl _0809EAE0 -_0809F786: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r0, 16 - mov r8, r0 - cmp r0, 0 - bge _0809F79E - bl _0809EAE0 -_0809F79E: - add r1, sp, 0x6C - bl sub_80A8BD8 - ldr r0, [sp, 0x6C] - movs r1, 0x80 - lsls r1, 2 - ands r0, r1 - cmp r0, 0 - beq _0809F818 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - add r7, sp, 0x70 - ldr r2, [r1, 0xC] - adds r1, r7, 0 - bl _call_via_r2 - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - add r5, sp, 0x78 - ldr r2, [r1, 0x8] - adds r1, r5, 0 - bl _call_via_r2 - add r6, sp, 0x80 - mov r0, r8 - adds r1, r6, 0 - bl sub_80A8FD8 - add r4, sp, 0x88 - mov r0, r8 - adds r1, r4, 0 - bl sub_80A8F9C - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r7, 0 - adds r3, r5, 0 - bl sub_8002DF0 - lsls r0, 24 - asrs r1, r0, 24 - adds r4, r1, 0 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _0809F812 - ldr r3, _0809F82C - adds r0, r7, 0 - adds r1, r3, 0 - adds r2, r6, 0 - bl sub_8002D54 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, r4 - beq _0809F818 -_0809F812: - mov r0, r8 - bl sub_80A9090 -_0809F818: - mov r4, r9 - movs r5, 0xA - ldrsh r0, [r4, r5] - mov r1, r8 - bl GroundLives_ExecutePlayerScriptActionLives - movs r0, 0x3 - bl _080A142E - .align 2, 0 -_0809F82C: .4byte gUnknown_81164DC -_0809F830: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - bl sub_80999E8 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A130C -_0809F842: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - bl sub_80999FC - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A130C -_0809F854: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - ldr r1, [sp, 0xC] - lsls r1, 16 - lsrs r1, 16 - ldr r2, [sp, 0x10] - lsls r2, 16 - lsrs r2, 16 - bl sub_8099A10 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A130C -_0809F872: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - bl sub_8099A34 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A130C -_0809F884: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - bl sub_8099A48 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A130C -_0809F896: - ldr r0, [sp, 0x10] - asrs r0, 16 - add r1, sp, 0x20 - movs r2, 0 - strb r0, [r1] - ldr r0, [sp, 0x10] - asrs r0, 8 - adds r1, 0x1 - strb r0, [r1] - ldr r1, [sp, 0x10] - mov r0, sp - adds r0, 0x22 - strb r1, [r0] - adds r0, 0x1 - strb r2, [r0] - ldr r2, [sp, 0x20] - str r2, [sp, 0x1C] - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x27 - beq _0809F8C6 - cmp r0, 0x28 - beq _0809F8D4 - b _0809F8E0 -_0809F8C6: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [sp, 0xC] - bl sub_8099A5C - b _0809F8E0 -_0809F8D4: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - ldr r1, [sp, 0xC] - bl sub_8099AFC -_0809F8E0: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A130C -_0809F8E8: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - bl sub_809A6E4 - bl _0809EAE0 -_0809F8F4: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - bl sub_809A6F8 - bl _0809EAE0 -_0809F900: - ldr r0, [sp, 0xC] - ldr r1, [sp, 0x10] - bl sub_809A738 - bl _0809EAE0 -_0809F90C: - bl sub_809A768 - lsls r0, 24 - cmp r0, 0 - bne _0809F91A - bl _0809EAE0 -_0809F91A: - movs r0, 0 - movs r1, 0xA - bl sub_80A87AC - mov r0, r9 - movs r1, 0 - bl sub_809D8EC - bl _080A130A -_0809F92E: - bl ScriptPrintNullTextbox - bl _0809EAE0 -_0809F936: - bl ScriptPrintEmptyTextbox - bl _0809EAE0 -_0809F93E: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - cmp r0, 0xA - bls _0809F94A - bl _0809EAE0 -_0809F94A: - lsls r0, 2 - ldr r1, _0809F954 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0809F954: .4byte _0809F958 - .align 2, 0 -_0809F958: - .4byte _0809F984 - .4byte _0809F992 - .4byte _0809F9A4 - .4byte _0809F9B6 - .4byte _0809F9D8 - .4byte _0809F9EA - .4byte _0809F9FC - .4byte _0809FA44 - .4byte _0809FA56 - .4byte _0809FA68 - .4byte _0809FAB0 -_0809F984: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - bl sub_809A83C - bl _0809EAE0 -_0809F992: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - mov r1, r9 - adds r1, 0x8 - bl sub_80A2500 - bl _0809EAE0 -_0809F9A4: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - mov r1, r9 - adds r1, 0xC - bl sub_80A2500 - bl _0809EAE0 -_0809F9B6: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - add r1, sp, 0x90 - lsls r0, 16 - movs r2, 0x1 - orrs r0, r2 - str r0, [r1] - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - bl sub_80A2500 - bl _0809EAE0 -_0809F9D8: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - mov r1, r9 - adds r1, 0x8 - bl sub_80A252C - bl _0809EAE0 -_0809F9EA: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - mov r1, r9 - adds r1, 0xC - bl sub_80A252C - bl _0809EAE0 -_0809F9FC: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - add r1, sp, 0x94 - ldrh r2, [r1] - orrs r2, r0 - str r2, [r1] - cmp r2, 0 - blt _0809FA30 - ldr r0, _0809FA2C - ands r2, r0 - movs r0, 0x1 - orrs r2, r0 - str r2, [r1] - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - bl sub_80A252C - bl _0809EAE0 - .align 2, 0 -_0809FA2C: .4byte 0xffff0000 -_0809FA30: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - bl sub_80A2584 - bl _0809EAE0 -_0809FA44: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - mov r1, r9 - adds r1, 0x8 - bl sub_80A2558 - bl _0809EAE0 -_0809FA56: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - mov r1, r9 - adds r1, 0xC - bl sub_80A2558 - bl _0809EAE0 -_0809FA68: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - add r1, sp, 0x98 - ldrh r2, [r1] - orrs r2, r0 - str r2, [r1] - cmp r2, 0 - blt _0809FA9C - ldr r0, _0809FA98 - ands r2, r0 - movs r0, 0x1 - orrs r2, r0 - str r2, [r1] - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - bl sub_80A2558 - bl _0809EAE0 - .align 2, 0 -_0809FA98: .4byte 0xffff0000 -_0809FA9C: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - bl sub_80A2598 - bl _0809EAE0 -_0809FAB0: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A2740 - lsls r0, 24 - lsrs r1, r0, 24 - movs r4, 0 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - beq _0809FAD0 - cmp r0, 0x2 - beq _0809FAD4 - b _0809FAD8 -_0809FAD0: - movs r4, 0x1 - b _0809FAD8 -_0809FAD4: - movs r4, 0x1 - negs r4, r4 -_0809FAD8: - adds r0, r1, 0 - bl GetDungeonFloorCount - ldr r2, _0809FAF4 - add r1, sp, 0x8 - movs r3, 0x2 - ldrsh r1, [r1, r3] - lsls r1, 2 - adds r1, r2 - adds r0, r4 - str r0, [r1] - bl _0809EAE0 - .align 2, 0 -_0809FAF4: .4byte gFormatData_202DE30 -_0809FAF8: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - ldr r1, [sp, 0xC] - lsls r1, 24 - asrs r1, 24 - add r2, sp, 0x8 - ldrb r2, [r2, 0x1] - bl sub_809AC7C - bl _0809EAE0 -_0809FB10: - ldr r0, [sp, 0xC] - add r1, sp, 0x9C - str r0, [r1] - ldr r0, [sp, 0x10] - str r0, [r1, 0x4] - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - bl sub_809ADD8 - bl _0809EAE0 -_0809FB28: - movs r1, 0 - ldrb r0, [r2] - subs r0, 0x32 - cmp r0, 0x6 - bhi _0809FBBE - lsls r0, 2 - ldr r1, _0809FB3C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0809FB3C: .4byte _0809FB40 - .align 2, 0 -_0809FB40: - .4byte _0809FB5C - .4byte _0809FB6C - .4byte _0809FB7C - .4byte _0809FB8C - .4byte _0809FB9C - .4byte _0809FBAC - .4byte _0809FBB4 -_0809FB5C: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - ldr r2, [sp, 0x14] - movs r0, 0 - bl ScriptPrintText - b _0809FBBA -_0809FB6C: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r1, [r0, r3] - ldr r2, [sp, 0x14] - movs r0, 0x1 - bl ScriptPrintText - b _0809FBBA -_0809FB7C: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r0, r4] - ldr r2, [sp, 0x14] - movs r0, 0x2 - bl ScriptPrintText - b _0809FBBA -_0809FB8C: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r0, r5] - ldr r2, [sp, 0x14] - movs r0, 0x3 - bl ScriptPrintText - b _0809FBBA -_0809FB9C: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - ldr r2, [sp, 0x14] - movs r0, 0x4 - bl ScriptPrintText - b _0809FBBA -_0809FBAC: - ldr r0, [sp, 0x14] - bl sub_809AEEC - b _0809FBBA -_0809FBB4: - ldr r0, [sp, 0x14] - bl sub_809AF2C -_0809FBBA: - lsls r0, 24 - lsrs r1, r0, 24 -_0809FBBE: - cmp r1, 0 - bne _0809FBC6 - bl _0809EAE0 -_0809FBC6: - movs r0, 0 - movs r1, 0xA - bl sub_80A87AC - mov r0, r9 - movs r1, 0 - bl sub_809D8EC - bl _080A130A -_0809FBDA: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - ldr r1, [sp, 0x14] - bl sub_809AF6C - lsls r0, 24 - cmp r0, 0 - bne _0809FBF0 - bl _0809EAE0 -_0809FBF0: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - bge _0809FBFE - bl _0809EAE0 -_0809FBFE: - movs r0, 0 - movs r1, 0xA - bl sub_80A87AC - mov r0, r9 - movs r1, 0 - bl sub_809D8EC - bl _080A130A -_0809FC12: - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - lsls r2, 16 - asrs r2, 16 - ldr r3, [sp, 0x14] - bl sub_809AFC8 - bl _080A1280 -_0809FC2E: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - ldr r3, [sp, 0x14] - bl sub_809B1D4 - bl _080A1292 -_0809FC40: - movs r0, 0 - bl _080A0654 -_0809FC46: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r1, r0, 16 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0809FC90 - adds r0, r1, 0 - bl sub_80A8D54 - cmp r0, 0 - bne _0809FC62 - bl _0809EAE0 -_0809FC62: - movs r3, 0 - ldr r2, _0809FC8C - adds r5, r2, 0 - adds r4, r0, 0 - adds r4, 0x4C -_0809FC6C: - adds r0, r3, r5 - adds r1, r4, r3 - ldrb r1, [r1] - strb r1, [r0] - adds r3, 0x1 - cmp r3, 0x9 - ble _0809FC6C - movs r0, 0 - strb r0, [r2, 0xA] - movs r0, 0x4 - movs r1, 0 - bl sub_809B1C0 - bl _080A1292 - .align 2, 0 -_0809FC8C: .4byte gUnknown_2039D98 -_0809FC90: - ldr r2, _0809FCA0 - movs r0, 0x4 - movs r1, 0x1 - bl sub_809B1C0 - bl _080A1292 - .align 2, 0 -_0809FCA0: .4byte gUnknown_2039D98 -_0809FCA4: - ldr r4, _0809FCC0 - adds r0, r4, 0 - bl sub_80920B8 - movs r0, 0 - strb r0, [r4, 0xA] - movs r0, 0x5 - movs r1, 0 - adds r2, r4, 0 - bl sub_809B1C0 - bl _080A1292 - .align 2, 0 -_0809FCC0: .4byte gUnknown_2039D98 -_0809FCC4: - ldr r2, _0809FCE4 - adds r3, r2, 0 - movs r1, 0 - adds r0, r2, 0 - adds r0, 0xB -_0809FCCE: - strb r1, [r0] - subs r0, 0x1 - cmp r0, r3 - bge _0809FCCE - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] - movs r0, 0x6 - bl sub_809B1C0 - bl _080A1292 - .align 2, 0 -_0809FCE4: .4byte gUnknown_2039D98 -_0809FCE8: - bl StopAllMusic_1 - bl _0809EAE0 -_0809FCF0: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - blt _0809FD00 - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - b _0809FD02 -_0809FD00: - movs r0, 0x1E -_0809FD02: - bl FadeOutAllMusic - bl _0809EAE0 -_0809FD0A: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - cmp r0, 0 - bne _0809FD1E - ldr r0, [sp, 0xC] - lsls r0, 16 - lsrs r0, 16 - bl sub_80A25AC - b _0809FD20 -_0809FD1E: - ldr r0, [sp, 0xC] -_0809FD20: - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, _0809FD34 - cmp r1, r0 - beq _0809FDA0 - adds r0, r1, 0 - bl xxx_call_start_new_bgm - bl _0809EAE0 - .align 2, 0 -_0809FD34: .4byte 0x000003e7 -_0809FD38: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - cmp r0, 0 - bne _0809FD4C - ldr r0, [sp, 0xC] - lsls r0, 16 - lsrs r0, 16 - bl sub_80A25AC - b _0809FD4E -_0809FD4C: - ldr r0, [sp, 0xC] -_0809FD4E: - lsls r0, 16 - lsrs r2, r0, 16 - ldr r0, _0809FD68 - cmp r2, r0 - beq _0809FDA0 - add r0, sp, 0x8 - ldrh r1, [r0, 0x2] - adds r0, r2, 0 - bl xxx_call_fade_in_new_bgm - bl _0809EAE0 - .align 2, 0 -_0809FD68: .4byte 0x000003e7 -_0809FD6C: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - cmp r0, 0 - bne _0809FD80 - ldr r0, [sp, 0xC] - lsls r0, 16 - lsrs r0, 16 - bl sub_80A25AC - b _0809FD82 -_0809FD80: - ldr r0, [sp, 0xC] -_0809FD82: - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, _0809FD9C - cmp r1, r0 - bne _0809FD90 - bl _0809EAE0 -_0809FD90: - adds r0, r1, 0 - bl xxx_call_queue_bgm - bl _0809EAE0 - .align 2, 0 -_0809FD9C: .4byte 0x000003e7 -_0809FDA0: - bl xxx_call_stop_bgm - bl _0809EAE0 -_0809FDA8: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - blt _0809FDB8 - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - b _0809FDBA -_0809FDB8: - movs r0, 0x1E -_0809FDBA: - bl xxx_call_fade_out_bgm - bl _0809EAE0 -_0809FDC2: - ldr r0, [sp, 0xC] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x80 - lsls r1, 1 - bl xxx_call_play_fanfare_se - bl _0809EAE0 -_0809FDD4: - ldr r0, [sp, 0xC] - lsls r0, 16 - lsrs r0, 16 - bl xxx_call_stop_fanfare_se - bl _0809EAE0 -_0809FDE2: - ldr r0, [sp, 0xC] - lsls r0, 16 - lsrs r2, r0, 16 - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - blt _0809FDF8 - add r0, sp, 0x8 - ldrh r1, [r0, 0x2] - b _0809FDFA -_0809FDF8: - movs r1, 0x1E -_0809FDFA: - adds r0, r2, 0 - bl xxx_call_fade_out_fanfare_se - bl _0809EAE0 -_0809FE04: - mov r1, r9 - adds r1, 0x84 - movs r5, 0 - ldrsh r0, [r1, r5] - cmp r0, 0x1 - bne _0809FE16 - adds r0, r1, 0 - bl InitScriptData -_0809FE16: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r2, [r1, 0x1C] - movs r1, 0 - bl _call_via_r2 - bl _0809EAE0 -_0809FE28: - mov r0, r9 - adds r0, 0xC - bl sub_809D52C - adds r4, r0, 0 - cmp r4, 0 - bne _0809FE3A - bl _0809EAE0 -_0809FE3A: - ldr r1, [r4] - mov r2, r9 - ldr r0, [r2, 0x4] - add r5, sp, 0xA4 - ldr r2, [r1, 0xC] - adds r1, r5, 0 - bl _call_via_r2 - ldr r1, [r4] - mov r3, r9 - ldr r0, [r3, 0x4] - mov r4, sp - adds r4, 0x4D - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r2, [r1, 0x24] - adds r1, r5, 0 - bl _call_via_r2 - ldrb r0, [r4] - mov r1, r9 - adds r1, 0x4A - strb r0, [r1] - mov r1, r9 - ldr r2, [r1] - ldr r0, [r1, 0x4] - movs r1, 0 - ldrsb r1, [r4, r1] - ldr r2, [r2, 0x2C] - bl _call_via_r2 - bl _0809EAE0 -_0809FE86: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - add r6, sp, 0xAC - ldr r2, [r1, 0xC] - adds r1, r6, 0 - bl _call_via_r2 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - add r4, sp, 0xB4 - add r5, sp, 0xBC - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_80AD914 - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r3, [r1, 0x20] - adds r1, r4, 0 - adds r2, r5, 0 - bl _call_via_r3 - bl _0809EAE0 -_0809FEBE: - mov r1, r9 - ldr r2, [r1] - ldr r0, [r1, 0x4] - ldr r1, [sp, 0xC] - ldr r2, [r2, 0x3C] - bl _call_via_r2 - bl _0809EAE0 -_0809FED0: - ldr r0, [sp, 0xC] - movs r1, 0x80 - lsls r1, 3 - ands r0, r1 - cmp r0, 0 - beq _0809FEEE - mov r1, r9 - adds r1, 0x84 - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0x1 - bne _0809FEEE - adds r0, r1, 0 - bl InitScriptData -_0809FEEE: - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - ldr r1, [sp, 0xC] - ldr r2, [r2, 0x40] - bl _call_via_r2 - bl _0809EAE0 -_0809FF00: - mov r4, r9 - ldr r2, [r4] - ldr r0, [r4, 0x4] - mov r1, r9 - adds r1, 0x4A - ldr r2, [r2, 0x14] - bl _call_via_r2 - add r0, sp, 0x8 - ldrh r1, [r0, 0x2] - cmp r1, 0 - beq _0809FF1E - mov r0, r9 - adds r0, 0x48 - strh r1, [r0] -_0809FF1E: - mov r5, r9 - ldr r2, [r5] - ldr r0, [r5, 0x4] - add r1, sp, 0x8 - ldrh r1, [r1, 0x2] - ldr r2, [r2, 0x30] - bl _call_via_r2 - bl _0809EAE0 -_0809FF32: - mov r0, r9 - ldr r2, [r0] - ldr r0, [r0, 0x4] - add r1, sp, 0x8 - ldrh r1, [r1, 0x2] - ldr r2, [r2, 0x34] - bl _call_via_r2 - bl _0809EAE0 -_0809FF46: - mov r1, r9 - ldr r3, [r1] - ldr r0, [r1, 0x4] - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - add r2, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r2, r4] - ldr r3, [r3, 0x38] - bl _call_via_r3 - bl _0809EAE0 -_0809FF62: - mov r5, r9 - ldr r2, [r5] - ldr r0, [r5, 0x4] - add r1, sp, 0x8 - movs r3, 0x2 - ldrsh r1, [r1, r3] - ldr r2, [r2, 0x44] - bl _call_via_r2 - bl _0809EAE0 -_0809FF78: - ldr r0, [sp, 0xC] - lsls r0, 8 - add r1, sp, 0xC4 - str r0, [r1] - ldr r0, [sp, 0x10] - lsls r0, 8 - str r0, [r1, 0x4] - mov r4, r9 - ldr r2, [r4] - ldr r0, [r4, 0x4] - ldr r2, [r2, 0x24] - bl _call_via_r2 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - mov r5, r10 - b _080A05EA -_0809FF9A: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - lsls r0, 8 - add r1, sp, 0xCC - str r0, [r1] - ldr r0, [sp, 0xC] - lsls r0, 8 - str r0, [r1, 0x4] - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - ldr r2, [r2, 0x48] - bl _call_via_r2 - b _080A0650 -_0809FFBA: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - bl OtherRandInt - lsls r0, 8 - add r4, sp, 0xD4 - str r0, [r4] - ldr r0, [sp, 0xC] - bl OtherRandInt - lsls r0, 8 - str r0, [r4, 0x4] - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r2, [r1, 0x48] - adds r1, r4, 0 - bl _call_via_r2 - b _080A07B4 -_0809FFE4: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - add r4, sp, 0xDC - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - adds r1, r4, 0 - bl sub_80AD8B4 - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - ldr r2, [r1, 0x24] - adds r1, r4, 0 - bl _call_via_r2 - b _080A0650 -_080A0010: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - add r6, sp, 0xE4 - ldr r2, [r1, 0xC] - adds r1, r6, 0 - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - add r4, sp, 0xEC - add r5, sp, 0xF4 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r6, 0 - bl sub_80AD914 - ldr r0, [r5] - ldr r1, [r4] - subs r0, r1 - bl OtherRandInt - ldr r1, [r4] - adds r1, r0 - str r1, [r6] - ldr r0, [r5, 0x4] - ldr r1, [r4, 0x4] - subs r0, r1 - bl OtherRandInt - ldr r1, [r4, 0x4] - adds r1, r0 - str r1, [r6, 0x4] - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r2, [r1, 0x24] - adds r1, r6, 0 - bl _call_via_r2 - b _080A07B4 -_080A0064: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _080A007A - bl _0809EAE0 -_080A007A: - add r4, sp, 0xFC - adds r1, r4, 0 - bl sub_80A8FD8 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - ldr r2, [r1, 0x24] - adds r1, r4, 0 - bl _call_via_r2 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - b _080A03F0 -_080A0096: - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x32 - bl sub_8001784 - add r5, sp, 0x104 - str r0, [r5] - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x33 - bl sub_8001784 - str r0, [r5, 0x4] - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x34 - bl sub_8001784 - adds r6, r0, 0 - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - movs r0, 0 - movs r1, 0x35 - bl sub_8001784 - adds r4, r0, 0 - lsls r4, 24 - asrs r4, 24 - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r2, [r1, 0x24] - adds r1, r5, 0 - bl _call_via_r2 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - ldr r2, [r1, 0x28] - adds r1, r6, 0 - bl _call_via_r2 - mov r0, r9 - adds r0, 0x4A - strb r4, [r0] - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - ldr r2, [r1, 0x2C] - adds r1, r4, 0 - bl _call_via_r2 - b _080A0650 -_080A010E: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - add r4, sp, 0x10C - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - ldr r3, [r5] - ldr r0, [r5, 0x4] - add r1, sp, 0x114 - add r2, sp, 0x118 - ldr r3, [r3, 0x10] - bl _call_via_r3 - ldr r1, [r5] - ldr r0, [r5, 0x4] - mov r5, sp - adds r5, 0x4E - ldr r2, [r1, 0x14] - adds r1, r5, 0 - bl _call_via_r2 - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - add r0, sp, 0x10C - ldr r3, [r0] - movs r0, 0 - movs r1, 0x32 - bl sub_800199C - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - ldr r3, [r4, 0x4] - movs r0, 0 - movs r1, 0x33 - bl sub_800199C - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - add r0, sp, 0x114 - ldr r3, [r0] - movs r0, 0 - movs r1, 0x34 - bl sub_800199C - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - movs r3, 0 - ldrsb r3, [r5, r3] - movs r0, 0 - movs r1, 0x35 - bl sub_800199C - bl _0809EAE0 -_080A0186: - mov r0, r9 - ldr r2, [r0] - ldr r0, [r0, 0x4] - ldr r1, [sp, 0xC] - lsls r1, 8 - ldr r2, [r2, 0x28] - bl _call_via_r2 - b _080A07B4 -_080A0198: - ldr r0, [sp, 0xC] - lsls r0, 8 - mov r2, r10 - str r0, [r2, 0x3C] - ldr r0, [sp, 0x10] - lsls r0, 8 - str r0, [r2, 0x40] - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - str r0, [r2, 0x30] - ldr r0, _080A01B4 - bl _080A12AE - .align 2, 0 -_080A01B4: .4byte 0x0000ffff -_080A01B8: - mov r4, r9 - ldr r1, [r4] - ldr r0, [r4, 0x4] - add r4, sp, 0x11C - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - ldr r1, [sp, 0xC] - lsls r1, 8 - add r0, sp, 0x11C - ldr r0, [r0] - adds r0, r1 - mov r5, r10 - str r0, [r5, 0x3C] - ldr r1, [sp, 0x10] - lsls r1, 8 - ldr r0, [r4, 0x4] - adds r0, r1 - str r0, [r5, 0x40] - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - str r0, [r5, 0x30] - ldr r0, _080A01EC - b _080A05EA - .align 2, 0 -_080A01EC: .4byte 0x0000ffff -_080A01F0: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - mov r4, r10 - adds r4, 0x3C - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - adds r1, r4, 0 - bl sub_80AD8B4 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - mov r4, r10 - str r0, [r4, 0x30] - ldr r0, _080A021C - b _080A0656 - .align 2, 0 -_080A021C: .4byte 0x0000ffff -_080A0220: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - mov r4, r10 - adds r4, 0x3C - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - adds r1, r4, 0 - bl sub_80AD8B4 - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - mov r2, r10 - str r0, [r2, 0x30] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A12AE -_080A0250: - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - mov r4, r10 - adds r4, 0x3C - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - adds r1, r4, 0 - bl sub_80AD8B4 - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - mov r5, r10 - str r0, [r5, 0x30] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl OtherRandInt - b _080A05EA -_080A0282: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - bge _080A0298 - bl _0809EAE0 -_080A0298: - mov r1, r10 - adds r1, 0x3C - bl sub_80A8FD8 - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - mov r2, r10 - str r0, [r2, 0x30] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - bl _080A12AE -_080A02B2: - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - mov r1, r10 - adds r1, 0x34 - ldr r2, [r2, 0xC] - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r1, r0, 8 - mov r4, r10 - str r1, [r4, 0x3C] - ldr r0, [sp, 0x10] - lsls r2, r0, 8 - str r2, [r4, 0x40] - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x7D - beq _080A02DC - cmp r0, 0x83 - bne _080A0304 -_080A02DC: - mov r5, r10 - ldr r0, [r5, 0x34] - subs r0, r1, r0 - ldr r1, [r5, 0x38] - subs r1, r2, r1 - bl sub_8009FB8 - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl __divsi3 - strh r0, [r5, 0x2A] - lsls r0, 16 - cmp r0, 0 - ble _080A0300 - bl _0809F0C4 -_080A0300: - movs r0, 0x1 - b _080A05EA -_080A0304: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - mov r3, r10 - strh r0, [r3, 0x2A] - bl _0809F0C4 -_080A0310: - mov r4, r9 - ldr r2, [r4] - ldr r0, [r4, 0x4] - mov r1, r10 - adds r1, 0x34 - ldr r2, [r2, 0xC] - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 8 - mov r5, r10 - ldr r4, [r5, 0x34] - adds r3, r4, r0 - str r3, [r5, 0x3C] - ldr r0, [sp, 0x10] - lsls r0, 8 - ldr r2, [r5, 0x38] - adds r1, r2, r0 - str r1, [r5, 0x40] - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x7E - beq _080A0342 - cmp r0, 0x84 - bne _080A036A -_080A0342: - subs r0, r3, r4 - subs r1, r2 - bl sub_8009FB8 - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl __divsi3 - mov r3, r10 - strh r0, [r3, 0x2A] - lsls r0, 16 - cmp r0, 0 - ble _080A0362 - bl _0809F0C4 -_080A0362: - movs r0, 0x1 - strh r0, [r3, 0x2A] - bl _0809F0C4 -_080A036A: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - b _080A0654 -_080A0370: - ldr r4, [sp, 0xC] - lsls r4, 1 - subs r4, 0x1 - ldr r5, [sp, 0x10] - lsls r5, 1 - subs r5, 0x1 - mov r0, r9 - ldr r2, [r0] - ldr r0, [r0, 0x4] - mov r1, r10 - adds r1, 0x34 - ldr r2, [r2, 0xC] - bl _call_via_r2 - adds r0, r4, 0 - bl OtherRandInt - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - subs r0, r1 - lsls r0, 8 - mov r3, r10 - ldr r1, [r3, 0x34] - adds r1, r0 - str r1, [r3, 0x3C] - adds r0, r5, 0 - bl OtherRandInt - ldr r1, [sp, 0xC] - subs r0, r1 - lsls r0, 8 - mov r4, r10 - ldr r3, [r4, 0x38] - adds r2, r3, r0 - str r2, [r4, 0x40] - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x7F - beq _080A03C4 - cmp r0, 0x85 - bne _080A03EC -_080A03C4: - mov r5, r10 - ldr r0, [r5, 0x3C] - ldr r1, [r5, 0x34] - subs r0, r1 - subs r1, r2, r3 - bl sub_8009FB8 - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl __divsi3 - strh r0, [r5, 0x2A] - lsls r0, 16 - cmp r0, 0 - ble _080A03E8 - bl _0809F0C4 -_080A03E8: - movs r0, 0x1 - b _080A05EA -_080A03EC: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] -_080A03F0: - mov r3, r10 - strh r0, [r3, 0x2A] - bl _0809F0C4 -_080A03F8: - mov r4, r9 - ldr r2, [r4] - ldr r0, [r4, 0x4] - mov r1, r10 - adds r1, 0x34 - ldr r2, [r2, 0xC] - bl _call_via_r2 - mov r5, r10 - ldr r0, [r5, 0x34] - ldr r1, [r5, 0x38] - mov r2, r10 - str r0, [r2, 0x3C] - str r1, [r2, 0x40] - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - mov r1, r10 - adds r1, 0x3C - bl sub_80AD8B4 - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x80 - beq _080A042E - cmp r0, 0x86 - bne _080A045C -_080A042E: - mov r3, r10 - ldr r0, [r3, 0x3C] - ldr r1, [r3, 0x34] - subs r0, r1 - ldr r1, [r3, 0x40] - ldr r2, [r3, 0x38] - subs r1, r2 - bl sub_8009FB8 - add r1, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r1, r4] - bl __divsi3 - mov r5, r10 - strh r0, [r5, 0x2A] - lsls r0, 16 - cmp r0, 0 - ble _080A0458 - bl _0809F0C4 -_080A0458: - movs r0, 0x1 - b _080A05EA -_080A045C: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - b _080A07B8 -_080A0462: - ldr r4, [sp, 0xC] - lsls r4, 1 - subs r4, 0x1 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - mov r5, r10 - adds r5, 0x3C - ldr r2, [r1, 0xC] - adds r1, r5, 0 - bl _call_via_r2 - ldr r0, [sp, 0x10] - lsls r0, 16 - asrs r0, 16 - adds r1, r5, 0 - bl sub_80AD8B4 - adds r0, r4, 0 - bl OtherRandInt - add r1, sp, 0x8 - movs r3, 0x2 - ldrsh r1, [r1, r3] - subs r0, r1 - lsls r0, 8 - mov r5, r10 - ldr r1, [r5, 0x3C] - adds r1, r0 - str r1, [r5, 0x3C] - adds r0, r4, 0 - bl OtherRandInt - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - subs r0, r1 - lsls r0, 8 - ldr r1, [r5, 0x40] - adds r2, r1, r0 - str r2, [r5, 0x40] - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x81 - beq _080A04C0 - cmp r0, 0x87 - bne _080A04EC -_080A04C0: - mov r3, r10 - ldr r0, [r3, 0x3C] - ldr r1, [r3, 0x34] - subs r0, r1 - ldr r1, [r3, 0x38] - subs r1, r2, r1 - bl sub_8009FB8 - add r1, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r1, r4] - bl __divsi3 - mov r5, r10 - strh r0, [r5, 0x2A] - lsls r0, 16 - cmp r0, 0 - ble _080A04E8 - bl _0809F0C4 -_080A04E8: - movs r0, 0x1 - b _080A05EA -_080A04EC: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - b _080A07B8 -_080A04F2: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r4, r0, 16 - cmp r4, 0 - bge _080A0508 - bl _0809EAE0 -_080A0508: - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - mov r1, r10 - adds r1, 0x34 - ldr r2, [r2, 0xC] - bl _call_via_r2 - mov r1, r10 - adds r1, 0x3C - adds r0, r4, 0 - bl sub_80A8FD8 - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x82 - beq _080A052E - cmp r0, 0x88 - bne _080A055A -_080A052E: - mov r4, r10 - ldr r0, [r4, 0x3C] - ldr r1, [r4, 0x34] - subs r0, r1 - ldr r1, [r4, 0x40] - ldr r2, [r4, 0x38] - subs r1, r2 - bl sub_8009FB8 - add r1, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r1, r5] - bl __divsi3 - strh r0, [r4, 0x2A] - lsls r0, 16 - cmp r0, 0 - ble _080A0556 - bl _0809F0C4 -_080A0556: - movs r0, 0x1 - b _080A0656 -_080A055A: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - b _080A07B8 -_080A0560: - ldr r0, [sp, 0xC] - lsls r0, 8 - mov r2, r10 - str r0, [r2, 0x48] - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - str r0, [r2, 0x30] - ldr r0, _080A0578 - bl _080A12AE - .align 2, 0 -_080A0578: .4byte 0x0000ffff -_080A057C: - ldr r1, [sp, 0xC] - mov r0, r9 - adds r0, 0x4A - strb r1, [r0] - mov r4, r9 - ldr r2, [r4] - ldr r0, [r4, 0x4] - lsls r1, 24 - asrs r1, 24 - ldr r2, [r2, 0x2C] - bl _call_via_r2 - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - mov r1, r10 - str r0, [r1, 0x30] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - b _080A07BA -_080A05A4: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - mov r4, sp - adds r4, 0x4F - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - movs r0, 0 - ldrsb r0, [r4, r0] - ldr r1, [sp, 0xC] - lsls r1, 24 - lsrs r1, 24 - bl sub_8002984 - mov r1, r9 - adds r1, 0x4A - strb r0, [r1] - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r2, [r2, 0x2C] - bl _call_via_r2 - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - mov r5, r10 - str r0, [r5, 0x30] - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] -_080A05EA: - strh r0, [r5, 0x2A] - bl _0809F0C4 -_080A05F0: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - mov r1, r9 - adds r1, 0x4A - strb r0, [r1] - mov r0, r9 - ldr r2, [r0] - ldr r0, [r0, 0x4] -_080A0600: - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r2, [r2, 0x2C] - bl _call_via_r2 - b _080A07B4 -_080A060E: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - blt _080A0650 - add r4, sp, 0x50 - adds r1, r4, 0 - bl sub_80A9050 - movs r0, 0 - ldrsb r0, [r4, r0] - add r1, sp, 0x8 - ldrh r1, [r1, 0x2] - lsls r1, 24 - lsrs r1, 24 - bl sub_8002984 - mov r1, r9 - adds r1, 0x4A - strb r0, [r1] - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r2, [r2, 0x2C] - bl _call_via_r2 -_080A0650: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] -_080A0654: - mov r4, r10 -_080A0656: - strh r0, [r4, 0x2A] - bl _0809F0C4 -_080A065C: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - mov r4, sp - adds r4, 0x51 - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - movs r0, 0 - ldrsb r0, [r4, r0] - add r1, sp, 0x8 - ldrh r1, [r1, 0x2] - lsls r1, 24 - lsrs r1, 24 - bl sub_8002984 - mov r1, r9 - adds r1, 0x4A - strb r0, [r1] - ldr r2, [r5] - ldr r0, [r5, 0x4] - b _080A0600 -_080A068A: - movs r5, 0 - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0x8F - beq _080A06CA - cmp r0, 0x8F - bgt _080A069E - cmp r0, 0x8E - beq _080A06A4 - b _080A0724 -_080A069E: - cmp r0, 0x90 - beq _080A06F8 - b _080A0724 -_080A06A4: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r4, r0, 16 - cmp r4, 0 - blt _080A0724 - movs r5, 0x1 - add r1, sp, 0x124 - adds r0, r4, 0 - bl sub_80A8FD8 - add r1, sp, 0x12C - adds r0, r4, 0 - bl sub_80A8F9C - b _080A0724 -_080A06CA: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - blt _080A0724 - movs r5, 0x1 - add r1, sp, 0x124 - bl sub_80A8FD8 - ldr r0, _080A06F4 - ldr r1, [r0, 0x4] - ldr r0, [r0] - add r2, sp, 0x12C - str r0, [r2] - str r1, [r2, 0x4] - b _080A0724 - .align 2, 0 -_080A06F4: .4byte gUnknown_81164DC -_080A06F8: - movs r5, 0x1 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - add r4, sp, 0x124 - ldr r2, [r1, 0xC] - adds r1, r4, 0 - bl _call_via_r2 - mov r3, r9 - ldr r2, [r3] - ldr r0, [r3, 0x4] - add r1, sp, 0x12C - ldr r2, [r2, 0x8] - bl _call_via_r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - adds r1, r4, 0 - bl sub_80AD8B4 -_080A0724: - cmp r5, 0 - beq _080A07B4 - mov r4, r9 - ldr r1, [r4] - ldr r0, [r4, 0x4] - add r5, sp, 0x134 - ldr r2, [r1, 0xC] - adds r1, r5, 0 - bl _call_via_r2 - ldr r1, [r4] - ldr r0, [r4, 0x4] - add r4, sp, 0x13C - ldr r2, [r1, 0x8] - adds r1, r4, 0 - bl _call_via_r2 - add r7, sp, 0x124 - add r3, sp, 0x12C - adds r0, r5, 0 - adds r1, r4, 0 - adds r2, r7, 0 - bl sub_8002DF0 - mov r1, sp - adds r1, 0x52 - strb r0, [r1] - movs r0, 0x1 - negs r0, r0 - movs r4, 0 - ldrsb r4, [r1, r4] - adds r6, r1, 0 - cmp r4, r0 - bne _080A078C - ldr r3, _080A07C0 - adds r0, r5, 0 - adds r1, r3, 0 - adds r2, r7, 0 - bl sub_8002D54 - strb r0, [r6] - movs r0, 0 - ldrsb r0, [r6, r0] - cmp r0, r4 - bne _080A078C - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - ldr r2, [r1, 0x14] - adds r1, r6, 0 - bl _call_via_r2 -_080A078C: - movs r0, 0 - ldrsb r0, [r6, r0] - add r1, sp, 0x8 - ldrh r1, [r1, 0x2] - lsls r1, 24 - lsrs r1, 24 - bl sub_8002984 - mov r1, r9 - adds r1, 0x4A - strb r0, [r1] - mov r0, r9 - ldr r2, [r0] - ldr r0, [r0, 0x4] - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - ldr r2, [r2, 0x2C] - bl _call_via_r2 -_080A07B4: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] -_080A07B8: - mov r1, r10 -_080A07BA: - strh r0, [r1, 0x2A] - bl _0809F0C4 - .align 2, 0 -_080A07C0: .4byte gUnknown_81164DC -_080A07C4: - movs r0, 0 - bl _080A12AC -_080A07CA: - ldr r0, [sp, 0xC] - mov r1, r9 - adds r1, 0x71 - movs r2, 0 - strb r0, [r1] - mov r3, r10 - strh r2, [r3, 0x2A] - bl _0809F0C4 -_080A07DC: - mov r4, r9 - ldr r1, [r4] - ldr r0, [r4, 0x4] - mov r4, sp - adds r4, 0x53 - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - movs r0, 0 - ldrsb r0, [r4, r0] - ldr r1, [sp, 0xC] - lsls r1, 24 - lsrs r1, 24 - bl sub_8002984 - mov r1, r9 - adds r1, 0x71 - movs r2, 0 - strb r0, [r1] - mov r5, r10 - strh r2, [r5, 0x2A] - bl _0809F0C4 -_080A080C: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - bl sub_809D124 - bl _0809EAE0 -_080A081E: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r1, r0, 16 - mov r3, r9 - movs r4, 0x8 - ldrsh r0, [r3, r4] - cmp r0, 0x2 - beq _080A0856 - cmp r0, 0x2 - bgt _080A0844 - cmp r0, 0x1 - beq _080A084C - bl _0809EAE0 -_080A0844: - cmp r0, 0x3 - beq _080A0860 - bl _0809EAE0 -_080A084C: - movs r0, 0x1 - bl sub_809D170 - bl _0809EAE0 -_080A0856: - movs r0, 0x2 - bl sub_809D170 - bl _0809EAE0 -_080A0860: - movs r0, 0x3 - bl sub_809D170 - bl _0809EAE0 -_080A086A: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r0, 16 - movs r2, 0x8 - ldrsh r1, [r5, r2] - cmp r1, 0x2 - beq _080A08A0 - cmp r1, 0x2 - bgt _080A088E - cmp r1, 0x1 - beq _080A0896 - bl _0809EAE0 -_080A088E: - cmp r1, 0x3 - beq _080A08AA - bl _0809EAE0 -_080A0896: - add r4, sp, 0x144 - adds r1, r4, 0 - bl sub_80A8FD8 - b _080A08B2 -_080A08A0: - add r4, sp, 0x144 - adds r1, r4, 0 - bl sub_80AC448 - b _080A08B2 -_080A08AA: - add r4, sp, 0x144 - adds r1, r4, 0 - bl sub_80AD360 -_080A08B2: - movs r0, 0 - adds r1, r4, 0 - bl sub_809D158 - bl _0809EAE0 -_080A08BE: - movs r0, 0x1 - movs r1, 0 - bl sub_809D170 - bl _0809EAE0 -_080A08CA: - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bge _080A08E2 - bl _0809EAE0 -_080A08E2: - mov r4, r9 - movs r5, 0x8 - ldrsh r0, [r4, r5] - cmp r0, 0x2 - beq _080A090A - cmp r0, 0x2 - bgt _080A08F8 - cmp r0, 0x1 - beq _080A0900 - bl _0809EAE0 -_080A08F8: - cmp r0, 0x3 - beq _080A0914 - bl _0809EAE0 -_080A0900: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - movs r0, 0x1 - b _080A0990 -_080A090A: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0x2 - b _080A0990 -_080A0914: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - movs r0, 0x3 - b _080A0990 -_080A091E: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r0, 16 - mov r2, r9 - movs r3, 0x8 - ldrsh r1, [r2, r3] - cmp r1, 0x2 - beq _080A095C - cmp r1, 0x2 - bgt _080A0944 - cmp r1, 0x1 - beq _080A094C - bl _0809EAE0 -_080A0944: - cmp r1, 0x3 - beq _080A096C - bl _0809EAE0 -_080A094C: - add r4, sp, 0x14C - adds r1, r4, 0 - bl sub_80A8FD8 - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - b _080A097A -_080A095C: - add r4, sp, 0x14C - adds r1, r4, 0 - bl sub_80AC448 - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r2, [r0, r1] - b _080A097A -_080A096C: - add r4, sp, 0x14C - adds r1, r4, 0 - bl sub_80AD360 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] -_080A097A: - movs r0, 0 - adds r1, r4, 0 - bl sub_809D190 - bl _0809F0C4 -_080A0986: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0x1 - movs r1, 0 -_080A0990: - bl sub_809D1A8 - bl _0809F0C4 -_080A0998: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bge _080A09B0 - bl _0809EAE0 -_080A09B0: - movs r2, 0x8 - ldrsh r0, [r5, r2] - cmp r0, 0x2 - beq _080A09D6 - cmp r0, 0x2 - bgt _080A09C4 - cmp r0, 0x1 - beq _080A09CC - bl _0809EAE0 -_080A09C4: - cmp r0, 0x3 - beq _080A09E0 - bl _0809EAE0 -_080A09CC: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - movs r0, 0x1 - b _080A0A5C -_080A09D6: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0x2 - b _080A0A5C -_080A09E0: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - movs r0, 0x3 - b _080A0A5C -_080A09EA: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r0, 16 - mov r2, r9 - movs r3, 0x8 - ldrsh r1, [r2, r3] - cmp r1, 0x2 - beq _080A0A28 - cmp r1, 0x2 - bgt _080A0A10 - cmp r1, 0x1 - beq _080A0A18 - bl _0809EAE0 -_080A0A10: - cmp r1, 0x3 - beq _080A0A38 - bl _0809EAE0 -_080A0A18: - add r4, sp, 0x154 - adds r1, r4, 0 - bl sub_80A8FD8 - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - b _080A0A46 -_080A0A28: - add r4, sp, 0x154 - adds r1, r4, 0 - bl sub_80AC448 - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r2, [r0, r1] - b _080A0A46 -_080A0A38: - add r4, sp, 0x154 - adds r1, r4, 0 - bl sub_80AD360 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] -_080A0A46: - movs r0, 0 - adds r1, r4, 0 - bl sub_809D1CC - bl _0809F0C4 -_080A0A52: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0x1 - movs r1, 0 -_080A0A5C: - bl sub_809D1E4 - bl _0809F0C4 -_080A0A64: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0 - bge _080A0A7C - bl _0809EAE0 -_080A0A7C: - movs r2, 0x8 - ldrsh r0, [r5, r2] - cmp r0, 0x2 - beq _080A0AA2 - cmp r0, 0x2 - bgt _080A0A90 - cmp r0, 0x1 - beq _080A0A98 - bl _0809EAE0 -_080A0A90: - cmp r0, 0x3 - beq _080A0AAC - bl _0809EAE0 -_080A0A98: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - movs r0, 0x1 - b _080A0B28 -_080A0AA2: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0x2 - b _080A0B28 -_080A0AAC: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - movs r0, 0x3 - b _080A0B28 -_080A0AB6: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - ldr r1, [r1, 0x4] - bl _call_via_r1 - lsls r0, 16 - asrs r0, 16 - mov r2, r9 - movs r3, 0x8 - ldrsh r1, [r2, r3] - cmp r1, 0x2 - beq _080A0AF4 - cmp r1, 0x2 - bgt _080A0ADC - cmp r1, 0x1 - beq _080A0AE4 - bl _0809EAE0 -_080A0ADC: - cmp r1, 0x3 - beq _080A0B04 - bl _0809EAE0 -_080A0AE4: - add r4, sp, 0x15C - adds r1, r4, 0 - bl sub_80A8FD8 - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - b _080A0B12 -_080A0AF4: - add r4, sp, 0x15C - adds r1, r4, 0 - bl sub_80AC448 - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r2, [r0, r1] - b _080A0B12 -_080A0B04: - add r4, sp, 0x15C - adds r1, r4, 0 - bl sub_80AD360 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] -_080A0B12: - movs r0, 0 - adds r1, r4, 0 - bl sub_809D208 - bl _0809F0C4 -_080A0B1E: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0x1 - movs r1, 0 -_080A0B28: - bl sub_809D220 - bl _0809F0C4 -_080A0B30: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r1, r5] - bl sub_8001570 - bl _0809EAE0 -_080A0B42: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl sub_80015C0 - bl _0809EAE0 -_080A0B54: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r3, 0x2 - ldrsh r1, [r1, r3] - ldr r2, [sp, 0xC] - add r3, sp, 0x8 - ldrb r3, [r3, 0x1] - bl sub_800226C - bl _0809EAE0 -_080A0B6C: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r1, r4] - ldr r2, [sp, 0xC] - lsls r2, 16 - asrs r2, 16 - add r3, sp, 0x8 - ldrb r3, [r3, 0x1] - bl sub_80022A0 - bl _0809EAE0 -_080A0B88: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r1, r5] - ldr r2, [sp, 0xC] - lsls r2, 16 - lsrs r2, 16 - ldr r3, [sp, 0x10] - bl sub_800199C - bl _0809EAE0 -_080A0BA2: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - bl ScenarioCalc - bl _0809EAE0 -_080A0BB4: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - add r1, sp, 0x164 - add r2, sp, 0x168 - bl sub_8001B88 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - add r1, sp, 0x164 - ldr r1, [r1] - add r2, sp, 0x168 - ldr r2, [r2] - adds r2, 0x1 - bl ScenarioCalc - bl _0809EAE0 -_080A0BDA: - ldr r2, [sp, 0xC] - movs r0, 0 - movs r1, 0x13 - bl sub_80018D8 - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r2, [r0, r4] - movs r0, 0 - movs r1, 0x16 - bl sub_80018D8 - bl _0809EAE0 -_080A0BF6: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r2, [r0, r5] - movs r0, 0 - movs r1, 0x1C - bl sub_80018D8 - bl _0809EAE0 -_080A0C08: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - add r1, sp, 0x8 - ldrb r2, [r1, 0x1] - negs r1, r2 - orrs r1, r2 - lsrs r1, 31 - bl sub_80026E8 - bl _0809EAE0 -_080A0C20: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r0, [r0, r2] - add r1, sp, 0x8 - ldrb r2, [r1, 0x1] - negs r1, r2 - orrs r1, r2 - lsrs r1, 31 - bl sub_809733C - bl _0809EAE0 -_080A0C38: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - add r1, sp, 0x8 - ldrb r2, [r1, 0x1] - negs r1, r2 - orrs r1, r2 - lsrs r1, 31 - bl sub_80973A8 - bl _0809EAE0 -_080A0C50: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - add r1, sp, 0x8 - ldrb r2, [r1, 0x1] - negs r1, r2 - orrs r1, r2 - lsrs r1, 31 - bl sub_8097418 - bl _0809EAE0 -_080A0C68: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - add r1, sp, 0x8 - ldrb r2, [r1, 0x1] - negs r1, r2 - orrs r1, r2 - lsrs r1, 31 - bl sub_80975A8 - bl _0809EAE0 -_080A0C80: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 24 - lsrs r0, 24 - bl sub_80976F8 - bl _0809EAE0 -_080A0C90: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - ldr r2, [sp, 0xC] - movs r0, 0 - movs r3, 0x2 - bl sub_80022F8 - b _080A0E1E -_080A0CA2: - mov r0, r10 - adds r0, 0x50 - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - ldr r2, [sp, 0x10] - add r3, sp, 0x8 - ldrb r3, [r3, 0x1] - bl sub_80022F8 - lsls r0, 24 - cmp r0, 0 - bne _080A0CC0 - bl _0809EAE0 -_080A0CC0: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r0, r4] - b _080A0D5C -_080A0CC8: - mov r0, r10 - adds r0, 0x50 - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - ldr r2, [sp, 0x10] - lsls r2, 16 - asrs r2, 16 - add r3, sp, 0x8 - ldrb r3, [r3, 0x1] - bl sub_8002318 - lsls r0, 24 - cmp r0, 0 - bne _080A0CEA - bl _0809EAE0 -_080A0CEA: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - b _080A0E2C -_080A0CF2: - mov r0, r10 - adds r0, 0x50 - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - ldr r2, [sp, 0x10] - lsls r2, 16 - lsrs r2, 16 - bl sub_8001784 - cmp r0, 0 - bne _080A0D0E - bl _0809EAE0 -_080A0D0E: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r0, r4] - b _080A0D5C -_080A0D16: - mov r0, r10 - adds r0, 0x50 - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - bl sub_8001AB0 - ldr r1, [sp, 0x10] - add r2, sp, 0x8 - ldrb r2, [r2, 0x1] - bl FlagJudge - lsls r0, 24 - cmp r0, 0 - bne _080A0D38 - bl _0809EAE0 -_080A0D38: - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - b _080A0E2C -_080A0D40: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r0, [r0, r4] - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - bl sub_8001CC4 - lsls r0, 24 - cmp r0, 0 - bne _080A0D58 - bl _0809EAE0 -_080A0D58: - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] -_080A0D5C: - mov r0, r9 - bl sub_80A242C - mov r5, r10 - str r0, [r5, 0x4] - bl _0809EAE0 -_080A0D6A: - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - bl sub_8001D08 - b _080A0DBA -_080A0D7A: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - ldr r1, [sp, 0xC] - ldr r2, [sp, 0x10] - bl sub_8001D44 - lsls r0, 24 - cmp r0, 0 - bne _080A0D92 - bl _0809EAE0 -_080A0D92: - b _080A0DF6 -_080A0D94: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - bl sub_80023E4 - lsls r0, 24 - cmp r0, 0 - bne _080A0DA8 - bl _0809EAE0 -_080A0DA8: - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] - b _080A132A -_080A0DAE: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 24 - lsrs r0, 24 - bl sub_8098100 -_080A0DBA: - lsls r0, 24 - cmp r0, 0 - bne _080A0DC4 - bl _0809EAE0 -_080A0DC4: - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] - mov r0, r9 - bl sub_80A242C - mov r2, r10 - str r0, [r2, 0x4] - bl _0809EAE0 -_080A0DD6: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80026CC - b _080A0E1E -_080A0DE2: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 24 - lsrs r0, 24 - bl sub_809CBA4 - cmp r0, 0 - bgt _080A0DF6 - bl _0809EAE0 -_080A0DF6: - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] - mov r0, r9 - bl sub_80A242C - mov r4, r10 - str r0, [r4, 0x4] - bl _0809EAE0 -_080A0E08: - mov r5, r9 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _080A0E16 - bl _0809EAE0 -_080A0E16: - movs r2, 0xA - ldrsh r0, [r5, r2] - bl sub_80A8C98 -_080A0E1E: - lsls r0, 24 - cmp r0, 0 - bne _080A0E28 - bl _0809EAE0 -_080A0E28: - add r0, sp, 0x8 - ldrb r1, [r0, 0x1] -_080A0E2C: - mov r0, r9 - bl sub_80A242C - mov r3, r10 - str r0, [r3, 0x4] - bl _0809EAE0 -_080A0E3A: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 24 - lsrs r0, 24 - bl FindItemInInventory - cmp r0, 0 - bge _080A0E4E - bl _0809EAE0 -_080A0E4E: - bl ShiftItemsDownFrom - bl _0809EAE0 -_080A0E56: - add r0, sp, 0x8 - ldrb r2, [r0] - adds r0, r2, 0 - subs r0, 0xC0 - cmp r0, 0xB - bls _080A0E64 - b _080A1088 -_080A0E64: - lsls r0, 2 - ldr r1, _080A0E70 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_080A0E70: .4byte _080A0E74 - .align 2, 0 -_080A0E74: - .4byte _080A0EA4 - .4byte _080A0EB6 - .4byte _080A0ECC - .4byte _080A0EFA - .4byte _080A0F08 - .4byte _080A0F14 - .4byte _080A0F26 - .4byte _080A0F36 - .4byte _080A0F98 - .4byte _080A1008 - .4byte _080A0F4C - .4byte _080A107A -_080A0EA4: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r1, r4] - bl sub_8001658 - adds r1, r0, 0 - b _080A1098 -_080A0EB6: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r1, r5] - bl sub_8001658 - ldr r1, [sp, 0xC] - add r2, sp, 0x8 - ldrb r2, [r2, 0x1] - b _080A0EF2 -_080A0ECC: - mov r4, r10 - adds r4, 0x50 - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - adds r0, r4, 0 - bl sub_8001658 - adds r5, r0, 0 - ldr r1, [sp, 0xC] - lsls r1, 16 - asrs r1, 16 - adds r0, r4, 0 - bl sub_8001658 - adds r1, r0, 0 - add r0, sp, 0x8 - ldrb r2, [r0, 0x1] - adds r0, r5, 0 -_080A0EF2: - bl FlagCalc - adds r1, r0, 0 - b _080A1098 -_080A0EFA: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - bl OtherRandInt - adds r1, r0, 0 - b _080A1098 -_080A0F08: - add r0, sp, 0x8 - movs r4, 0x2 - ldrsh r1, [r0, r4] - movs r0, 0 - movs r2, 0 - b _080A0F1E -_080A0F14: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r0, r5] - movs r0, 0 - movs r2, 0x1 -_080A0F1E: - bl sub_8001784 - adds r1, r0, 0 - b _080A1098 -_080A0F26: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A8C2C - lsls r0, 16 - asrs r1, r0, 16 - b _080A1098 -_080A0F36: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r0, 0x4] - add r4, sp, 0x54 - ldr r2, [r1, 0x14] - adds r1, r4, 0 - bl _call_via_r2 - movs r1, 0 - ldrsb r1, [r4, r1] - b _080A1098 -_080A0F4C: - mov r2, r9 - ldr r1, [r2] - ldr r0, [r2, 0x4] - movs r3, 0xB6 - lsls r3, 1 - add r3, sp - mov r8, r3 - ldr r2, [r1, 0xC] - mov r1, r8 - bl _call_via_r2 - add r6, sp, 0x16C - ldr r0, [r6] - ldr r1, [r6, 0x4] - add r4, sp, 0x174 - str r0, [r4] - str r1, [r4, 0x4] - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - adds r5, r4, 0 - adds r1, r5, 0 - bl sub_80AD8B4 - ldr r1, [r4] - ldr r0, [r6] - subs r1, r0 - add r0, sp, 0x17C - str r1, [r0] - ldr r1, [r5, 0x4] - mov r4, r8 - ldr r0, [r4, 0x4] - subs r1, r0 - add r0, sp, 0x17C - str r1, [r0, 0x4] - bl sub_8002C60 - b _080A106A -_080A0F98: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r6, r0, 16 - cmp r6, 0 - blt _080A1074 - mov r5, r9 - ldr r1, [r5] - ldr r0, [r5, 0x4] - movs r2, 0xC2 - lsls r2, 1 - add r2, sp - mov r8, r2 - ldr r2, [r1, 0xC] - mov r1, r8 - bl _call_via_r2 - ldr r1, [r5] - ldr r0, [r5, 0x4] - add r5, sp, 0x18C - ldr r2, [r1, 0x8] - adds r1, r5, 0 - bl _call_via_r2 - add r7, sp, 0x194 - adds r0, r6, 0 - adds r1, r7, 0 - bl sub_80A8FD8 - add r4, sp, 0x19C - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_80A8F9C - mov r0, r8 - adds r1, r5, 0 - adds r2, r7, 0 - adds r3, r4, 0 - bl sub_8002DF0 - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _080A1098 - ldr r3, _080A1004 - mov r0, r8 - adds r1, r3, 0 - adds r2, r7, 0 - b _080A1066 - .align 2, 0 -_080A1004: .4byte gUnknown_81164DC -_080A1008: - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - bl sub_80A7AE8 - lsls r0, 16 - asrs r7, r0, 16 - cmp r7, 0 - blt _080A1074 - mov r3, r9 - ldr r1, [r3] - ldr r0, [r3, 0x4] - add r6, sp, 0x1A4 - ldr r2, [r1, 0xC] - adds r1, r6, 0 - bl _call_via_r2 - mov r4, r9 - ldr r1, [r4] - ldr r0, [r4, 0x4] - add r4, sp, 0x1AC - ldr r2, [r1, 0x8] - adds r1, r4, 0 - bl _call_via_r2 - add r5, sp, 0x1B4 - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80A8FD8 - ldr r7, _080A1070 - adds r0, r6, 0 - adds r1, r4, 0 - adds r2, r5, 0 - adds r3, r7, 0 - bl sub_8002DF0 - lsls r0, 24 - asrs r1, r0, 24 - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - bne _080A1098 - adds r0, r6, 0 - adds r1, r7, 0 - adds r2, r5, 0 - adds r3, r7, 0 -_080A1066: - bl sub_8002D54 -_080A106A: - lsls r0, 24 - asrs r1, r0, 24 - b _080A1098 - .align 2, 0 -_080A1070: .4byte gUnknown_81164DC -_080A1074: - movs r1, 0x1 - negs r1, r1 - b _080A1098 -_080A107A: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r0, [r0, r5] - bl sub_809CC90 - adds r1, r0, 0 - b _080A1098 -_080A1088: - ldr r0, _080A1090 - ldr r1, _080A1094 - bl FatalError - .align 2, 0 -_080A1090: .4byte gUnknown_81166B4 -_080A1094: .4byte gUnknown_81166C0 -_080A1098: - mov r0, r9 - bl sub_80A2460 - b _080A1330 -_080A10A0: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl sub_8001658 - adds r2, r0, 0 - mov r3, r10 - strh r2, [r3, 0x28] - ldr r1, [r3, 0x4] - ldrb r0, [r1] - cmp r0, 0xD0 - bne _080A10DE - lsls r0, r2, 16 - asrs r3, r0, 16 -_080A10C0: - adds r2, r1, 0 - movs r4, 0x2 - ldrsh r0, [r1, r4] - cmp r0, r3 - bne _080A10CE - bl _0809F0C4 -_080A10CE: - adds r0, r1, 0 - adds r0, 0x10 - mov r5, r10 - str r0, [r5, 0x4] - adds r1, r0, 0 - ldrb r0, [r2, 0x10] - cmp r0, 0xD0 - beq _080A10C0 -_080A10DE: - mov r1, r10 - ldr r0, [r1, 0x4] - ldrb r0, [r0] - cmp r0, 0xD1 - beq _080A10EC - bl _0809EAE0 -_080A10EC: - ldr r0, _080A10F4 - strh r0, [r1, 0x28] - bl _0809F0C4 - .align 2, 0 -_080A10F4: .4byte 0x0000ffff -_080A10F8: - ldr r7, [sp, 0x14] - ldr r1, _080A11F0 - movs r0, 0 - str r0, [r1] - mov r2, r10 - strh r0, [r2, 0x28] - add r0, sp, 0x8 - ldrb r0, [r0] - cmp r0, 0xD8 - bgt _080A1176 - cmp r0, 0xD6 - blt _080A1176 - mov r0, r10 - adds r0, 0x50 - ldr r1, [sp, 0x10] - lsls r1, 16 - asrs r1, 16 - bl sub_8001658 - adds r3, r0, 0 - mov r4, r10 - ldr r1, [r4, 0x4] - ldrb r0, [r1] - cmp r0, 0xD0 - bne _080A114E -_080A112A: - adds r2, r1, 0 - movs r5, 0x2 - ldrsh r0, [r2, r5] - cmp r0, r3 - bne _080A1136 - ldr r7, [r2, 0xC] -_080A1136: - adds r0, r1, 0 - adds r0, 0x10 - mov r1, r10 - str r0, [r1, 0x4] - ldrh r1, [r1, 0x28] - adds r1, 0x1 - mov r4, r10 - strh r1, [r4, 0x28] - adds r1, r0, 0 - ldrb r0, [r2, 0x10] - cmp r0, 0xD0 - beq _080A112A -_080A114E: - mov r5, r10 - ldr r1, [r5, 0x4] - ldrb r0, [r1] - cmp r0, 0xD1 - bne _080A1176 -_080A1158: - cmp r7, 0 - bne _080A115E - ldr r7, [r1, 0xC] -_080A115E: - mov r0, r10 - ldr r2, [r0, 0x4] - adds r1, r2, 0 - adds r1, 0x10 - str r1, [r0, 0x4] - ldrh r0, [r0, 0x28] - adds r0, 0x1 - mov r3, r10 - strh r0, [r3, 0x28] - ldrb r0, [r2, 0x10] - cmp r0, 0xD1 - beq _080A1158 -_080A1176: - cmp r7, 0 - bne _080A117C - ldr r7, _080A11F4 -_080A117C: - mov r4, r10 - ldr r5, [r4, 0x4] - ldrb r0, [r5] - cmp r0, 0xD9 - bne _080A11B8 - ldr r0, _080A11F8 - mov r8, r0 - ldr r6, _080A11F0 - movs r1, 0x4 - add r1, r8 - mov r12, r1 -_080A1192: - ldr r1, [r6] - lsls r2, r1, 3 - mov r4, r8 - adds r3, r2, r4 - adds r4, r5, 0 - ldr r0, [r4, 0xC] - str r0, [r3] - add r2, r12 - adds r1, 0x1 - str r1, [r2] - str r1, [r6] - adds r0, r4, 0 - adds r0, 0x10 - mov r5, r10 - str r0, [r5, 0x4] - adds r5, r0, 0 - ldrb r0, [r4, 0x10] - cmp r0, 0xD9 - beq _080A1192 -_080A11B8: - ldr r0, _080A11F0 - ldr r1, [r0] - cmp r1, 0 - bgt _080A11C4 - bl _0809EAE0 -_080A11C4: - ldr r3, _080A11F8 - lsls r2, r1, 3 - adds r1, r2, r3 - movs r0, 0 - str r0, [r1] - adds r0, r3, 0x4 - adds r2, r0 - add r0, sp, 0x8 - movs r1, 0x2 - ldrsh r0, [r0, r1] - str r0, [r2] - add r0, sp, 0x8 - ldrb r0, [r0] - subs r0, 0xD2 - cmp r0, 0x6 - bhi _080A1280 - lsls r0, 2 - ldr r1, _080A11FC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_080A11F0: .4byte gUnknown_203B4AC -_080A11F4: .4byte gUnknown_81166D8 -_080A11F8: .4byte gUnknown_2039D50 -_080A11FC: .4byte _080A1200 - .align 2, 0 -_080A1200: - .4byte _080A121C - .4byte _080A121C - .4byte _080A123E - .4byte _080A1260 - .4byte _080A121C - .4byte _080A123E - .4byte _080A1260 -_080A121C: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - movs r2, 0x1 - negs r2, r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - str r0, [sp] - str r7, [sp, 0x4] - adds r0, r3, 0 - movs r3, 0 - bl sub_809B028 - b _080A1280 -_080A123E: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - movs r2, 0x1 - negs r2, r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - str r0, [sp] - str r7, [sp, 0x4] - adds r0, r3, 0 - movs r3, 0x1 - bl sub_809B028 - b _080A1280 -_080A1260: - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - negs r1, r0 - orrs r1, r0 - lsrs r1, 31 - movs r2, 0x1 - negs r2, r2 - ldr r0, [sp, 0xC] - lsls r0, 16 - asrs r0, 16 - str r0, [sp] - str r7, [sp, 0x4] - adds r0, r3, 0 - movs r3, 0x2 - bl sub_809B028 -_080A1280: - mov r0, r9 - movs r1, 0x1 - bl sub_809D8EC - lsls r0, 24 - cmp r0, 0 - bne _080A1292 - bl _0809EAE0 -_080A1292: - movs r0, 0 - movs r1, 0xB - bl sub_80A87AC - bl _0809F0C4 -_080A129E: - mov r0, r9 - movs r1, 0x1 - bl sub_809D8EC - b _080A130A -_080A12A8: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] -_080A12AC: - mov r2, r10 -_080A12AE: - strh r0, [r2, 0x2A] - bl _0809F0C4 -_080A12B4: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r1, [r0, r3] - ldr r0, [sp, 0xC] - subs r0, r1 - bl OtherRandInt - add r1, sp, 0x8 - ldrh r1, [r1, 0x2] - adds r1, r0 - mov r4, r10 - strh r1, [r4, 0x2A] - bl _0809F0C4 -_080A12D0: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - mov r5, r10 - strh r0, [r5, 0x28] - add r0, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r0, r2] - mov r0, r9 - bl sub_809D8EC - b _080A130A -_080A12E6: - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r0, [r0, r3] - bl sub_809D9B8 - bl _0809EAE0 -_080A12F4: - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - mov r4, r10 - strh r0, [r4, 0x28] - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r0, r5] - ldrb r2, [r0, 0x1] - mov r0, r9 - bl sub_809DA08 -_080A130A: - lsls r0, 24 -_080A130C: - cmp r0, 0 - bne _080A1314 - bl _0809EAE0 -_080A1314: - bl _0809F0C4 -_080A1318: - mov r1, r10 - adds r1, 0x10 - mov r0, r10 - adds r0, 0x4 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} -_080A1324: - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r0, r5] -_080A132A: - mov r0, r9 - bl sub_80A242C -_080A1330: - mov r1, r10 - str r0, [r1, 0x4] - bl _0809EAE0 -_080A1338: - mov r1, r10 - adds r1, 0x10 - mov r0, r10 - adds r0, 0x4 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} -_080A1344: - ldr r2, _080A1364 - add r0, sp, 0x8 - movs r5, 0x2 - ldrsh r1, [r0, r5] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r2, 0x8 - adds r0, r2 - ldr r0, [r0] - mov r1, r10 - str r0, [r1, 0x4] - str r0, [r1, 0x8] - bl _0809EAE0 - .align 2, 0 -_080A1364: .4byte gFunctionScriptTable -_080A1368: - mov r1, r10 - adds r1, 0x10 - mov r0, r10 - adds r0, 0x4 - ldm r0!, {r2-r4} - stm r1!, {r2-r4} -_080A1374: - ldr r0, _080A138C - movs r5, 0 - ldrsh r1, [r0, r5] - add r0, sp, 0x8 - ldrh r0, [r0, 0x2] - lsls r0, 16 - cmp r0, 0 - blt _080A1390 - add r0, sp, 0x8 - movs r3, 0x2 - ldrsh r2, [r0, r3] - b _080A1396 - .align 2, 0 -_080A138C: .4byte gUnknown_2039A34 -_080A1390: - mov r4, r10 - movs r5, 0xC - ldrsh r2, [r4, r5] -_080A1396: - adds r5, r2, 0 - add r0, sp, 0x8 - ldrb r0, [r0, 0x1] - lsls r0, 24 - cmp r0, 0 - blt _080A13AA - add r0, sp, 0x8 - movs r4, 0x1 - ldrsb r4, [r0, r4] - b _080A13B0 -_080A13AA: - mov r0, r10 - movs r4, 0xE - ldrsb r4, [r0, r4] -_080A13B0: - add r0, sp, 0x1C - adds r2, r5, 0 - adds r3, r4, 0 - bl GroundMap_GetStationScript - ldr r0, [sp, 0x1C] - mov r1, r10 - str r0, [r1, 0x4] - str r0, [r1, 0x8] - strh r5, [r1, 0xC] - strb r4, [r1, 0xE] - bl _0809EAE0 -_080A13CA: - mov r0, r10 - adds r0, 0x50 - add r1, sp, 0x8 - movs r2, 0x2 - ldrsh r1, [r1, r2] - bl sub_8001658 - lsls r0, 16 - asrs r0, 16 - bl sub_80A4D7C - ldr r4, _080A13F4 - strh r0, [r4] - bl sub_809D940 - movs r3, 0 - ldrsh r0, [r4, r3] - bl GroundMap_ExecuteEnter - bl _0809EAE0 - .align 2, 0 -_080A13F4: .4byte gUnknown_2039A34 -_080A13F8: - movs r0, 0 - mov r4, r10 - str r0, [r4, 0x10] - str r0, [r4, 0x14] - bl _0809EAE0 -_080A1404: - mov r5, r10 - ldr r0, [r5, 0x10] - cmp r0, 0 - bne _080A1410 -_080A140C: - movs r0, 0 - b _080A142E -_080A1410: - mov r0, r10 - adds r0, 0x4 - mov r1, r10 - adds r1, 0x10 - ldm r1!, {r2-r4} - stm r0!, {r2-r4} - movs r0, 0 - mov r5, r10 - str r0, [r5, 0x10] - str r0, [r5, 0x14] - bl _0809EAE0 -_080A1428: - movs r0, 0x1 - b _080A142E -_080A142C: - movs r0, 0x4 -_080A142E: - add sp, 0x1BC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end ExecuteScriptCommand - thumb_func_start sub_80A1440 sub_80A1440: push {r4,r5,lr} diff --git a/include/code_80A26CC.h b/include/code_80A26CC.h index 91655d190..b01fbeb6d 100644 --- a/include/code_80A26CC.h +++ b/include/code_80A26CC.h @@ -7,9 +7,9 @@ typedef struct DungeonInfo /* 0x0 */ s16 unk0; /* 0x2 */ s16 unk2; /* 0x4 */ s16 unk4; - /* 0x6 */ u16 unk6; - /* 0x8 */ u16 unk8; - /* 0xA */ u16 unkA; + /* 0x6 */ s16 unk6; + /* 0x8 */ s16 unk8; + /* 0xA */ s16 unkA; /* 0xC */ u8 dungeonIndex; /* 0xD */ u8 unkD; /* 0xE */ s16 unkE; @@ -40,4 +40,4 @@ bool8 sub_80A28F0(u8 index); s32 sub_80A29B0(u8 *); const u8 *sub_80A2B18(s16); -#endif // GUARD_CODE_80A26CC_H \ No newline at end of file +#endif // GUARD_CODE_80A26CC_H diff --git a/include/debug.h b/include/debug.h index 1c1b5fcbf..71c86c954 100644 --- a/include/debug.h +++ b/include/debug.h @@ -27,7 +27,7 @@ void PrintFuncFileLine(u8 *buf, DebugLocation *loc, const u8 *prefix); void PrintMessageWithFuncFileLine(u8 *buffer, DebugLocation *debug, const u8 *text, ...); void sub_8011B08(void); void sub_8011B88(const u8 *text, ...); -u32 ScriptLoggingEnabled(bool8); +s8 ScriptLoggingEnabled(bool8); u32 sub_8011BA8(void); const u8 *sub_8011BAC(void); void sub_8011B14(void); diff --git a/include/ground_script.h b/include/ground_script.h index 52eee2aa1..bae6c86bd 100644 --- a/include/ground_script.h +++ b/include/ground_script.h @@ -19,7 +19,7 @@ typedef struct ScriptInfoSmall /* 0x0 */ ScriptCommand *ptr; /* 0x4 */ s16 state; /* 0x6 */ s16 group; - /* 0x8 */ u8 sector; + /* 0x8 */ s8 sector; } ScriptInfoSmall; typedef struct ScriptInfo @@ -28,17 +28,17 @@ typedef struct ScriptInfo /* 0x0 */ ScriptCommand *ptr; /* 0x4 */ ScriptCommand *ptr2; /* 0x8 */ s16 group; - /* 0xA */ u8 sector; + /* 0xA */ s8 sector; } ScriptInfo; typedef union ScriptUnion832 { - u32 raw; - u8 arr[4]; + s32 raw; + s8 arr[4]; } ScriptUnion832; typedef union ScriptUnion1632 { - u32 raw; - u16 arr[2]; + s32 raw; + s16 arr[2]; } ScriptUnion1632; typedef struct ScriptData diff --git a/src/code_80A26CC.c b/src/code_80A26CC.c index e5c6abbd0..845da9f3c 100644 --- a/src/code_80A26CC.c +++ b/src/code_80A26CC.c @@ -461,4 +461,4 @@ const u8 *sub_80A2B18(s16 param_1) UNUSED static const u8 *sub_80A2B28(u16 r0) { return sub_80A2B18(sub_8001658(0, 17)); -} \ No newline at end of file +} diff --git a/src/debug.c b/src/debug.c index a27ba3ad6..bff40650a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -170,7 +170,7 @@ void nullsub_28(void) { } -u32 ScriptLoggingEnabled(bool8 unused) +s8 ScriptLoggingEnabled(bool8 unused) { return 0; } diff --git a/src/ground_script_1.c b/src/ground_script_1.c index 40f0f04f3..67752d0cf 100644 --- a/src/ground_script_1.c +++ b/src/ground_script_1.c @@ -1,4 +1,1875 @@ #include "global.h" #include "debug.h" #include "ground_script.h" +#include "ground_map.h" +#include "dungeon.h" +// Needs incorrect redeclaration +#define GroundMainGroundRequest jaksdlasjdklajksdklajsd +#define GroundMainRescueRequest pudmvjhieasmlzgvouh +#include "ground_main.h" +#undef GroundMainGroundRequest +#undef GroundMainRescueRequest +bool8 GroundMainGroundRequest(s32 r0, u32 r1, s32 r2); +bool8 GroundMainRescueRequest(s32 r0, u32 r1); + +// Needs incorrect redeclaration +#define sub_80A2608 vpoiuj345nmoszuozgvdyhz +#include "code_80A26CC.h" +#undef sub_80A2608 +const DungeonInfo *sub_80A2608(s32 index); + +typedef struct { + u8 xTiles; + u8 xFlags; + u8 yTiles; + u8 yFlags; +} PosInfo; +typedef union { + u32 raw; + PosInfo fields; +} UPos; +typedef struct GroundObjectData { + u8 kind; + u8 unk1; + u8 widthTiles; + u8 heightTiles; + UPos pos; + ScriptCommand *scripts[4]; // 2 - dialogue script +} GroundObjectData; +typedef struct GroundEffectData { + u8 kind; + u8 unk1; + u8 widthTiles; //??? + u8 heightTiles; + UPos pos; + ScriptCommand *script; +} GroundEffectData; + +void GroundSprite_Reset(s16); +void GroundMap_Select(s16); +void GroundMap_SelectDungeon(s16, DungeonLocation*, u8); +void GroundMap_ExecuteEnter(s16); +void GroundMap_ExecuteEvent(s16, bool8); +void GroundMap_GetStationScript(ScriptInfoSmall *out, s16, s32, s32); +void GroundMap_ExecuteStation(s32, s32, s32, bool8); +void GroundLives_ExecuteScript(s32, s16 *, ScriptInfoSmall *); +void GroundObject_ExecuteScript(s32, s16 *, ScriptInfoSmall *); +void GroundEffect_ExecuteScript(s32, s16 *, ScriptInfoSmall *); +void GroundLink_Select(s16); +void GroundLives_Select(s16, s32 group, s32 sector); +void GroundObject_Select(s16, s32 group, s32 sector); +void GroundEffect_Select(s16, s32 group, s32 sector); +void GroundEvent_Select(s16, s32 group, s32 sector); +void GroundLives_Cancel(s32 group, s32 sector); +void GroundObject_Cancel(s32 group, s32 sector); +void GroundEffect_Cancel(s32 group, s32 sector); +void GroundEvent_Cancel(s32 group, s32 sector); +void GroundLives_CancelBlank_1(void); +void GroundObject_CancelBlank(void); +void GroundEffect_CancelBlank(void); +void GroundWeather_Select(s16); +u32 GroundLives_ExecutePlayerScriptActionLives(); +s16 GroundObject_Add(s16 id, GroundObjectData*, s16 group, s8 sector); +s16 GroundEffect_Add(s16 id, GroundEffectData*, s16 group, s8 sector); +u32 FlagCalc(); +u32 FlagJudge(); +s32 OtherRandInt(s32); // IT RETURNS s32!! Not s16! +void FatalError(void* loc, char* fmt, ...) __attribute__((noreturn)); + +s32 sub_8001658(ScriptUnion832*, s32); +void sub_8001570(u8*, s16); +void sub_80015C0(u8*, s16); +u32 sub_8001784(ScriptUnion832*, s16, u16); +void sub_80018D8(s32, s32, s32); +void sub_800199C(u8*, s16, u32, s32); +u32 sub_8001AB0(); +void sub_8001B88(s16, s32*, s32*); +u32 ScenarioCalc(s16, s32, s32); +u32 sub_8001CC4(); +u32 sub_8001D08(); +u32 sub_8001D44(); +void sub_800226C(u8*, s16, s32, u8); +void sub_80022A0(u8*, s16, s32, u8); +u32 sub_80022F8(); +u32 sub_8002318(); +u32 sub_80023E4(); +u32 sub_80026CC(); +void sub_80026E8(s16, bool8); +char sub_8002984(s32, u8); +u32 sub_8002C60(); +u32 sub_8002D54(); +u8 sub_8002DF0(Position32*, Position32*, Position32*, Position32*); +s32 sub_8009FB8(); +u32 StopAllMusic_1(); +u32 FadeOutAllMusic(); +u32 xxx_call_start_new_bgm(); +u32 xxx_call_queue_bgm(); +u32 xxx_call_stop_bgm(); +u32 xxx_call_fade_out_bgm(); +u32 xxx_call_play_fanfare_se(); +u32 xxx_call_stop_fanfare_se(); +u32 xxx_call_fade_out_fanfare_se(); +void xxx_call_fade_in_new_bgm(u16 id, u16 arg); //sub_8011900 +bool8 sub_8021700(s32); +bool8 sub_802FCF0(void); + + +s32 FindItemInInventory(); +u32 ShiftItemsDownFrom(); +u32 sub_80920B8(); +void sub_809733C(s16, bool8); +void sub_80973A8(s16, bool8); +void sub_8097418(s16, bool8); +void sub_80975A8(s16, bool8); +void sub_80976F8(u8); +u32 sub_8098100(); +void sub_8098D1C(s32, u32, s32); +void sub_8098D80(s32); +void sub_8098E18(s32, s32); +u32 sub_80999E8(); +u32 sub_80999FC(); +u32 sub_8099A10(); +u32 sub_8099A34(); +u32 sub_8099A48(); +u32 sub_8099A5C(); +u32 sub_8099AFC(); +u32 sub_809A6E4(); +u32 sub_809A6F8(); +u32 sub_809A738(); +u32 sub_809A768(); +bool8 ScriptPrintNullTextbox(void); +bool8 ScriptPrintEmptyTextbox(void); +u32 sub_809A83C(); +u32 sub_809AC7C(); +u32 sub_809ADD8(); +bool8 ScriptPrintText(s32, s16, char*); +bool8 sub_809AEEC(char*); +bool8 sub_809AF2C(char*); +bool8 sub_809AF6C(s16, char*); +void sub_809AFC8(bool8, s32, s32, char*); +u32 sub_809B028(); +bool8 sub_809B1C0(s32, s32, char[12]); +void sub_809B1D4(u8, s32, s32, char*); +void sub_809C770(s16, s16); +s32 sub_809CBA4(u8); +u32 sub_809CC90(); +void sub_809D0BC(void); +void sub_809D124(s32, s32, s32); +void sub_809D158(s32, Position32*); +void sub_809D170(s32, s32); +void sub_809D190(s32, Position32*, s32); +void sub_809D1A8(s32, s32, s32); +void sub_809D1CC(s32, Position32*, s32); +void sub_809D1E4(s32, s32, s32); +void sub_809D208(s32, Position32*, s32); +void sub_809D220(s32, s32, s32); +u32 sub_809D52C(); +u32 InitScriptData(); +void sub_809D710(Action*, ScriptInfoSmall*, s16); +u8 sub_809D8EC(Action*, s16); +bool8 sub_809D940(void); +void sub_809D9B8(s16); +bool8 sub_809DA08(Action*, s16, u8); +ScriptCommand *sub_80A242C(Action*, s32); +ScriptCommand *sub_80A2460(Action*, s32); +s16 sub_80A4D7C(s32); +s16 sub_80A7AE8(s16); +void sub_80A87AC(s32, s32); +void sub_80A8BD8(s16, s32*); +u32 sub_80A8C2C(); +u32 sub_80A8C98(); +char *sub_80A8D54(s16); +s16 sub_80A8FD8(s32, Position32*); +s16 sub_80A8F9C(s32, Position32*); +u32 sub_80A9050(); +u32 sub_80A9090(); +s16 sub_80AC448(s16, Position32*); +s32 sub_80AC49C(s16, Position32*); +s16 sub_80AD360(s16, Position32*); +s16 sub_80AD3B4(s16, Position32*); +u32 sub_80AD8B4(); +u32 sub_80AD914(); +void DeleteBlankGroundEvents(void); +void DeleteBlankGroundLives(void); +void DeleteBlankGroundObjects(void); +void DeleteBlankGroundEffects(void); + +extern int gFormatData_202DE30[10]; + +extern s16 gCurrentMap; +extern s16 gUnknown_2039A32; +extern s16 gUnknown_2039A34; + +extern struct { char *unk0; s32 unk4; } gUnknown_2039D50[9]; +extern char gUnknown_2039D98[12]; +extern int gUnknown_203B4AC; + +extern FunctionScript gFunctionScriptTable[]; + +extern Position32 gUnknown_81164DC; +extern char gUnknown_81165D4[]; +extern char gUnknown_81165F4[]; +extern char gUnknown_811660C[]; +extern char gUnknown_8116628[]; +extern char gUnknown_8116644[]; +extern char gUnknown_8116664[]; +extern char gUnknown_8116684[]; +extern char gUnknown_81166C0[]; +extern char gUnknown_81166D8[]; + + +extern DebugLocation gUnknown_81166B4; + +/* No decompiler yet implemented for arm32 */ +s32 ExecuteScriptCommand(Action *action) { + ScriptCommand curCmd; + ScriptData *scriptData = &action->scriptData; + + while (1) { + scriptData->curPtr = scriptData->script.ptr; + curCmd = *scriptData->script.ptr++; + switch (scriptData->curScriptOp = curCmd.op) { + case 0x01: { + u32 arg = (s16)curCmd.arg1; + u32 argCopy = arg; + u32 byte = (u8)curCmd.argByte; + if (ScriptLoggingEnabled(TRUE)) { + // " ground select %3d[%s] %3d" + Log(1, gUnknown_81165D4, arg, gGroundConversion_811BAF4[arg].text, byte); + } + GroundMainGroundRequest(argCopy, byte, curCmd.argShort); + break; + } + case 0x02: { + s32 arg = (s16)curCmd.arg1; + if (arg == -1) arg = (s16)sub_8001658(0, 19); + if (ScriptLoggingEnabled(TRUE)) { + // " dungeon select %3d" + Log(1, gUnknown_81165F4, arg); + } + if (arg != -1) { + GroundMainRescueRequest(arg, curCmd.argShort); + action->scriptData.script.ptr = sub_80A2460(action, 1); + } else { + action->scriptData.script.ptr = sub_80A2460(action, 0); + } + break; + } + case 0x03: { + if ((s8)sub_8021700(curCmd.arg1)) { + action->scriptData.script.ptr = sub_80A2460(action, -1); + } else { + sub_8098D80(curCmd.argShort); + action->scriptData.script.ptr = sub_80A2460(action, 0); + } + break; + } + case 0x04: { + if (curCmd.arg1 == -1) { + if (!(u8)sub_802FCF0() && (u8)sub_809B1C0(12,0,0)) { + sub_80A87AC(0, 11); + action->scriptData.branchDiscriminant = 0; + } else { + action->scriptData.branchDiscriminant = -1; + } + return 2; // do action + } else { + sub_80018D8(0, 18, sub_80A26B8((s16)curCmd.arg1)); + action->scriptData.branchDiscriminant = 1; + return 2; // do action + } + break; + } + case 0x06: { + if (curCmd.arg1 == -1) { + if ((s8)sub_809B1C0(36, 0, 0)) { + sub_80A87AC(0, 11); + action->scriptData.branchDiscriminant = 0; + return 2; + } else { + action->scriptData.branchDiscriminant = -1; + return 2; + } + } else { + sub_80018D8(0, 19, curCmd.arg1); + action->scriptData.branchDiscriminant = 1; + return 2; + } + } + case 0x05: { + action->scriptData.branchDiscriminant = 1; + return 2; + } + case 0x07: { + s32 tmp = (s16)curCmd.arg1; + if (tmp == -1) { + tmp = (s16)sub_8001658(0, 19); + } else { + sub_80018D8(0, 19, tmp); + } + if (ScriptLoggingEnabled(TRUE)) { + Log(1, gUnknown_811660C, tmp); + } + if (tmp != -1) { + action->scriptData.branchDiscriminant = 1; + return 2; + } else { + action->scriptData.branchDiscriminant = -1; + return 2; + } + } + case 0x08: case 0x09: { + if (curCmd.op == 0x08) { + gCurrentMap = curCmd.arg1; + gUnknown_2039A32 = sub_80A4D7C((s16)curCmd.arg1); + gUnknown_2039A34 = gUnknown_2039A32; + if (ScriptLoggingEnabled(TRUE)) { + // " map select %3d %3d[%s]" + Log(1,gUnknown_8116628,gCurrentMap,gUnknown_2039A32, + gGroundConversion_811BAF4[gCurrentMap].text); + } + } else { + gUnknown_2039A32 = gCurrentMap = curCmd.arg1; + gUnknown_2039A34 = curCmd.arg1; + if (ScriptLoggingEnabled(TRUE)) { + // " ground select %3d %3d[%s]" + Log(1,gUnknown_8116644,gCurrentMap,gUnknown_2039A32, + gGroundConversion_811BAF4[gCurrentMap].text); + } + } + sub_80018D8(0,0x10,gCurrentMap); + sub_80018D8(0,0x11,gGroundConversion_811BAF4[gCurrentMap].unk2); + GroundSprite_Reset(gUnknown_2039A32); + sub_809D0BC(); + DeleteBlankGroundEvents(); + DeleteBlankGroundLives(); + DeleteBlankGroundObjects(); + DeleteBlankGroundEffects(); + sub_809C770(gCurrentMap, gGroundConversion_811BAF4[gCurrentMap].unk2); + GroundMap_Select(gUnknown_2039A32); + GroundLink_Select(gUnknown_2039A32); + GroundLives_Select(gUnknown_2039A32,0,0); + GroundObject_Select(gUnknown_2039A32,0,0); + break; + } + case 0x0a: { + const DungeonInfo *tmp; + DungeonLocation loc; + tmp = sub_80A2608((s16)curCmd.arg1); + gUnknown_2039A34 = gUnknown_2039A32 = gCurrentMap = (s16)curCmd.arg2; + if (ScriptLoggingEnabled(TRUE)) { + // " dungeon select %3d %3d[%s]" + Log(1, gUnknown_8116664, gCurrentMap,gUnknown_2039A32, + gGroundConversion_811BAF4[gCurrentMap].text); + } + GroundSprite_Reset(gUnknown_2039A32); + sub_809D0BC(); + DeleteBlankGroundEvents(); + DeleteBlankGroundLives(); + DeleteBlankGroundObjects(); + DeleteBlankGroundEffects(); + loc.id = tmp->dungeonIndex; + loc.floor = curCmd.argShort; + GroundMap_SelectDungeon(gUnknown_2039A32, &loc, curCmd.argByte); + GroundLink_Select(gUnknown_2039A32); + GroundLives_Select(gUnknown_2039A32,0,0); + GroundObject_Select(gUnknown_2039A32,0,0); + break; + } + case 0x0b: { + GroundWeather_Select((s16)curCmd.arg1); + break; + } + case 0x0c ... 0x15: { + s32 group; + s32 sector; + { + s32 tmp = curCmd.argShort < 0 ? scriptData->script.group : curCmd.argShort; + group = tmp; + } + { + s32 tmp = (s8)curCmd.argByte < 0 ? scriptData->script.sector : (s8)curCmd.argByte; + sector = tmp; + } + switch (curCmd.op) { + case 0x0c: { + GroundLives_Select(gUnknown_2039A32, group, sector); + GroundObject_Select(gUnknown_2039A32, group, sector); + GroundEffect_Select(gUnknown_2039A32, group, sector); + GroundEvent_Select(gUnknown_2039A32, group, sector); + break; + } + case 0x0d: { + GroundLives_Select(gUnknown_2039A32, group, sector); + break; + } + case 0x0e: { + GroundObject_Select(gUnknown_2039A32, group, sector); + break; + } + case 0x0f: { + GroundEffect_Select(gUnknown_2039A32, group, sector); + break; + } + case 0x10: { + GroundEvent_Select(gUnknown_2039A32, group, sector); + break; + } + case 0x11: { + GroundLives_Cancel(group, sector); + GroundObject_Cancel(group, sector); + GroundEffect_Cancel(group, sector); + GroundEvent_Cancel(group, sector); + break; + } + case 0x12: { + GroundLives_Cancel(group, sector); + break; + } + case 0x13: { + GroundObject_Cancel(group, sector); + break; + } + case 0x14: { + GroundEffect_Cancel(group, sector); + break; + } + case 0x15: { + GroundEvent_Cancel(group, sector); + break; + } + } + break; + } + case 0x16: { + GroundLives_CancelBlank_1(); + break; + } + case 0x17: { + GroundObject_CancelBlank(); + break; + } + case 0x18: { + GroundEffect_CancelBlank(); + break; + } + case 0x19: { + s8 unk[4]; + GroundObjectData *obj; + Position32 pos; + s16 res; + s32 group; + s32 sector; + action->callbacks->func14(action->parentObject, unk); + obj = ({ GroundObjectData obj = { + .unk1 = *unk, + .widthTiles = 1, + .heightTiles = 1, + .pos = {.raw = 0}, + .kind = curCmd.arg2, + .scripts = { [3] = gFunctionScriptTable[curCmd.arg1].script }, + }; + group = curCmd.argShort < 0 ? scriptData->script.group : curCmd.argShort; + sector = (s8)curCmd.argByte < 0 ? scriptData->script.sector : (s8)curCmd.argByte; + &obj; + }); + res = GroundObject_Add(-1, obj, group, sector); + if (res >= 0) { + action->callbacks->func0C(action->parentObject, &pos); + sub_80AC49C(res, &pos); + } + break; + } + case 0x1a: { + s8 unk; + GroundEffectData *eff; + Position32 pos; + s16 res; + s32 group; + s32 sector; + action->callbacks->func14(action->parentObject, &unk); + eff = ({ GroundEffectData eff = { + .unk1 = unk, + .widthTiles = 1, + .heightTiles = 1, + .pos = {.raw = 0}, + .kind = curCmd.arg2, + .script = gFunctionScriptTable[curCmd.arg1].script, + }; + group = curCmd.argShort < 0 ? scriptData->script.group : curCmd.argShort; + sector = (s8)curCmd.argByte < 0 ? scriptData->script.sector : (s8)curCmd.argByte; + &eff; + }); + res = GroundEffect_Add(-1, eff, group, sector); + if (res >= 0) { + action->callbacks->func0C(action->parentObject, &pos); + sub_80AD3B4(res, &pos); + } + break; + } + case 0x1c: { + GroundMap_ExecuteEvent(curCmd.argShort, 1); + break; + } + case 0x1b: { + GroundMap_ExecuteEvent(curCmd.argShort, 0); + break; + } + case 0x1d: case 0x1e: { + s32 map; + s32 group, sector; + bool8 res; + { + s32 tmp = curCmd.arg1 != -1 ? (s16)curCmd.arg1 : gCurrentMap; + map = tmp; + } + { + s32 tmp = curCmd.argShort < 0 ? scriptData->script.group : curCmd.argShort; + group = tmp; + } + { + s32 tmp = (s8)curCmd.argByte < 0 ? scriptData->script.sector : (s8)curCmd.argByte; + sector = tmp; + } + map = sub_80A4D7C(map); + res = curCmd.op == 0x1e; + GroundMap_ExecuteStation(map, group, sector, res); + if (gUnknown_2039A34 != map) { + gUnknown_2039A34 = map; + sub_809D940(); + if (action->unk8[0] != 0) + return 4; // Fatal? + } + break; + } + case 0x1f: { + s32 a = (s16)sub_8001658(0, 19); + const DungeonInfo *ret1 = sub_80A2608(a); + s32 thing = sub_8001784(0, 48, a) == 0 ? ret1->unk6 : ret1->unk8; + //s32 as = a; + //if (!(a >= 0x37 && a < 0x48) && (s16)sub_80A2750(a) == 1) { + // fakematch lmao + if (!((u16)(a - 0x37) < 0x11) && (s16)sub_80A2750(a) == 1) { + if (thing == -1) { + if (ScriptLoggingEnabled(TRUE)) { + // " dungeon rescue select %3d" + Log(1, gUnknown_8116684, a); + } + GroundMainRescueRequest(a, -1); + } else { + GroundMap_ExecuteEvent(thing, 0); + break; + } + } else { + GroundMainRescueRequest(a, -1); + } + break; + } + case 0x20: { + switch (action->unkC.arr[0]) { + case 0: + GroundMap_ExecuteEvent(curCmd.argShort, 0); + break; + case 1: { + ScriptInfoSmall info1; + sub_809D710(action, &info1, curCmd.argShort); + GroundLives_ExecuteScript(action->unkC.arr[1], action->unk8, &info1); + break; + } + case 2: { + ScriptInfoSmall info2; + sub_809D710(action, &info2, curCmd.argShort); + GroundObject_ExecuteScript(action->unkC.arr[1], action->unk8, &info2); + break; + } + case 3: { + ScriptInfoSmall info3; + sub_809D710(action, &info3, curCmd.argShort); + GroundEffect_ExecuteScript(action->unkC.arr[1], action->unk8, &info3); + break; + } + } + break; + } + case 0x21: { + s32 ret; + s32 unk; + Position32 pos1; + Position32 pos2; + Position32 pos3; + Position32 pos4; + s32 tmp; + ret = (s16)sub_80A7AE8((s16)curCmd.arg1); + if (ret >= 0) { + sub_80A8BD8(ret, &unk); + if (unk & 0x200) { + action->callbacks->func0C(action->parentObject, &pos1); + action->callbacks->func08(action->parentObject, &pos2); + sub_80A8FD8(ret, &pos3); + sub_80A8F9C(ret, &pos4); + if ((tmp = (s8)sub_8002DF0(&pos3, &pos4, &pos1, &pos2)) != -1 || + (tmp = (s8)sub_8002D54(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC)) != -1) { + sub_80A9090(ret, tmp); + } + } + GroundLives_ExecutePlayerScriptActionLives(action->unk8[1], ret); + return 3; + } + break; + } + case 0x22: { + sub_80999E8(curCmd.argShort); + if (curCmd.argByte) return 2; + break; + } + case 0x23: { + sub_80999FC(curCmd.argShort); + if (curCmd.argByte) return 2; + break; + } + case 0x24: { + sub_8099A10(curCmd.argShort, (u16)curCmd.arg1, (u16)curCmd.arg2); + if (curCmd.argByte) return 2; + break; + } + case 0x25: { + sub_8099A34(curCmd.argShort); + if (curCmd.argByte) return 2; + break; + } + case 0x26: { + sub_8099A48(curCmd.argShort); + if (curCmd.argByte) return 2; + break; + } + case 0x27: case 0x28: { + //s8 color[4]; + // THANK YOU pidgey, only an array *inside* a struct works + s32 color = ({ + struct color { u8 arr[4]; } color = {{ + curCmd.arg2 >> 16, + curCmd.arg2 >> 8, + curCmd.arg2, + 0, + }}; + *(s32*)&color; + }); + //u32 raw; + //raw = *(u32*)color; + switch (curCmd.op) { + case 0x27: + sub_8099A5C(curCmd.argShort, curCmd.arg1, color); + break; + case 0x28: + sub_8099AFC(curCmd.argShort, curCmd.arg1, color); + break; + } + if (curCmd.argByte) return 2; + break; + } + case 0x29: { + sub_809A6E4((u16)curCmd.argShort); + break; + } + case 0x2a: { + sub_809A6F8((u16)curCmd.argShort); + break; + } + case 0x2b: { + sub_809A738(curCmd.arg1, curCmd.arg2); + break; + } + case 0x2c: { + if (!(s8)sub_809A768()) break; + sub_80A87AC(0, 10); + if ((s8)sub_809D8EC(action, 0)) return 2; + break; + } + case 0x30: { + ScriptPrintNullTextbox(); + break; + } + case 0x31: { + ScriptPrintEmptyTextbox(); + break; + } + case 0x2d: { + switch ((u8)curCmd.argByte) { + case 0: { + sub_809A83C(curCmd.argShort); + break; + } + case 1: { + sub_80A2500(curCmd.argShort, action->unk8); + break; + } + case 2: { + sub_80A2500(curCmd.argShort, action->unkC.arr); + break; + } + case 3: { + struct {s16 unk0; s16 unk2;} unk; + unk.unk2 = sub_80A7AE8((s16)curCmd.arg1); + unk.unk0 = 1; + sub_80A2500(curCmd.argShort, (void*)&unk); + break; + } + case 4: { + sub_80A252C(curCmd.argShort, action->unk8); + break; + } + case 5: { + sub_80A252C(curCmd.argShort, action->unkC.arr); + break; + } + case 6: { + struct {s16 unk0; s16 unk2;} unk; + s16 res = sub_80A7AE8((s16)curCmd.arg1); + unk.unk2 = res; + if (unk.unk2 >= 0) { + unk.unk0 = 1; + sub_80A252C(curCmd.argShort, (void*)&unk); + } else { + sub_80A2584(curCmd.argShort, (s16)curCmd.arg1); + } + break; + } + case 7: { + sub_80A2558(curCmd.argShort, action->unk8); + break; + } + case 8: { + sub_80A2558(curCmd.argShort, action->unkC.arr); + break; + } + case 9: { + struct {s16 unk0; s16 unk2;} unk; + s16 res = sub_80A7AE8((s16)curCmd.arg1); + unk.unk2 = res; + if (unk.unk2 >= 0) { + unk.unk0 = 1; + sub_80A2558(curCmd.argShort, (void*)&unk); + } else { + sub_80A2598(curCmd.argShort, (s16)curCmd.arg1); + } + break; + } + case 10: { + u8 a = sub_80A2740((s16)curCmd.arg1); + s32 o = 0; + switch ((s16)curCmd.arg1) { + case 0: o = 1; break; + case 2: o = -1; break; + } + gFormatData_202DE30[curCmd.argShort] = GetDungeonFloorCount(a) + o; + break; + } + } + break; + } + case 0x2e: { + sub_809AC7C(curCmd.argShort, (s8)curCmd.arg1, (u8)curCmd.argByte); + break; + } + case 0x2f: { + s32 unk[2]; + unk[0] = curCmd.arg1; + unk[1] = curCmd.arg2; + sub_809ADD8(curCmd.argShort, unk); + break; + } + case 0x32 ... 0x38: { + s8 ret = 0; + switch (scriptData->curScriptOp) { + case 0x32: ret = ScriptPrintText(0, curCmd.argShort, curCmd.argPtr); break; + case 0x33: ret = ScriptPrintText(1, curCmd.argShort, curCmd.argPtr); break; + case 0x34: ret = ScriptPrintText(2, curCmd.argShort, curCmd.argPtr); break; + case 0x35: ret = ScriptPrintText(3, curCmd.argShort, curCmd.argPtr); break; + case 0x36: ret = ScriptPrintText(4, curCmd.argShort, curCmd.argPtr); break; + case 0x37: ret = sub_809AEEC(curCmd.argPtr); break; + case 0x38: ret = sub_809AF2C(curCmd.argPtr); break; + } + if (ret) { + sub_80A87AC(0, 10); + if ((s8)sub_809D8EC(action, 0)) return 2; + } + break; + } + case 0x39: { + if ((s8)sub_809AF6C(curCmd.argShort, curCmd.argPtr) && curCmd.argShort >= 0) { + sub_80A87AC(0, 10); + if ((s8)sub_809D8EC(action, 0)) return 2; + } + break; + } + case 0x3a: { + sub_809AFC8((u8)curCmd.argByte > 0, curCmd.arg1, (s16)curCmd.arg2, curCmd.argPtr); + if ((s8)sub_809D8EC(action, 1)) { + sub_80A87AC(0, 11); + return 2; + } + break; + } + case 0x3c: { + sub_809B1D4(curCmd.argByte, curCmd.arg1, curCmd.arg2, curCmd.argPtr); + sub_80A87AC(0, 11); + return 2; + } + case 0x3b: { + scriptData->unk2A = 0; + return 2; + } + case 0x3d: { + struct { u8 pad[0x4c]; u8 unk4C[10]; } *unk; // unknown struct + int i; + if ((s16)curCmd.arg1 != -1) { + unk = (void*)sub_80A8D54(curCmd.arg1); + if (unk) { + for (i = 0; i < 10; i++) { + gUnknown_2039D98[i] = unk->unk4C[i]; + } + gUnknown_2039D98[10] = 0; + sub_809B1C0(4, 0, gUnknown_2039D98); + sub_80A87AC(0, 11); + return 2; + } + break; + } else { + sub_809B1C0(4, 1, gUnknown_2039D98); + sub_80A87AC(0, 11); + return 2; + } + } + case 0x3e: { + sub_80920B8(gUnknown_2039D98); + gUnknown_2039D98[10] = 0; + sub_809B1C0(5, 0, gUnknown_2039D98); + sub_80A87AC(0, 11); + return 2; + } + case 0x3f: { + int i; + for (i = 0; i < 12; i++) { + gUnknown_2039D98[i] = 0; + } + sub_809B1C0(6, (u8)curCmd.argByte, gUnknown_2039D98); + sub_80A87AC(0, 11); + return 2; + } + case 0x42: { + StopAllMusic_1(); + break; + } + case 0x43: { + FadeOutAllMusic(curCmd.argShort < 0 ? 30 : (u16)curCmd.argShort); + break; + } + case 0x44: { + u16 id = curCmd.argByte == 0 ? sub_80A25AC((u16)curCmd.arg1) : curCmd.arg1; + if (id != 999) { + xxx_call_start_new_bgm((u16)id); + } else { + xxx_call_stop_bgm(); + } + break; + } + case 0x45: { + u16 id = curCmd.argByte == 0 ? sub_80A25AC((u16)curCmd.arg1) : curCmd.arg1; + if (id != 999) { + xxx_call_fade_in_new_bgm((u16)id, (u16)curCmd.argShort); //sub_8011900 + } else { + xxx_call_stop_bgm(); + } + break; + } + case 0x46: { + u16 id = curCmd.argByte == 0 ? sub_80A25AC((u16)curCmd.arg1) : curCmd.arg1; + if (id != 999) { + xxx_call_queue_bgm((u16)id); + } + break; + } + case 0x47: { + xxx_call_stop_bgm(); + break; + } + case 0x48: { + xxx_call_fade_out_bgm(curCmd.argShort < 0 ? 30 : (u16)curCmd.argShort); + break; + } + case 0x49: case 0x4c: { + xxx_call_play_fanfare_se((u16)curCmd.arg1, 256); + break; + } + case 0x4a: case 0x4d: { + xxx_call_stop_fanfare_se((u16)curCmd.arg1); + break; + } + case 0x4b: case 0x4e: { + xxx_call_fade_out_fanfare_se((u16)curCmd.arg1, curCmd.argShort < 0 ? 30 : (u16)curCmd.argShort); + break; + } + case 0x4f: { + if (action->scriptData2.state == 1) { + InitScriptData(&action->scriptData2); + } + action->callbacks->func1C(action->parentObject, 0); + break; + } + case 0x50: { + Action *ptr; + Position32 pos; + s8 c; + { + Action *tmp = (Action*)sub_809D52C(action->unkC.arr); + ptr = tmp; + } + if (ptr) { + ptr->callbacks->func0C(action->parentObject, &pos); + ptr->callbacks->func14(action->parentObject, &c); + action->callbacks->func24(action->parentObject, &pos); + action->scriptData.unk26 = c; + action->callbacks->func2C(action->parentObject, c); + } + break; + } + case 0x51: { + Position32 posIn; + Position32 posOut1; + Position32 posOut2; + action->callbacks->func0C(action->parentObject, &posIn); + sub_80AD914(curCmd.argShort, &posOut1, &posOut2, &posIn); + action->callbacks->func20(action->parentObject, &posOut1, &posOut2); + break; + } + case 0x52: { + action->callbacks->func3C(action->parentObject, curCmd.arg1); + break; + } + case 0x53: { + if (curCmd.arg1 & 0x400 && action->scriptData2.state == 1) { + InitScriptData(&action->scriptData2); + } + action->callbacks->func40(action->parentObject, curCmd.arg1); + break; + } + case 0x54: { + action->callbacks->func14(action->parentObject, &action->scriptData.unk26); + if (curCmd.argShort) { + action->scriptData.unk24 = curCmd.argShort; + } + action->callbacks->func30(action->parentObject, (u16)curCmd.argShort); + break; + } + case 0x55: { + action->callbacks->func34(action->parentObject, (u16)curCmd.argShort); + break; + } + case 0x56: { + action->callbacks->func38(action->parentObject, (s16)curCmd.arg1, curCmd.argShort); + break; + } + case 0x57: { + action->callbacks->func44(action->parentObject, curCmd.argShort); + break; + } + case 0x58: { + u32 unk[2]; + unk[0] = curCmd.arg1 << 8; + unk[1] = curCmd.arg2 << 8; + action->callbacks->func24(action->parentObject, unk); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x59: { + u32 unk[2]; + unk[0] = curCmd.argShort << 8; + unk[1] = curCmd.arg1 << 8; + action->callbacks->func48(action->parentObject, unk); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x5a: { + u32 unk[2]; + unk[0] = OtherRandInt(curCmd.argShort) << 8; + unk[1] = OtherRandInt(curCmd.arg1) << 8; + action->callbacks->func48(action->parentObject, unk); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x5b: { + Position32 unk; + action->callbacks->func0C(action->parentObject, &unk); + sub_80AD8B4((s16)curCmd.arg1, &unk); + action->callbacks->func24(action->parentObject, &unk); //FIXME: landing end of unwanted tailmerge + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x5c: { + Position32 pos, pos1, pos2; + action->callbacks->func0C(action->parentObject, &pos); + sub_80AD914((s16)curCmd.arg1, &pos1, &pos2, &pos); + pos.x = pos1.x + OtherRandInt(pos2.x - pos1.x); + pos.y = pos1.y + OtherRandInt(pos2.y - pos1.y); + action->callbacks->func24(action->parentObject, &pos); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x5d: { + Position32 unk; + s16 res = sub_80A7AE8((s16)curCmd.arg1); + if (res >= 0) { + sub_80A8FD8(res, &unk); + action->callbacks->func24(action->parentObject, &unk); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + break; + } + case 0x5e: { + Position32 pos; + s32 height; + s32 dir; + pos.x = sub_8001784(0, 0x32, (u16)curCmd.arg1); // POSITION_X + pos.y = sub_8001784(0, 0x33, (u16)curCmd.arg1); // POSITION_Y + height = sub_8001784(0, 0x34, (u16)curCmd.arg1); // POSITION_HEIGHT + dir = (s8)sub_8001784(0, 0x35, (u16)curCmd.arg1); // POSITION_DIRECTION + action->callbacks->func24(action->parentObject, &pos); + action->callbacks->func28(action->parentObject, height); + action->scriptData.unk26 = dir; + action->callbacks->func2C(action->parentObject, dir); + // FIXME: unwanted tailmerge +#ifndef NONNMATCHING + asm(""); +#endif + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x5f: { + Position32 pos; + u32 height; + u32 wat; + s8 dir; + action->callbacks->func0C(action->parentObject, &pos); + action->callbacks->func10(action->parentObject, &height, &wat); + action->callbacks->func14(action->parentObject, &dir); + sub_800199C(0, 0x32, (u16)curCmd.arg1, pos.x); + sub_800199C(0, 0x33, (u16)curCmd.arg1, pos.y); + sub_800199C(0, 0x34, (u16)curCmd.arg1, height); + sub_800199C(0, 0x35, (u16)curCmd.arg1, dir); + break; + } + case 0x60: { + action->callbacks->func28(action->parentObject, curCmd.arg1 << 8); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x61: case 0x69: { + scriptData->pos2.x = curCmd.arg1 << 8; + scriptData->pos2.y = curCmd.arg2 << 8; + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = -1; + return 2; + } + case 0x62: case 0x6a: { + u32 pos[2]; + action->callbacks->func0C(action->parentObject, pos); + scriptData->pos2.x = pos[0] + (curCmd.arg1 << 8); + scriptData->pos2.y = pos[1] + (curCmd.arg2 << 8); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = -1; + return 2; + } + case 0x63: case 0x6b: { + action->callbacks->func0C(action->parentObject, &scriptData->pos2); + sub_80AD8B4((s16)curCmd.arg1, &scriptData->pos2); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = -1; + return 2; + } + case 0x64: case 0x6c: { + action->callbacks->func0C(action->parentObject, &scriptData->pos2); + sub_80AD8B4((s16)curCmd.arg1, &scriptData->pos2); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x65: case 0x6d: { + action->callbacks->func0C(action->parentObject, &scriptData->pos2); + sub_80AD8B4((s16)curCmd.arg1, &scriptData->pos2); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = OtherRandInt((u8)curCmd.argByte); + return 2; + } + case 0x66: case 0x67: case 0x6e: case 0x6f: { + s16 ret = sub_80A7AE8((s16)curCmd.arg1); + if (ret >= 0) { + sub_80A8FD8(ret, &scriptData->pos2); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + break; + } + case 0x71: case 0x77: case 0x7d: case 0x83: { + action->callbacks->func0C(action->parentObject, &scriptData->pos1); + scriptData->pos2.x = curCmd.arg1 << 8; + scriptData->pos2.y = curCmd.arg2 << 8; + if (curCmd.op == 0x7d || curCmd.op == 0x83) { + scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort; + if (scriptData->unk2A <= 0) scriptData->unk2A = 1; + } else { + scriptData->unk2A = curCmd.argShort; + } + return 2; + } + case 0x72: case 0x78: case 0x7e: case 0x84: { + action->callbacks->func0C(action->parentObject, &scriptData->pos1); + scriptData->pos2.x = scriptData->pos1.x + (curCmd.arg1 << 8); + scriptData->pos2.y = scriptData->pos1.y + (curCmd.arg2 << 8); + if (curCmd.op == 0x7e || curCmd.op == 0x84) { + scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort; + if (scriptData->unk2A <= 0) scriptData->unk2A = 1; + } else { + scriptData->unk2A = curCmd.argShort; + } + return 2; + } + case 0x73: case 0x79: case 0x7f: case 0x85: { + s32 cap1 = curCmd.arg1 * 2 - 1; + s32 cap2 = curCmd.arg2 * 2 - 1; + action->callbacks->func0C(action->parentObject, &scriptData->pos1); + scriptData->pos2.x = scriptData->pos1.x + ((OtherRandInt(cap1) - curCmd.argShort) << 8); + scriptData->pos2.y = scriptData->pos1.y + ((OtherRandInt(cap2) - curCmd.arg1) << 8); + if (curCmd.op == 0x7f || curCmd.op == 0x85) { + scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort; + if (scriptData->unk2A <= 0) scriptData->unk2A = 1; + } else { + scriptData->unk2A = curCmd.argShort; + } + return 2; + } + case 0x74: case 0x7a: case 0x80: case 0x86: { + action->callbacks->func0C(action->parentObject, &scriptData->pos1); + scriptData->pos2 = scriptData->pos1; + sub_80AD8B4((s16)curCmd.arg1, &scriptData->pos2); + if (curCmd.op == 0x80 || curCmd.op == 0x86) { + scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort; + if (scriptData->unk2A <= 0) scriptData->unk2A = 1; + } else { + scriptData->unk2A = curCmd.argShort; + } + return 2; + } + case 0x75: case 0x7b: case 0x81: case 0x87: { + s32 cap = curCmd.arg1 * 2 - 1; + action->callbacks->func0C(action->parentObject, &scriptData->pos2); + sub_80AD8B4((s16)curCmd.arg2, &scriptData->pos2); + scriptData->pos2.x = scriptData->pos2.x + ((OtherRandInt(cap) - curCmd.argShort) << 8); + scriptData->pos2.y = scriptData->pos2.y + ((OtherRandInt(cap) - curCmd.argShort) << 8); + if (curCmd.op == 0x81 || curCmd.op == 0x87) { + scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort; + if (scriptData->unk2A <= 0) scriptData->unk2A = 1; + } else { + scriptData->unk2A = curCmd.argShort; + } + return 2; + } + case 0x76: case 0x7c: case 0x82: case 0x88: { + s16 ret = sub_80A7AE8((s16)curCmd.arg1); + if (ret >= 0) { + action->callbacks->func0C(action->parentObject, &scriptData->pos1); + sub_80A8FD8(ret, &scriptData->pos2); + if (curCmd.op == 0x82 || curCmd.op == 0x88) { + scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort; + if (scriptData->unk2A <= 0) scriptData->unk2A = 1; + } else { + scriptData->unk2A = curCmd.argShort; + } + return 2; + } + break; + } + case 0x68: case 0x70: { + scriptData->unk48 = curCmd.arg1 << 8; + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = -1; + return 2; + } + case 0x89: { + action->scriptData.unk26 = curCmd.arg1; + action->callbacks->func2C(action->parentObject, (s8) curCmd.arg1); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x8a: { + s8 dir; + action->callbacks->func14(action->parentObject, &dir); + action->scriptData.unk26 = sub_8002984(dir, (s8)curCmd.arg1); + action->callbacks->func2C(action->parentObject, action->scriptData.unk26); + scriptData->unk30 = curCmd.argShort; + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x8b: { + action->scriptData.unk26 = curCmd.argShort; + action->callbacks->func2C(action->parentObject, action->scriptData.unk26); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x8c: { + int ret = (s16)sub_80A7AE8((s16)curCmd.arg1); + s8 dir; + if (ret >= 0) { + sub_80A9050(ret, &dir); + action->scriptData.unk26 = sub_8002984(dir, curCmd.argShort); + action->callbacks->func2C(action->parentObject, action->scriptData.unk26); + } + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x8d: { + s8 dir; + action->callbacks->func14(action->parentObject, &dir); + action->scriptData.unk26 = sub_8002984(dir, curCmd.argShort); + action->callbacks->func2C(action->parentObject, action->scriptData.unk26); + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x8e: case 0x8f: case 0x90: { + bool8 flag = FALSE; + s8 dir; + Position32 pos1, pos2, pos3, pos4; + switch (curCmd.op) { + case 0x8e: { + s32 val = (s16)sub_80A7AE8((s16)curCmd.arg1); + if (val >= 0) { + flag = TRUE; + sub_80A8FD8(val, &pos1); + sub_80A8F9C(val, &pos2); + } + break; + } + case 0x8f: { + s32 val = (s16)sub_80A7AE8((s16)curCmd.arg1); + if (val >= 0) { + flag = TRUE; + sub_80A8FD8(val, &pos1); + pos2 = gUnknown_81164DC; + } + break; + } + case 0x90: { + flag = TRUE; + action->callbacks->func0C(action->parentObject, &pos1); + action->callbacks->func08(action->parentObject, &pos2); + sub_80AD8B4((s16)curCmd.arg1, &pos1); + break; + } + } + if (flag) { + s8 ret; + int tmp; + action->callbacks->func0C(action->parentObject, &pos3); + action->callbacks->func08(action->parentObject, &pos4); + ret = sub_8002DF0(&pos3, &pos4, &pos1, &pos2); // wtf + *&dir = ret; + + tmp = -1; // This feels like a fakematch... + if (dir == tmp) { + dir = sub_8002D54(&pos3, &gUnknown_81164DC, &pos1, &gUnknown_81164DC); + } + if (dir == tmp) { + action->callbacks->func14(action->parentObject, &dir); + } + action->scriptData.unk26 = sub_8002984(dir, (s8)curCmd.argShort); + action->callbacks->func2C(action->parentObject, action->scriptData.unk26); + } + scriptData->unk2A = (u8)curCmd.argByte; + return 2; + } + case 0x93: case 0x94: case 0x95: { + scriptData->unk2A = 0; + return 2; + } + case 0x91: { + action->scriptData.unk4D = (s8)curCmd.arg1; + scriptData->unk2A = 0; + return 2; + } + case 0x92: { + s8 unk; + action->callbacks->func14(action->parentObject, &unk); + action->scriptData.unk4D = sub_8002984(unk, (s8)curCmd.arg1); + scriptData->unk2A = 0; + return 2; + } + case 0x97: { + sub_809D124(curCmd.argShort, curCmd.arg1, curCmd.arg2); + break; + } + case 0x98: { + s32 id = action->callbacks->func04(action->parentObject); + switch(action->unk8[0]) { + case 1: + sub_809D170(1, id); + break; + case 2: + sub_809D170(2, id); + break; + case 3: + sub_809D170(3, id); + break; + } + break; + } + case 0x99: { + s32 id = action->callbacks->func04(action->parentObject); + Position32 unk; + switch(action->unk8[0]) { + case 1: + sub_80A8FD8(id, &unk); + sub_809D158(0, &unk); + break; + case 2: + sub_80AC448(id, &unk); + sub_809D158(0, &unk); + break; + case 3: + sub_80AD360(id, &unk); + sub_809D158(0, &unk); + break; + } + break; + } + case 0x9a: { + sub_809D170(1, 0); + break; + } + case 0x9b: { + s32 id = action->callbacks->func04(action->parentObject); + if (id < 0) break; + switch(action->unk8[0]) { + case 1: + sub_809D1A8(1, id, curCmd.argShort); + return 2; + case 2: + sub_809D1A8(2, id, curCmd.argShort); + return 2; + case 3: + sub_809D1A8(3, id, curCmd.argShort); + return 2; + } + break; + } + case 0x9c: { + s32 id = action->callbacks->func04(action->parentObject); + Position32 unk; + switch(action->unk8[0]) { + case 1: + sub_80A8FD8(id, &unk); + sub_809D190(0, &unk, curCmd.argShort); + return 2; + case 2: + sub_80AC448(id, &unk); + sub_809D190(0, &unk, curCmd.argShort); + return 2; + case 3: + sub_80AD360(id, &unk); + sub_809D190(0, &unk, curCmd.argShort); + return 2; + } + break; + } + case 0x9d: { + sub_809D1A8(1, 0, curCmd.argShort); + return 2; + } + case 0x9e: { + s32 id = action->callbacks->func04(action->parentObject); + if (id < 0) break; + switch(action->unk8[0]) { + case 1: + sub_809D1E4(1, id, curCmd.argShort); + return 2; + case 2: + sub_809D1E4(2, id, curCmd.argShort); + return 2; + case 3: + sub_809D1E4(3, id, curCmd.argShort); + return 2; + } + break; + } + case 0x9f: { + s32 id = action->callbacks->func04(action->parentObject); + Position32 unk; + switch(action->unk8[0]) { + case 1: + sub_80A8FD8(id, &unk); + sub_809D1CC(0, &unk, curCmd.argShort); + return 2; + case 2: + sub_80AC448(id, &unk); + sub_809D1CC(0, &unk, curCmd.argShort); + return 2; + case 3: + sub_80AD360(id, &unk); + sub_809D1CC(0, &unk, curCmd.argShort); + return 2; + } + break; + } + case 0xa0: { + sub_809D1E4(1, 0, curCmd.argShort); + return 2; + } + case 0xa1: { + s32 id = action->callbacks->func04(action->parentObject); + if (id < 0) break; + switch(action->unk8[0]) { + case 1: + sub_809D220(1, id, curCmd.argShort); + return 2; + case 2: + sub_809D220(2, id, curCmd.argShort); + return 2; + case 3: + sub_809D220(3, id, curCmd.argShort); + return 2; + } + break; + } + case 0xa2: { + s32 id = action->callbacks->func04(action->parentObject); + Position32 unk; + switch(action->unk8[0]) { + case 1: + sub_80A8FD8(id, &unk); + sub_809D208(0, &unk, curCmd.argShort); + return 2; + case 2: + sub_80AC448(id, &unk); + sub_809D208(0, &unk, curCmd.argShort); + return 2; + case 3: + sub_80AD360(id, &unk); + sub_809D208(0, &unk, curCmd.argShort); + return 2; + } + break; + } + case 0xa3: { + sub_809D220(1, 0, curCmd.argShort); + return 2; + } + case 0xa4: { + sub_8001570(scriptData->unk50[0].arr, curCmd.argShort); + break; + } + case 0xa5: { + sub_80015C0(scriptData->unk50[0].arr, curCmd.argShort); + break; + } + case 0xa6: { + sub_800226C(scriptData->unk50[0].arr, curCmd.argShort, curCmd.arg1, curCmd.argByte); + break; + } + case 0xa7: { + sub_80022A0(scriptData->unk50[0].arr, curCmd.argShort, (s16)curCmd.arg1, curCmd.argByte); + break; + } + case 0xa8: { + sub_800199C(scriptData->unk50[0].arr, curCmd.argShort, (u16)curCmd.arg1, curCmd.arg2); + break; + } + case 0xa9: { + ScenarioCalc(curCmd.argShort, curCmd.arg1, curCmd.arg2); + break; + } + case 0xaa: { + s32 a, b; + sub_8001B88(curCmd.argShort, &a, &b); + ScenarioCalc(curCmd.argShort, a, b+1); + break; + } + case 0xab: { + sub_80018D8(0, 19, curCmd.arg1); + sub_80018D8(0, 22, curCmd.argShort); + break; + } + case 0xac: { + sub_80018D8(0, 28, curCmd.argShort); + break; + } + case 0xad: { + sub_80026E8(curCmd.argShort, (u8)curCmd.argByte > 0); + break; + } + case 0xae: { + sub_809733C(curCmd.argShort, (u8)curCmd.argByte > 0); + break; + } + case 0xaf: { + sub_80973A8(curCmd.argShort, (u8)curCmd.argByte > 0); + break; + } + case 0xb0: { + sub_8097418(curCmd.argShort, (u8)curCmd.argByte > 0); + break; + } + case 0xb1: { + sub_80975A8(curCmd.argShort, (u8)curCmd.argByte > 0); + break; + } + case 0xb2: { + sub_80976F8(curCmd.argShort); + break; + } + case 0xb3: { + if ((u8)sub_80022F8(0, curCmd.argShort, curCmd.arg1, 2)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xb4: { + if ((s8)sub_80022F8(scriptData->unk50, (s16)curCmd.arg1, curCmd.arg2, (u8)curCmd.argByte)) { + scriptData->script.ptr = sub_80A242C(action, curCmd.argShort); + } + break; + } + case 0xb5: { + if ((s8)sub_8002318(scriptData->unk50, (s16)curCmd.arg1, (s16)curCmd.arg2, (u8)curCmd.argByte)) { + scriptData->script.ptr = sub_80A242C(action, curCmd.argShort); + } + break; + } + case 0xb6: { + if (sub_8001784(scriptData->unk50, (s16)curCmd.arg1, (u16)curCmd.arg2)) { + scriptData->script.ptr = sub_80A242C(action, curCmd.argShort); + } + break; + } + case 0xb7: { + if ((s8)FlagJudge(sub_8001AB0(scriptData->unk50, (s16)curCmd.arg1), curCmd.arg2, (u8)curCmd.argByte)) { + scriptData->script.ptr = sub_80A242C(action, curCmd.argShort); + } + break; + } + case 0xb8: { + if ((s8)sub_8001CC4(curCmd.argShort, curCmd.arg1, curCmd.arg2)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xb9: { + if ((s8)sub_8001D08(curCmd.argShort, curCmd.arg1, curCmd.arg2)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xba: { + if ((s8)sub_8001D44(curCmd.argShort, curCmd.arg1, curCmd.arg2)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xbb: { + if ((s8)sub_80023E4(curCmd.argShort)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xbc: { + if ((s8)sub_8098100((u8)curCmd.argShort)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xbd: { + if ((s8)sub_80026CC((s16)curCmd.arg1)) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xbf: { + if (sub_809CBA4(curCmd.argShort) > 0) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + break; + } + case 0xbe: { + if (action->unk8[0] == 1) { + if ((s8)sub_80A8C98(action->unk8[1])) { + scriptData->script.ptr = sub_80A242C(action, (u8)curCmd.argByte); + } + } + break; + } + case 0x41: { + if (FindItemInInventory((u8)curCmd.argShort) >= 0) ShiftItemsDownFrom(); + break; + } + case 0xc0 ... 0xcb: { + s32 val; + Position32 pos, pos2, pos3; + switch (curCmd.op) { + case 0xc0: { + val = sub_8001658(scriptData->unk50, curCmd.argShort); + break; + } + case 0xc1: { + val = FlagCalc( + sub_8001658(scriptData->unk50, curCmd.argShort), + curCmd.arg1, + (u8)curCmd.argByte); + break; + } + case 0xc2: { + val = FlagCalc( + sub_8001658(scriptData->unk50, curCmd.argShort), + sub_8001658(scriptData->unk50, (s16)curCmd.arg1), + (u8)curCmd.argByte); + break; + } + case 0xc3: { + val = OtherRandInt(curCmd.argShort); + break; + } + case 0xc4: { + val = sub_8001784(0, curCmd.argShort, 0); + break; + } + case 0xc5: { + val = sub_8001784(0, curCmd.argShort, 1); + break; + } + case 0xc6: { + val = (s16)sub_80A8C2C((s16)curCmd.arg1); + break; + } + case 0xc7: { + s8 dir; + action->callbacks->func14(action->parentObject, &dir); + val = dir; + break; + } + case 0xca: { + action->callbacks->func0C(action->parentObject, &pos); + pos2 = pos; + sub_80AD8B4((s16)curCmd.arg1, &pos2); + pos3.x = pos2.x - pos.x; + pos3.y = pos2.y - pos.y; + val = (s8)sub_8002C60(&pos3); + break; + } + case 0xc8: { + s16 tmp = (s16)sub_80A7AE8((s16)curCmd.arg1); + if (tmp >= 0) { + Position32 pos1, pos2, pos3, pos4; + action->callbacks->func0C(action->parentObject, &pos1); + action->callbacks->func08(action->parentObject, &pos2); + sub_80A8FD8(tmp, &pos3); + sub_80A8F9C(tmp, &pos4); + val = (s8)sub_8002DF0(&pos1, &pos2, &pos3, &pos4); + if (val == -1) { + val = (s8)sub_8002D54(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC); + } + } else { + val = -1; + } + break; + } + case 0xc9: { + s16 tmp = (s16)sub_80A7AE8((s16)curCmd.arg1); + if (tmp >= 0) { // ??? + Position32 pos1, pos2, pos3; + action->callbacks->func0C(action->parentObject, &pos1); + action->callbacks->func08(action->parentObject, &pos2); + sub_80A8FD8(tmp, &pos3); + val = (s8)sub_8002DF0(&pos1, &pos2, &pos3, &gUnknown_81164DC); + if (val == -1) { + val = (s8)sub_8002D54(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC); + } + } else { + val = -1; + } + break; + } + case 0xcb: { + val = sub_809CC90(curCmd.argShort); + break; + } + default: { + // The locdata says this is part of an inlined function... :/ + // "switch type error %d" + FatalError(&gUnknown_81166B4, gUnknown_81166C0, curCmd.op); + } + } + scriptData->script.ptr = sub_80A2460(action, val); + break; + } + case 0xcf: { + scriptData->branchDiscriminant = sub_8001658(scriptData->unk50, curCmd.argShort); + while (scriptData->script.ptr->op == 0xd0) { + if (scriptData->script.ptr->argShort == scriptData->branchDiscriminant) + return 2; + scriptData->script.ptr++; + } + if (scriptData->script.ptr->op == 0xd1) { + scriptData->branchDiscriminant = -1; + return 2; + } + break; + } + case 0xd2 ... 0xd8: { + char *out = curCmd.argPtr; + gUnknown_203B4AC = 0; + scriptData->branchDiscriminant = 0; + switch(curCmd.op) { + case 0xd6: case 0xd7: case 0xd8: { + s32 disc = sub_8001658(scriptData->unk50, (s16)curCmd.arg2); + for (; scriptData->script.ptr->op == 0xd0; scriptData->script.ptr++, scriptData->branchDiscriminant++) { + if (scriptData->script.ptr->argShort == disc) + out = scriptData->script.ptr->argPtr; + } + for (; scriptData->script.ptr->op == 0xd1; scriptData->script.ptr++, scriptData->branchDiscriminant++) { + if (!out) out = scriptData->script.ptr->argPtr; + } + } + } + if (!out) out = gUnknown_81166D8; // "" + for (; scriptData->script.ptr->op == 0xd9; scriptData->script.ptr++) { + gUnknown_2039D50[gUnknown_203B4AC].unk0 = scriptData->script.ptr->argPtr; + gUnknown_2039D50[gUnknown_203B4AC].unk4 = gUnknown_203B4AC + 1; + gUnknown_203B4AC++; + } + if (gUnknown_203B4AC <= 0) break; + gUnknown_2039D50[gUnknown_203B4AC].unk0 = NULL; + gUnknown_2039D50[gUnknown_203B4AC].unk4 = curCmd.argShort; + switch (curCmd.op) { + case 0xd2: case 0xd3: case 0xd6: { + sub_809B028(gUnknown_2039D50, (u8)curCmd.argByte > 0, -1, 0, (s16)curCmd.arg1, out); + break; + } + case 0xd4: case 0xd7: { + sub_809B028(gUnknown_2039D50, (u8)curCmd.argByte > 0, -1, 1, (s16)curCmd.arg1, out); + break; + } + case 0xd5: case 0xd8: { + sub_809B028(gUnknown_2039D50, (u8)curCmd.argByte > 0, -1, 2, (s16)curCmd.arg1, out); + break; + } + } + if ((s8)sub_809D8EC(action, 1)) { + sub_80A87AC(0, 11); + return 2; + } + break; + } + case 0xda: { + if (sub_809D8EC(action, 1)) { + return 2; + } + break; + } + case 0xdb: { + scriptData->unk2A = curCmd.argShort; + return 2; + } + case 0xdc: { + scriptData->unk2A = curCmd.argShort + OtherRandInt(curCmd.arg1 - curCmd.argShort); + return 2; + } + case 0xdd ... 0xe2: { + return 2; // do action + } + case 0xe3: { + scriptData->branchDiscriminant = curCmd.argShort; + if (sub_809D8EC(action, curCmd.argShort)) { + return 2; + } + break; + } + case 0xe4: { + sub_809D9B8(curCmd.argShort); + break; + } + case 0xe5: { + scriptData->branchDiscriminant = curCmd.argShort; + if ((s8)sub_809DA08(action, curCmd.argShort, curCmd.argByte)) { + return 2; + } + break; + } + case 0xe6: { + scriptData->savedScript = scriptData->script; + } //fallthrough + case 0xe7: { // ??? + scriptData->script.ptr = sub_80A242C(action, curCmd.argShort); + break; + } + case 0xe8: { // SAVE_AND_TRIGGER + scriptData->savedScript = scriptData->script; + } // fallthrough + case 0xe9: { // TRIGGER + scriptData->script.ptr2 = scriptData->script.ptr = gFunctionScriptTable[curCmd.argShort].script; + break; + } + case 0xea: { // SAVE_AND_RUN_STATION + scriptData->savedScript = scriptData->script; + } // fallthrough + case 0xeb: { // RUN_STATION + ScriptInfoSmall info; + u32 group, sector; + u32 tmp = gUnknown_2039A34; + { + s32 tmp = curCmd.argShort < 0 ? scriptData->script.group : curCmd.argShort; + group = tmp; + } + { + s32 tmp = (s8)curCmd.argByte < 0 ? scriptData->script.sector : (s8)curCmd.argByte; + sector = tmp; + } + GroundMap_GetStationScript(&info, tmp, group, sector); + scriptData->script.ptr = info.ptr; + scriptData->script.ptr2 = info.ptr; + scriptData->script.group = group; + scriptData->script.sector = sector; + break; + } + case 0xec: { + gUnknown_2039A34 = sub_80A4D7C((s16)sub_8001658(scriptData->unk50, curCmd.argShort)); + sub_809D940(); + GroundMap_ExecuteEnter(gUnknown_2039A34); + break; + } + case 0xed: { // DELETE_SAVED + scriptData->savedScript.ptr = NULL; + scriptData->savedScript.ptr2 = NULL; + break; + } + case 0xee: { // RESTORE_SAVED + if (scriptData->savedScript.ptr == NULL) { + return 0; // huh? + } + scriptData->script = scriptData->savedScript; + scriptData->savedScript.ptr = NULL; + scriptData->savedScript.ptr2 = NULL; + break; + } + case 0xef: // RETURN_FALSE + return 0; // success + case 0xf0: // RETURN_TRUE + return 1; // error? + case 0xf1: // RETURN_ERROR + return 4; // fatal error? + case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: { + // Debug, not in release ROM + break; + } + } + } +}