From 99605c850481aad865d6b7c5289b057c87fe3c75 Mon Sep 17 00:00:00 2001 From: Behemoth Date: Fri, 18 Sep 2020 18:35:25 +0200 Subject: [PATCH] decompile businessScrub --- asm/businessScrub.s | 1281 ----------------- .../businessScrub/sub_0802925C.inc | 30 + data/animations/businessScrub.s | 86 ++ data/animations/spearMoblin.s | 71 + data/data_080CC6FC.s | 162 --- include/player.h | 1 + linker.ld | 5 +- src/enemy/businessScrub.c | 608 ++++++++ 8 files changed, 800 insertions(+), 1444 deletions(-) delete mode 100644 asm/businessScrub.s create mode 100644 asm/non_matching/businessScrub/sub_0802925C.inc create mode 100644 data/animations/businessScrub.s create mode 100644 data/animations/spearMoblin.s create mode 100644 src/enemy/businessScrub.c diff --git a/asm/businessScrub.s b/asm/businessScrub.s deleted file mode 100644 index ea2a740e..00000000 --- a/asm/businessScrub.s +++ /dev/null @@ -1,1281 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start BusinessScrub -BusinessScrub: @ 0x0802890C - push {lr} - ldr r1, _08028918 @ =gUnk_080CC9C8 - bl EnemyFunctionHandler - pop {pc} - .align 2, 0 -_08028918: .4byte gUnk_080CC9C8 - - thumb_func_start sub_0802891C -sub_0802891C: @ 0x0802891C - push {lr} - ldr r2, _08028930 @ =gUnk_080CC9E0 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_08028930: .4byte gUnk_080CC9E0 - - thumb_func_start sub_08028934 -sub_08028934: @ 0x08028934 - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x3f - ldrb r0, [r0] - cmp r0, #1 - bne _08028988 - adds r0, r4, #0 - adds r0, #0x41 - ldrb r1, [r0] - movs r2, #0x7f - adds r0, r2, #0 - ands r0, r1 - cmp r0, #0x42 - bne _08028988 - movs r1, #0 - movs r0, #3 - strb r0, [r4, #0xc] - strb r1, [r4, #0xd] - movs r0, #0x28 - strb r0, [r4, #0xe] - ldrb r1, [r4, #0x10] - adds r0, r2, #0 - ands r0, r1 - strb r0, [r4, #0x10] - adds r0, r4, #0 - movs r1, #4 - bl sub_080290E0 - adds r0, r4, #0 - movs r1, #3 - movs r2, #0 - bl CreateFx - adds r1, r0, #0 - cmp r1, #0 - beq _08028982 - ldrh r0, [r1, #0x36] - subs r0, #8 - strh r0, [r1, #0x36] -_08028982: - ldr r0, _0802898C @ =0x000001BB - bl EnqueueSFX -_08028988: - pop {r4, pc} - .align 2, 0 -_0802898C: .4byte 0x000001BB - - thumb_func_start nullsub_140 -nullsub_140: @ 0x08028990 - bx lr - .align 2, 0 - - thumb_func_start sub_08028994 -sub_08028994: @ 0x08028994 - push {r4, r5, lr} - adds r4, r0, #0 - movs r0, #0 - strb r0, [r4, #0xf] - ldrh r1, [r4, #0x2e] - adds r0, r4, #0 - adds r0, #0x78 - movs r5, #0 - strh r1, [r0] - ldrh r0, [r4, #0x32] - adds r1, r4, #0 - adds r1, #0x7a - strh r0, [r1] - strb r5, [r4, #0x14] - movs r0, #0x10 - strb r0, [r4, #0x15] - adds r0, r4, #0 - bl sub_08028E9C - ldr r0, [r4, #0x7c] - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - bne _080289D4 - adds r0, r4, #0 - adds r0, #0x86 - ldrh r0, [r0] - bl CheckFlags - cmp r0, #0 - beq _080289FC -_080289D4: - movs r0, #4 - strb r0, [r4, #0xc] - movs r0, #0x78 - strb r0, [r4, #0xe] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - subs r0, #0xb1 - ands r0, r1 - movs r1, #8 - orrs r0, r1 - strb r0, [r2] - adds r0, r4, #0 - bl sub_0802925C - adds r0, r4, #0 - movs r1, #0 - bl sub_080290E0 - b _08028A42 -_080289FC: - strb r5, [r4, #0xe] - movs r0, #0x2e - ldrsh r1, [r4, r0] - ldr r2, _08028A44 @ =gRoomControls - ldrh r0, [r2, #6] - subs r1, r1, r0 - asrs r1, r1, #4 - movs r3, #0x3f - ands r1, r3 - movs r5, #0x32 - ldrsh r0, [r4, r5] - ldrh r2, [r2, #8] - subs r0, r0, r2 - asrs r0, r0, #4 - ands r0, r3 - lsls r0, r0, #6 - orrs r1, r0 - adds r0, r4, #0 - adds r0, #0x76 - strh r1, [r0] - ldrh r0, [r0] - adds r1, r4, #0 - adds r1, #0x38 - ldrb r1, [r1] - bl sub_080001DA - adds r1, r4, #0 - adds r1, #0x74 - strh r0, [r1] - subs r1, #0x34 - movs r0, #0x41 - strb r0, [r1] - adds r0, r4, #0 - bl sub_08028FFC -_08028A42: - pop {r4, r5, pc} - .align 2, 0 -_08028A44: .4byte gRoomControls - - thumb_func_start sub_08028A48 -sub_08028A48: @ 0x08028A48 - push {r4, r5, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xe] - adds r5, r0, #0 - cmp r5, #0 - beq _08028A5A - subs r0, #1 - strb r0, [r4, #0xe] - b _08028A72 -_08028A5A: - adds r0, r4, #0 - movs r1, #0 - bl sub_08028F98 - cmp r0, #0 - beq _08028A72 - adds r0, r4, #0 - bl sub_08029078 - strb r5, [r4, #0xd] - movs r0, #1 - strb r0, [r4, #0xf] -_08028A72: - pop {r4, r5, pc} - - thumb_func_start sub_08028A74 -sub_08028A74: @ 0x08028A74 - push {r4, r5, r6, lr} - adds r4, r0, #0 - bl GetNextFrame - ldrb r0, [r4, #0xd] - cmp r0, #4 - bls _08028A84 - b _08028BA6 -_08028A84: - lsls r0, r0, #2 - ldr r1, _08028A90 @ =_08028A94 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08028A90: .4byte _08028A94 -_08028A94: @ jump table - .4byte _08028AA8 @ case 0 - .4byte _08028ACA @ case 1 - .4byte _08028B1A @ case 2 - .4byte _08028B54 @ case 3 - .4byte _08028B76 @ case 4 -_08028AA8: - movs r6, #1 - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08028BA6 - strb r6, [r4, #0xd] - movs r0, #0x3c - strb r0, [r4, #0xe] - movs r0, #0x10 - strb r0, [r4, #0xf] - adds r0, r4, #0 - bl sub_08028FDC - b _08028B6C -_08028ACA: - movs r6, #1 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - movs r2, #0xff - lsls r0, r0, #0x18 - lsrs r1, r0, #0x18 - cmp r1, #0 - bne _08028AF6 - movs r0, #2 - strb r0, [r4, #0xd] - movs r0, #0x20 - strb r0, [r4, #0xe] - strb r1, [r4, #0xf] - adds r0, r4, #0 - bl sub_08028FDC - adds r0, r4, #0 - movs r1, #2 - bl sub_080290E0 - b _08028BA6 -_08028AF6: - ldrb r0, [r4, #0xf] - subs r0, #1 - strb r0, [r4, #0xf] - ands r0, r2 - cmp r0, #0 - bne _08028BA6 - adds r0, r4, #0 - bl sub_08028FDC - cmp r0, #0 - beq _08028B14 - adds r0, r4, #0 - movs r1, #1 - bl sub_080290E0 -_08028B14: - movs r0, #0x10 - strb r0, [r4, #0xf] - b _08028BA6 -_08028B1A: - movs r6, #1 - adds r0, r4, #0 - bl sub_080290FC - adds r5, r4, #0 - adds r5, #0x5a - ldrb r1, [r5] - adds r0, r6, #0 - ands r0, r1 - cmp r0, #0 - beq _08028BA6 - adds r0, r4, #0 - movs r1, #4 - movs r2, #0 - bl sub_0804A98C - adds r1, r0, #0 - cmp r1, #0 - beq _08028BA6 - str r4, [r1, #0x50] - ldrb r0, [r4, #0x15] - strb r0, [r1, #0x15] - ldrb r1, [r5] - movs r0, #0xfe - ands r0, r1 - strb r0, [r5] - movs r0, #3 - strb r0, [r4, #0xd] - b _08028BA6 -_08028B54: - movs r6, #2 - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08028BA6 - movs r0, #4 - strb r0, [r4, #0xd] - movs r0, #0x50 - strb r0, [r4, #0xe] -_08028B6C: - adds r0, r4, #0 - movs r1, #1 - bl sub_080290E0 - b _08028BA6 -_08028B76: - movs r6, #2 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08028BA6 - adds r0, r4, #0 - movs r1, #0 - bl sub_08028F98 - adds r5, r0, #0 - cmp r5, #0 - beq _08028BB4 - movs r0, #1 - strb r0, [r4, #0xd] - movs r0, #0x3c - strb r0, [r4, #0xe] - movs r0, #0x10 - strb r0, [r4, #0xf] - adds r0, r4, #0 - bl sub_08028FDC - b _08028BC2 -_08028BA6: - adds r0, r4, #0 - adds r1, r6, #0 - bl sub_08028F98 - adds r5, r0, #0 - cmp r5, #0 - bne _08028BC2 -_08028BB4: - adds r0, r4, #0 - bl sub_08028FFC - strb r5, [r4, #0xd] - movs r0, #0x50 - strb r0, [r4, #0xe] - strb r5, [r4, #0xf] -_08028BC2: - pop {r4, r5, r6, pc} - - thumb_func_start sub_08028BC4 -sub_08028BC4: @ 0x08028BC4 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xd] - cmp r0, #0 - beq _08028BD4 - cmp r0, #1 - beq _08028C14 - b _08028C76 -_08028BD4: - ldrb r0, [r4, #0xe] - cmp r0, #0 - bne _08028C0E - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08028C76 - movs r0, #1 - strb r0, [r4, #0xd] - adds r0, r4, #0 - bl sub_08028FDC - adds r0, r4, #0 - movs r1, #5 - bl sub_080290E0 - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #0x39 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #8 - orrs r0, r1 - strb r0, [r2] - b _08028C76 -_08028C0E: - subs r0, #1 - strb r0, [r4, #0xe] - b _08028C76 -_08028C14: - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08028C76 - movs r1, #0 - movs r0, #4 - strb r0, [r4, #0xc] - strb r1, [r4, #0xd] - movs r0, #0x1e - strb r0, [r4, #0xe] - movs r0, #5 - strb r0, [r4, #0xf] - adds r0, r4, #0 - bl sub_080290E0 - adds r0, r4, #0 - movs r1, #0x1c - bl sub_0804A9FC - adds r2, r0, #0 - cmp r2, #0 - beq _08028C66 - adds r3, r2, #0 - adds r3, #0x29 - ldrb r1, [r3] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #3 - orrs r0, r1 - strb r0, [r3] - ldrh r0, [r2, #0x36] - subs r0, #0xc - strh r0, [r2, #0x36] - adds r0, r2, #0 - movs r1, #2 - bl sub_0805E3A0 -_08028C66: - adds r0, r4, #0 - adds r0, #0x86 - ldrh r0, [r0] - bl SetFlag - adds r0, r4, #0 - bl sub_0802925C -_08028C76: - adds r0, r4, #0 - bl GetNextFrame - adds r0, r4, #0 - bl sub_0800445C - pop {r4, pc} - - thumb_func_start sub_08028C84 -sub_08028C84: @ 0x08028C84 - push {r4, r5, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - movs r1, #0xff - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08028CD2 - movs r0, #0x30 - strb r0, [r4, #0xe] - ldrb r0, [r4, #0xf] - adds r5, r0, #0 - cmp r5, #0 - beq _08028CB4 - subs r0, #1 - strb r0, [r4, #0xf] - ands r0, r1 - cmp r0, #0 - bne _08028CD2 - adds r0, r4, #0 - bl sub_0804AA1C - b _08028CD2 -_08028CB4: - adds r0, r4, #0 - bl sub_08028FDC - adds r1, r4, #0 - adds r1, #0x80 - cmp r0, #0 - bne _08028CC8 - ldrb r0, [r1] - cmp r0, #0 - beq _08028CD2 -_08028CC8: - strb r5, [r1] - adds r0, r4, #0 - movs r1, #0 - bl sub_080290E0 -_08028CD2: - adds r0, r4, #0 - bl GetNextFrame - adds r0, r4, #0 - bl sub_0800445C - adds r0, r4, #0 - bl sub_08028F0C - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_08028CE8 -sub_08028CE8: @ 0x08028CE8 - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - ldr r6, [r5, #0x7c] - ldr r0, _08028D30 @ =gTextBox - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - cmp r0, #0 - bne _08028DCC - adds r0, r5, #0 - bl sub_0802915C - cmp r0, #0 - beq _08028DCC - bl sub_08056338 - cmp r0, #0 - bne _08028DCC - ldr r0, _08028D34 @ =gUnk_02002A40 - adds r0, #0xc0 - ldrh r1, [r6, #2] - ldrh r0, [r0] - cmp r1, r0 - bhi _08028DC0 - adds r0, r5, #0 - bl sub_080291DC - cmp r0, #0 - beq _08028D3C - ldr r0, _08028D38 @ =0x00002904 - bl TextboxNoOverlapFollow - movs r0, #0 - bl sub_08078A90 - b _08028DCC - .align 2, 0 -_08028D30: .4byte gTextBox -_08028D34: .4byte gUnk_02002A40 -_08028D38: .4byte 0x00002904 -_08028D3C: - ldrh r0, [r6, #2] - rsbs r0, r0, #0 - bl ModRupees - ldrb r0, [r6] - lsrs r7, r0, #2 - cmp r7, #1 - beq _08028D9C - cmp r7, #1 - bgt _08028D56 - cmp r7, #0 - beq _08028D5C - b _08028DCC -_08028D56: - cmp r7, #2 - beq _08028DAA - b _08028DCC -_08028D5C: - ldrb r1, [r6, #9] - cmp r1, #0xff - bne _08028D70 - ldr r4, _08028D98 @ =gUnk_080CC9C0 - bl Random - movs r1, #7 - ands r1, r0 - adds r1, r1, r4 - ldrb r1, [r1] -_08028D70: - ldrb r0, [r6, #8] - movs r2, #0 - bl CreateItemEntity - movs r0, #6 - strb r0, [r5, #0xc] - movs r0, #4 - strb r0, [r5, #0xe] - adds r0, r5, #0 - adds r0, #0x81 - strb r7, [r0] - adds r0, r5, #0 - movs r1, #3 - bl sub_080290E0 - movs r0, #0x87 - bl SetLocalFlag - b _08028DE2 - .align 2, 0 -_08028D98: .4byte gUnk_080CC9C0 -_08028D9C: - ldrb r0, [r6, #8] - ldrb r1, [r6, #9] - movs r2, #0 - bl CreateItemEntity - movs r0, #4 - b _08028DB6 -_08028DAA: - ldrb r0, [r6, #8] - ldrb r1, [r6, #9] - movs r2, #0 - bl CreateItemEntity - movs r0, #8 -_08028DB6: - strb r0, [r5, #0xe] - adds r0, r5, #0 - bl sub_0802922C - b _08028DE2 -_08028DC0: - ldr r0, _08028DE4 @ =0x00002903 - bl TextboxNoOverlapFollow - movs r0, #0 - bl sub_08078A90 -_08028DCC: - adds r0, r5, #0 - bl sub_0800445C - movs r0, #4 - strb r0, [r5, #0xc] - movs r0, #0x30 - strb r0, [r5, #0xe] - adds r0, r5, #0 - movs r1, #0 - bl sub_080290E0 -_08028DE2: - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08028DE4: .4byte 0x00002903 - - thumb_func_start sub_08028DE8 -sub_08028DE8: @ 0x08028DE8 - push {r4, lr} - adds r4, r0, #0 - ldr r0, _08028E08 @ =gPlayerEntity - ldrb r0, [r0, #0xc] - cmp r0, #8 - bne _08028E0C - adds r4, #0x81 - ldrb r0, [r4] - cmp r0, #0 - bne _08028E3A - movs r0, #1 - bl sub_08078A90 - movs r0, #1 - strb r0, [r4] - b _08028E3A - .align 2, 0 -_08028E08: .4byte gPlayerEntity -_08028E0C: - ldr r0, _08028E3C @ =0x00002902 - bl TextboxNoOverlapFollow - movs r1, #0 - movs r0, #4 - strb r0, [r4, #0xc] - adds r0, r4, #0 - adds r0, #0x81 - strb r1, [r0] - movs r0, #1 - strb r0, [r4, #0xe] - adds r0, r4, #0 - bl sub_08028EDC - movs r0, #0 - bl sub_08078A90 - adds r0, r4, #0 - bl sub_0800445C - adds r0, r4, #0 - bl GetNextFrame -_08028E3A: - pop {r4, pc} - .align 2, 0 -_08028E3C: .4byte 0x00002902 - - thumb_func_start sub_08028E40 -sub_08028E40: @ 0x08028E40 - push {r4, r5, lr} - adds r4, r0, #0 - ldr r0, _08028E80 @ =gTextBox - ldrb r0, [r0] - movs r1, #0x7f - ands r1, r0 - cmp r1, #0 - bne _08028E72 - ldr r5, [r4, #0x7c] - movs r0, #4 - strb r0, [r4, #0xc] - strb r1, [r4, #0xd] - movs r0, #1 - strb r0, [r4, #0xe] - ldrh r0, [r5, #0xa] - bl CheckLocalFlag - cmp r0, #0 - bne _08028E6C - ldrh r0, [r5, #0xa] - bl SetLocalFlag -_08028E6C: - movs r0, #0 - bl sub_08078A90 -_08028E72: - adds r0, r4, #0 - bl sub_0800445C - adds r0, r4, #0 - bl GetNextFrame - pop {r4, r5, pc} - .align 2, 0 -_08028E80: .4byte gTextBox - - thumb_func_start sub_08028E84 -sub_08028E84: @ 0x08028E84 - push {r4, lr} - adds r4, r0, #0 - bl UpdateFuseInteraction - cmp r0, #0 - beq _08028E98 - movs r0, #4 - strb r0, [r4, #0xc] - movs r0, #1 - strb r0, [r4, #0xe] -_08028E98: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08028E9C -sub_08028E9C: @ 0x08028E9C - push {r4, r5, r6, lr} - adds r5, r0, #0 - ldrb r0, [r5, #0xa] - lsls r1, r0, #1 - adds r1, r1, r0 - lsls r1, r1, #2 - ldr r6, _08028ED8 @ =gUnk_080CC954 - adds r4, r1, r6 - adds r0, r4, #0 - bl sub_08029198 - cmp r0, #0 - beq _08028ECA - ldrb r1, [r4] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - beq _08028ECA - ldrh r1, [r4, #0xa] - lsls r0, r1, #1 - adds r0, r0, r1 - lsls r0, r0, #2 - adds r4, r0, r6 -_08028ECA: - str r4, [r5, #0x7c] - adds r1, r5, #0 - adds r1, #0x80 - movs r0, #0 - strb r0, [r1] - pop {r4, r5, r6, pc} - .align 2, 0 -_08028ED8: .4byte gUnk_080CC954 - - thumb_func_start sub_08028EDC -sub_08028EDC: @ 0x08028EDC - push {r4, r5, lr} - adds r5, r0, #0 - ldr r4, [r5, #0x7c] - adds r0, r4, #0 - bl sub_08029198 - cmp r0, #0 - beq _08028F04 - ldrb r1, [r4] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - beq _08028F04 - ldrh r0, [r4, #0xa] - lsls r1, r0, #1 - adds r1, r1, r0 - lsls r1, r1, #2 - ldr r0, _08028F08 @ =gUnk_080CC954 - adds r4, r1, r0 - str r4, [r5, #0x7c] -_08028F04: - pop {r4, r5, pc} - .align 2, 0 -_08028F08: .4byte gUnk_080CC954 - - thumb_func_start sub_08028F0C -sub_08028F0C: @ 0x08028F0C - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r2, r5, #0 - adds r2, #0x39 - movs r0, #0 - ldrsb r0, [r2, r0] - cmp r0, #2 - bne _08028F2C - movs r1, #0 - movs r0, #8 - strb r0, [r5, #0xc] - strb r1, [r2] - adds r0, r5, #0 - bl sub_0806F118 - b _08028F90 -_08028F2C: - cmp r0, #0 - beq _08028F90 - ldr r6, [r5, #0x7c] - movs r4, #0 - strb r4, [r2] - adds r0, r5, #0 - bl sub_0804AA1C - adds r0, r5, #0 - bl GetAnimationState - lsls r0, r0, #3 - strb r0, [r5, #0x15] - adds r0, r5, #0 - movs r1, #3 - bl sub_080290E0 - adds r1, r5, #0 - adds r1, #0x80 - movs r0, #1 - strb r0, [r1] - movs r0, #0x20 - strb r0, [r5, #0xe] - strb r4, [r5, #0xf] - adds r0, r6, #0 - bl sub_08029198 - cmp r0, #0 - beq _08028F6A - ldrh r4, [r6, #6] - b _08028F84 -_08028F6A: - ldrb r1, [r6] - movs r0, #0xfc - ands r0, r1 - cmp r0, #0xc - beq _08028F78 - movs r0, #5 - b _08028F7A -_08028F78: - movs r0, #7 -_08028F7A: - strb r0, [r5, #0xc] - ldrh r4, [r6, #4] - movs r0, #1 - bl sub_08078A90 -_08028F84: - adds r0, r4, #0 - bl TextboxNoOverlapFollow - ldr r1, _08028F94 @ =gTextBox - ldrh r0, [r6, #2] - str r0, [r1, #0x10] -_08028F90: - pop {r4, r5, r6, pc} - .align 2, 0 -_08028F94: .4byte gTextBox - - thumb_func_start sub_08028F98 -sub_08028F98: @ 0x08028F98 - push {r4, r5, r6, lr} - adds r6, r0, #0 - adds r5, r1, #0 - movs r0, #1 - bl sub_08049DF4 - adds r4, r0, #0 - cmp r4, #0 - beq _08028FD4 - adds r0, r6, #0 - adds r1, r4, #0 - movs r2, #0x28 - movs r3, #0x28 - bl sub_080041A0 - cmp r0, #0 - bne _08028FD4 - cmp r5, #2 - beq _08028FD8 - movs r3, #0x50 - cmp r5, #0 - beq _08028FC6 - movs r3, #0x58 -_08028FC6: - adds r0, r6, #0 - adds r1, r4, #0 - adds r2, r3, #0 - bl sub_080041A0 - cmp r0, #0 - bne _08028FD8 -_08028FD4: - movs r0, #0 - b _08028FDA -_08028FD8: - movs r0, #1 -_08028FDA: - pop {r4, r5, r6, pc} - - thumb_func_start sub_08028FDC -sub_08028FDC: @ 0x08028FDC - push {r4, lr} - adds r4, r0, #0 - movs r1, #1 - bl sub_08049F84 - adds r1, r0, #4 - movs r0, #0x18 - ands r1, r0 - ldrb r0, [r4, #0x15] - cmp r1, r0 - beq _08028FF8 - strb r1, [r4, #0x15] - movs r0, #1 - b _08028FFA -_08028FF8: - movs r0, #0 -_08028FFA: - pop {r4, pc} - - thumb_func_start sub_08028FFC -sub_08028FFC: @ 0x08028FFC - push {r4, lr} - adds r4, r0, #0 - movs r0, #1 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r4, #0x10] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #0x39 - rsbs r0, r0, #0 - ands r0, r1 - strb r0, [r2] - adds r0, r4, #0 - bl sub_080AE068 - adds r0, r4, #0 - bl UnloadOBJPalette - adds r1, r4, #0 - adds r1, #0x60 - movs r0, #0xe8 - strh r0, [r1] - ldrb r1, [r4, #0x1a] - subs r0, #0xf8 - ands r0, r1 - movs r1, #2 - orrs r0, r1 - movs r1, #0xf - ands r0, r1 - movs r1, #0x20 - orrs r0, r1 - strb r0, [r4, #0x1a] - movs r0, #0xa7 - strh r0, [r4, #0x12] - adds r0, r4, #0 - adds r0, #0x78 - ldrh r0, [r0] - strh r0, [r4, #0x2e] - adds r0, r4, #0 - adds r0, #0x7a - ldrh r0, [r0] - strh r0, [r4, #0x32] - adds r0, r4, #0 - movs r1, #0 - bl InitializeAnimation - ldr r0, _08029074 @ =0x00004022 - adds r1, r4, #0 - adds r1, #0x76 - ldrh r1, [r1] - adds r2, r4, #0 - adds r2, #0x38 - ldrb r2, [r2] - bl SetTile - pop {r4, pc} - .align 2, 0 -_08029074: .4byte 0x00004022 - - thumb_func_start sub_08029078 -sub_08029078: @ 0x08029078 - push {r4, lr} - adds r4, r0, #0 - movs r0, #2 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0x10] - movs r0, #0x80 - orrs r0, r1 - strb r0, [r4, #0x10] - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #0x39 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #8 - orrs r0, r1 - strb r0, [r2] - adds r0, r4, #0 - movs r1, #0x72 - bl LoadFixedGFX - cmp r0, #0 - bne _080290AE - adds r0, r4, #0 - bl DeleteEntity - b _080290DE -_080290AE: - adds r0, r4, #0 - movs r1, #0x6e - bl sub_0801D040 - movs r0, #0xd0 - strh r0, [r4, #0x12] - adds r0, r4, #0 - bl sub_08028FDC - adds r0, r4, #0 - movs r1, #1 - bl sub_080290E0 - adds r0, r4, #0 - adds r0, #0x74 - ldrh r0, [r0] - adds r1, r4, #0 - adds r1, #0x76 - ldrh r1, [r1] - adds r2, r4, #0 - adds r2, #0x38 - ldrb r2, [r2] - bl SetTile -_080290DE: - pop {r4, pc} - - thumb_func_start sub_080290E0 -sub_080290E0: @ 0x080290E0 - push {lr} - adds r3, r1, #0 - ldrb r1, [r0, #0x15] - lsrs r1, r1, #3 - ldr r2, _080290F8 @ =gUnk_080CCA04 - adds r3, r3, r2 - ldrb r2, [r3] - orrs r1, r2 - bl InitializeAnimation - pop {pc} - .align 2, 0 -_080290F8: .4byte gUnk_080CCA04 - - thumb_func_start sub_080290FC -sub_080290FC: @ 0x080290FC - push {r4, r5, lr} - adds r2, r0, #0 - ldrb r0, [r2, #0xe] - cmp r0, #0 - beq _08029158 - subs r1, r0, #1 - strb r1, [r2, #0xe] - lsls r0, r1, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0xf - bhi _08029158 - movs r0, #1 - ands r0, r1 - cmp r0, #0 - bne _08029158 - ldrb r4, [r2, #0x15] - movs r0, #0x10 - ands r0, r4 - movs r5, #1 - cmp r0, #0 - beq _08029128 - subs r5, #2 -_08029128: - movs r3, #8 - adds r0, r3, #0 - ands r0, r4 - cmp r0, #0 - beq _08029146 - movs r4, #0x2e - ldrsh r0, [r2, r4] - ands r1, r3 - cmp r1, #0 - beq _08029140 - subs r0, r0, r5 - b _08029142 -_08029140: - adds r0, r0, r5 -_08029142: - strh r0, [r2, #0x2e] - b _08029158 -_08029146: - movs r4, #0x32 - ldrsh r0, [r2, r4] - ands r1, r3 - cmp r1, #0 - bne _08029154 - subs r0, r0, r5 - b _08029156 -_08029154: - adds r0, r0, r5 -_08029156: - strh r0, [r2, #0x32] -_08029158: - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_0802915C -sub_0802915C: @ 0x0802915C - push {lr} - ldr r0, [r0, #0x7c] - ldrb r0, [r0, #8] - cmp r0, #0x5c - beq _08029190 - cmp r0, #0x5c - bgt _08029174 - cmp r0, #0x1c - beq _08029186 - cmp r0, #0x44 - beq _0802917E - b _08029194 -_08029174: - cmp r0, #0x6c - beq _08029190 - cmp r0, #0x6f - beq _08029190 - b _08029194 -_0802917E: - movs r0, #0x44 - bl GetInventoryValue - b _0802918C -_08029186: - movs r0, #0x5a - bl CheckGlobalFlag -_0802918C: - cmp r0, #0 - bne _08029194 -_08029190: - movs r0, #1 - b _08029196 -_08029194: - movs r0, #0 -_08029196: - pop {pc} - - thumb_func_start sub_08029198 -sub_08029198: @ 0x08029198 - push {lr} - adds r2, r0, #0 - ldrb r1, [r2] - movs r0, #0xfc - ands r0, r1 - cmp r0, #0xc - beq _080291CA - ldrb r0, [r2, #8] - cmp r0, #0x1c - beq _080291BC - cmp r0, #0x1c - bgt _080291B6 - cmp r0, #9 - beq _080291C4 - b _080291D8 -_080291B6: - cmp r0, #0x44 - beq _080291C4 - b _080291D8 -_080291BC: - movs r0, #0x5a - bl CheckGlobalFlag - b _080291D0 -_080291C4: - bl GetInventoryValue - b _080291D0 -_080291CA: - ldrh r0, [r2, #0xa] - bl CheckLocalFlag -_080291D0: - cmp r0, #0 - beq _080291D8 - movs r0, #1 - b _080291DA -_080291D8: - movs r0, #0 -_080291DA: - pop {pc} - - thumb_func_start sub_080291DC -sub_080291DC: @ 0x080291DC - push {lr} - ldr r0, [r0, #0x7c] - ldrb r0, [r0, #8] - cmp r0, #0x6c - beq _080291EC - cmp r0, #0x6f - beq _08029204 - b _08029228 -_080291EC: - ldr r2, _080291FC @ =gBombBagSizes - ldr r1, _08029200 @ =gUnk_02002A40 - adds r0, r1, #0 - adds r0, #0xae - ldrb r0, [r0] - adds r0, r0, r2 - adds r1, #0xac - b _08029212 - .align 2, 0 -_080291FC: .4byte gBombBagSizes -_08029200: .4byte gUnk_02002A40 -_08029204: - ldr r2, _08029220 @ =gQuiverSizes - ldr r1, _08029224 @ =gUnk_02002A40 - adds r0, r1, #0 - adds r0, #0xaf - ldrb r0, [r0] - adds r0, r0, r2 - adds r1, #0xad -_08029212: - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bhi _08029228 - movs r0, #1 - b _0802922A - .align 2, 0 -_08029220: .4byte gQuiverSizes -_08029224: .4byte gUnk_02002A40 -_08029228: - movs r0, #0 -_0802922A: - pop {pc} - - thumb_func_start sub_0802922C -sub_0802922C: @ 0x0802922C - push {r4, lr} - adds r4, r0, #0 - movs r0, #0 - movs r1, #6 - strb r1, [r4, #0xc] - adds r1, r4, #0 - adds r1, #0x81 - strb r0, [r1] - ldr r0, [r4, #0x7c] - ldrb r0, [r0, #8] - cmp r0, #0x6c - beq _08029252 - cmp r0, #0x6c - bgt _08029252 - cmp r0, #0x1c - bne _08029252 - movs r0, #0x5a - bl SetGlobalFlag -_08029252: - adds r0, r4, #0 - movs r1, #3 - bl sub_080290E0 - pop {r4, pc} - - thumb_func_start sub_0802925C -sub_0802925C: @ 0x0802925C - push {r4, lr} - adds r4, r0, #0 - bl sub_0801E99C - adds r1, r0, #0 - adds r0, r4, #0 - bl sub_08078784 - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08029270 -sub_08029270: @ 0x08029270 - push {lr} - adds r2, r0, #0 - ldrb r0, [r2, #0xc] - cmp r0, #0 - bne _08029296 - adds r0, #1 - strb r0, [r2, #0xc] - ldrb r1, [r2, #0x18] - movs r0, #4 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #1 - orrs r0, r1 - strb r0, [r2, #0x18] - adds r0, r2, #0 - movs r1, #0xe - bl InitializeAnimation - b _0802929C -_08029296: - adds r0, r2, #0 - bl GetNextFrame -_0802929C: - pop {pc} - .align 2, 0 \ No newline at end of file diff --git a/asm/non_matching/businessScrub/sub_0802925C.inc b/asm/non_matching/businessScrub/sub_0802925C.inc new file mode 100644 index 00000000..d7598d7c --- /dev/null +++ b/asm/non_matching/businessScrub/sub_0802925C.inc @@ -0,0 +1,30 @@ + + .syntax unified + + .text + + push {r4, lr} + adds r4, r0, #0 + movs r0, #0 + movs r1, #6 + strb r1, [r4, #0xc] + adds r1, r4, #0 + adds r1, #0x81 + strb r0, [r1] + ldr r0, [r4, #0x7c] + ldrb r0, [r0, #8] + cmp r0, #0x6c + beq _08029252 + cmp r0, #0x6c + bgt _08029252 + cmp r0, #0x1c + bne _08029252 + movs r0, #0x5a + bl SetGlobalFlag +_08029252: + adds r0, r4, #0 + movs r1, #3 + bl sub_080290E0 + pop {r4, pc} + + .syntax divided diff --git a/data/animations/businessScrub.s b/data/animations/businessScrub.s new file mode 100644 index 00000000..58686a0b --- /dev/null +++ b/data/animations/businessScrub.s @@ -0,0 +1,86 @@ + + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CCA0A:: @ 080CCA0A + .incbin "baserom.gba", 0x0CCA0A, 0x0000015 + +gUnk_080CCA1F:: @ 080CCA1F + .incbin "baserom.gba", 0x0CCA1F, 0x0000015 + +gUnk_080CCA34:: @ 080CCA34 + .incbin "baserom.gba", 0x0CCA34, 0x0000015 + +gUnk_080CCA49:: @ 080CCA49 + .incbin "baserom.gba", 0x0CCA49, 0x0000015 + +gUnk_080CCA5E:: @ 080CCA5E + .incbin "baserom.gba", 0x0CCA5E, 0x0000011 + +gUnk_080CCA6F:: @ 080CCA6F + .incbin "baserom.gba", 0x0CCA6F, 0x0000011 + +gUnk_080CCA80:: @ 080CCA80 + .incbin "baserom.gba", 0x0CCA80, 0x0000011 + +gUnk_080CCA91:: @ 080CCA91 + .incbin "baserom.gba", 0x0CCA91, 0x0000011 + +gUnk_080CCAA2:: @ 080CCAA2 + .incbin "baserom.gba", 0x0CCAA2, 0x0000005 + +gUnk_080CCAA7:: @ 080CCAA7 + .incbin "baserom.gba", 0x0CCAA7, 0x0000005 + +gUnk_080CCAAC:: @ 080CCAAC + .incbin "baserom.gba", 0x0CCAAC, 0x0000005 + +gUnk_080CCAB1:: @ 080CCAB1 + .incbin "baserom.gba", 0x0CCAB1, 0x0000005 + +gUnk_080CCAB6:: @ 080CCAB6 + .incbin "baserom.gba", 0x0CCAB6, 0x0000010 + +gUnk_080CCAC6:: @ 080CCAC6 + .incbin "baserom.gba", 0x0CCAC6, 0x0000010 + +gUnk_080CCAD6:: @ 080CCAD6 + .incbin "baserom.gba", 0x0CCAD6, 0x0000010 + +gUnk_080CCAE6:: @ 080CCAE6 + .incbin "baserom.gba", 0x0CCAE6, 0x0000010 + +gUnk_080CCAF6:: @ 080CCAF6 + .incbin "baserom.gba", 0x0CCAF6, 0x0000011 + +gUnk_080CCB07:: @ 080CCB07 + .incbin "baserom.gba", 0x0CCB07, 0x0000011 + +gUnk_080CCB18:: @ 080CCB18 + .incbin "baserom.gba", 0x0CCB18, 0x0000011 + +gUnk_080CCB29:: @ 080CCB29 + .incbin "baserom.gba", 0x0CCB29, 0x0000011 + +gUnk_080CCB3A:: @ 080CCB3A + .incbin "baserom.gba", 0x0CCB3A, 0x000000D + +gUnk_080CCB47:: @ 080CCB47 + .incbin "baserom.gba", 0x0CCB47, 0x000000D + +gUnk_080CCB54:: @ 080CCB54 + .incbin "baserom.gba", 0x0CCB54, 0x000000D + +gUnk_080CCB61:: @ 080CCB61 + .incbin "baserom.gba", 0x0CCB61, 0x000000D + +gUnk_080CCB6E:: @ 080CCB6E + .incbin "baserom.gba", 0x0CCB6E, 0x0000011 + +gUnk_080CCB7F:: @ 080CCB7F + .incbin "baserom.gba", 0x0CCB7F, 0x0000015 + +gUnk_080CCB94:: @ 080CCB94 + .incbin "baserom.gba", 0x0CCB94, 0x000006C diff --git a/data/animations/spearMoblin.s b/data/animations/spearMoblin.s new file mode 100644 index 00000000..e77931a1 --- /dev/null +++ b/data/animations/spearMoblin.s @@ -0,0 +1,71 @@ + + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + +gUnk_080CC7E0:: @ 080CC7E0 + .incbin "baserom.gba", 0x0CC7E0, 0x0000009 + +gUnk_080CC7E9:: @ 080CC7E9 + .incbin "baserom.gba", 0x0CC7E9, 0x0000009 + +gUnk_080CC7F2:: @ 080CC7F2 + .incbin "baserom.gba", 0x0CC7F2, 0x0000009 + +gUnk_080CC7FB:: @ 080CC7FB + .incbin "baserom.gba", 0x0CC7FB, 0x0000009 + +gUnk_080CC804:: @ 080CC804 + .incbin "baserom.gba", 0x0CC804, 0x0000011 + +gUnk_080CC815:: @ 080CC815 + .incbin "baserom.gba", 0x0CC815, 0x0000011 + +gUnk_080CC826:: @ 080CC826 + .incbin "baserom.gba", 0x0CC826, 0x0000011 + +gUnk_080CC837:: @ 080CC837 + .incbin "baserom.gba", 0x0CC837, 0x0000011 + +gUnk_080CC848:: @ 080CC848 + .incbin "baserom.gba", 0x0CC848, 0x0000011 + +gUnk_080CC859:: @ 080CC859 + .incbin "baserom.gba", 0x0CC859, 0x0000011 + +gUnk_080CC86A:: @ 080CC86A + .incbin "baserom.gba", 0x0CC86A, 0x0000011 + +gUnk_080CC87B:: @ 080CC87B + .incbin "baserom.gba", 0x0CC87B, 0x0000011 + +gUnk_080CC88C:: @ 080CC88C + .incbin "baserom.gba", 0x0CC88C, 0x0000015 + +gUnk_080CC8A1:: @ 080CC8A1 + .incbin "baserom.gba", 0x0CC8A1, 0x0000015 + +gUnk_080CC8B6:: @ 080CC8B6 + .incbin "baserom.gba", 0x0CC8B6, 0x0000015 + +gUnk_080CC8CB:: @ 080CC8CB + .incbin "baserom.gba", 0x0CC8CB, 0x0000015 + +gUnk_080CC8E0:: @ 080CC8E0 + .incbin "baserom.gba", 0x0CC8E0, 0x0000044 + +gUnk_080CC924:: @ 080CC924 + .incbin "baserom.gba", 0x0CC924, 0x0000008 + +gUnk_080CC92C:: @ 080CC92C + .incbin "baserom.gba", 0x0CC92C, 0x0000008 + +gUnk_080CC934:: @ 080CC934 + .incbin "baserom.gba", 0x0CC934, 0x0000008 + +gUnk_080CC93C:: @ 080CC93C + .incbin "baserom.gba", 0x0CC93C, 0x0000008 + +gUnk_080CC944:: @ 080CC944 + .incbin "baserom.gba", 0x0CC944, 0x0000010 diff --git a/data/data_080CC6FC.s b/data/data_080CC6FC.s index f79fbcee..7ea93e02 100644 --- a/data/data_080CC6FC.s +++ b/data/data_080CC6FC.s @@ -3,168 +3,6 @@ .section .rodata -gUnk_080CC7E0:: @ 080CC7E0 - .incbin "baserom.gba", 0x0CC7E0, 0x0000009 - -gUnk_080CC7E9:: @ 080CC7E9 - .incbin "baserom.gba", 0x0CC7E9, 0x0000009 - -gUnk_080CC7F2:: @ 080CC7F2 - .incbin "baserom.gba", 0x0CC7F2, 0x0000009 - -gUnk_080CC7FB:: @ 080CC7FB - .incbin "baserom.gba", 0x0CC7FB, 0x0000009 - -gUnk_080CC804:: @ 080CC804 - .incbin "baserom.gba", 0x0CC804, 0x0000011 - -gUnk_080CC815:: @ 080CC815 - .incbin "baserom.gba", 0x0CC815, 0x0000011 - -gUnk_080CC826:: @ 080CC826 - .incbin "baserom.gba", 0x0CC826, 0x0000011 - -gUnk_080CC837:: @ 080CC837 - .incbin "baserom.gba", 0x0CC837, 0x0000011 - -gUnk_080CC848:: @ 080CC848 - .incbin "baserom.gba", 0x0CC848, 0x0000011 - -gUnk_080CC859:: @ 080CC859 - .incbin "baserom.gba", 0x0CC859, 0x0000011 - -gUnk_080CC86A:: @ 080CC86A - .incbin "baserom.gba", 0x0CC86A, 0x0000011 - -gUnk_080CC87B:: @ 080CC87B - .incbin "baserom.gba", 0x0CC87B, 0x0000011 - -gUnk_080CC88C:: @ 080CC88C - .incbin "baserom.gba", 0x0CC88C, 0x0000015 - -gUnk_080CC8A1:: @ 080CC8A1 - .incbin "baserom.gba", 0x0CC8A1, 0x0000015 - -gUnk_080CC8B6:: @ 080CC8B6 - .incbin "baserom.gba", 0x0CC8B6, 0x0000015 - -gUnk_080CC8CB:: @ 080CC8CB - .incbin "baserom.gba", 0x0CC8CB, 0x0000015 - -gUnk_080CC8E0:: @ 080CC8E0 - .incbin "baserom.gba", 0x0CC8E0, 0x0000044 - -gUnk_080CC924:: @ 080CC924 - .incbin "baserom.gba", 0x0CC924, 0x0000008 - -gUnk_080CC92C:: @ 080CC92C - .incbin "baserom.gba", 0x0CC92C, 0x0000008 - -gUnk_080CC934:: @ 080CC934 - .incbin "baserom.gba", 0x0CC934, 0x0000008 - -gUnk_080CC93C:: @ 080CC93C - .incbin "baserom.gba", 0x0CC93C, 0x0000008 - -gUnk_080CC944:: @ 080CC944 - .incbin "baserom.gba", 0x0CC944, 0x0000010 - -gUnk_080CC954:: @ 080CC954 - .incbin "baserom.gba", 0x0CC954, 0x000006C - -gUnk_080CC9C0:: @ 080CC9C0 - .incbin "baserom.gba", 0x0CC9C0, 0x0000008 - -gUnk_080CC9C8:: @ 080CC9C8 - .incbin "baserom.gba", 0x0CC9C8, 0x0000018 - -gUnk_080CC9E0:: @ 080CC9E0 - .incbin "baserom.gba", 0x0CC9E0, 0x0000024 - -gUnk_080CCA04:: @ 080CCA04 - .incbin "baserom.gba", 0x0CCA04, 0x0000006 - -gUnk_080CCA0A:: @ 080CCA0A - .incbin "baserom.gba", 0x0CCA0A, 0x0000015 - -gUnk_080CCA1F:: @ 080CCA1F - .incbin "baserom.gba", 0x0CCA1F, 0x0000015 - -gUnk_080CCA34:: @ 080CCA34 - .incbin "baserom.gba", 0x0CCA34, 0x0000015 - -gUnk_080CCA49:: @ 080CCA49 - .incbin "baserom.gba", 0x0CCA49, 0x0000015 - -gUnk_080CCA5E:: @ 080CCA5E - .incbin "baserom.gba", 0x0CCA5E, 0x0000011 - -gUnk_080CCA6F:: @ 080CCA6F - .incbin "baserom.gba", 0x0CCA6F, 0x0000011 - -gUnk_080CCA80:: @ 080CCA80 - .incbin "baserom.gba", 0x0CCA80, 0x0000011 - -gUnk_080CCA91:: @ 080CCA91 - .incbin "baserom.gba", 0x0CCA91, 0x0000011 - -gUnk_080CCAA2:: @ 080CCAA2 - .incbin "baserom.gba", 0x0CCAA2, 0x0000005 - -gUnk_080CCAA7:: @ 080CCAA7 - .incbin "baserom.gba", 0x0CCAA7, 0x0000005 - -gUnk_080CCAAC:: @ 080CCAAC - .incbin "baserom.gba", 0x0CCAAC, 0x0000005 - -gUnk_080CCAB1:: @ 080CCAB1 - .incbin "baserom.gba", 0x0CCAB1, 0x0000005 - -gUnk_080CCAB6:: @ 080CCAB6 - .incbin "baserom.gba", 0x0CCAB6, 0x0000010 - -gUnk_080CCAC6:: @ 080CCAC6 - .incbin "baserom.gba", 0x0CCAC6, 0x0000010 - -gUnk_080CCAD6:: @ 080CCAD6 - .incbin "baserom.gba", 0x0CCAD6, 0x0000010 - -gUnk_080CCAE6:: @ 080CCAE6 - .incbin "baserom.gba", 0x0CCAE6, 0x0000010 - -gUnk_080CCAF6:: @ 080CCAF6 - .incbin "baserom.gba", 0x0CCAF6, 0x0000011 - -gUnk_080CCB07:: @ 080CCB07 - .incbin "baserom.gba", 0x0CCB07, 0x0000011 - -gUnk_080CCB18:: @ 080CCB18 - .incbin "baserom.gba", 0x0CCB18, 0x0000011 - -gUnk_080CCB29:: @ 080CCB29 - .incbin "baserom.gba", 0x0CCB29, 0x0000011 - -gUnk_080CCB3A:: @ 080CCB3A - .incbin "baserom.gba", 0x0CCB3A, 0x000000D - -gUnk_080CCB47:: @ 080CCB47 - .incbin "baserom.gba", 0x0CCB47, 0x000000D - -gUnk_080CCB54:: @ 080CCB54 - .incbin "baserom.gba", 0x0CCB54, 0x000000D - -gUnk_080CCB61:: @ 080CCB61 - .incbin "baserom.gba", 0x0CCB61, 0x000000D - -gUnk_080CCB6E:: @ 080CCB6E - .incbin "baserom.gba", 0x0CCB6E, 0x0000011 - -gUnk_080CCB7F:: @ 080CCB7F - .incbin "baserom.gba", 0x0CCB7F, 0x0000015 - -gUnk_080CCB94:: @ 080CCB94 - .incbin "baserom.gba", 0x0CCB94, 0x000006C - gUnk_080CCC00:: @ 080CCC00 .incbin "baserom.gba", 0x0CCC00, 0x0000018 diff --git a/include/player.h b/include/player.h index 488ffba4..0d604dbd 100644 --- a/include/player.h +++ b/include/player.h @@ -106,6 +106,7 @@ typedef struct { } ItemBehavior; extern u8 gBombBagSizes[]; +extern u8 gQuiverSizes[]; extern PlayerState gPlayerState; extern Stats gStats; diff --git a/linker.ld b/linker.ld index 2c3f9da5..4b1c355f 100644 --- a/linker.ld +++ b/linker.ld @@ -347,7 +347,7 @@ SECTIONS { asm/chuchuBoss.o(.text); src/enemy/likeLike.o(.text); src/enemy/spearMoblin.o(.text); - asm/businessScrub.o(.text); + src/enemy/businessScrub.o(.text); src/enemy/rupeeLike.o(.text); src/enemy/madderpillar.o(.text); asm/waterDrop.o(.text); @@ -946,6 +946,9 @@ SECTIONS { src/enemy/likeLike.o(.rodata); data/animations/likeLike.o(.rodata); src/enemy/spearMoblin.o(.rodata); + data/animations/spearMoblin.o(.rodata); + src/enemy/businessScrub.o(.rodata); + data/animations/businessScrub.o(.rodata); data/data_080CC6FC.o(.rodata); src/enemy.o(.rodata); data/data_080D3D94.o(.rodata); diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c new file mode 100644 index 00000000..924ace96 --- /dev/null +++ b/src/enemy/businessScrub.c @@ -0,0 +1,608 @@ +#include "enemy.h" +#include "entity.h" +#include "flags.h" +#include "functions.h" +#include "textbox.h" + +extern void sub_0801D040(Entity*, u32); +extern Entity* sub_08049DF4(u32); +extern bool32 sub_08056338(void); +extern void UnloadOBJPalette(Entity*); + +bool32 sub_0802915C(Entity*); +bool32 sub_080291DC(Entity*); +void sub_0802922C(Entity*); +void sub_08028E9C(Entity*); +u32 sub_080001DA(u32, u32); +void sub_08028FFC(Entity*); +void sub_0802925C(Entity*); +void sub_080290E0(Entity*, u32); +bool32 sub_08028F98(Entity*, u32); +void sub_08029078(Entity*); +bool32 sub_08028FDC(Entity*); +void sub_080290FC(Entity*); +void sub_08028EDC(Entity*); + +extern const struct SalesOffering gUnk_080CC954[]; +extern const u8 gUnk_080CC9C0[]; +extern void (*const gUnk_080CC9C8[])(Entity*); +extern void (*const gUnk_080CC9E0[])(Entity*); +extern const u8 gUnk_080CCA04[]; + +struct SalesOffering { + u8 field_0x0; + u8 field_0x1; + u16 price; + u16 field_0x4; + u16 field_0x6; + u8 field_0x8; + u8 field_0x9; + u16 field_0xa; +}; + +void BusinessScrub(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CC9C8); +} + +void sub_0802891C(Entity* this) { + gUnk_080CC9E0[this->action](this); +} + +void sub_08028934(Entity* this) { + Entity* pEVar1; + + if (this->damageType == 1 && (this->bitfield & 0x7f) == 0x42) { + this->action = 3; + this->previousActionFlag = 0; + this->actionDelay = 0x28; + this->flags &= ~0x80; + sub_080290E0(this, 4); + pEVar1 = CreateFx(this, 3, 0); + if (pEVar1 != NULL) { + pEVar1->height.HALF.HI -= 8; + } + EnqueueSFX(0x1bb); + } +} + +void nullsub_140(Entity* this) { + /* ... */ +} + +void sub_08028994(Entity* this) { + this->field_0xf = 0; + this->field_0x78.HWORD = this->x.HALF.HI; + this->field_0x7a.HWORD = this->y.HALF.HI; + this->animationState = 0; + this->direction = 0x10; + sub_08028E9C(this); + if ((*(u8*)this->field_0x7c.WORD & 1) || CheckFlags(this->field_0x86.HWORD)) { + this->action = 4; + this->actionDelay = 0x78; + this->spritePriority.b1 = 1; + sub_0802925C(this); + sub_080290E0(this, 0); + } else { + this->actionDelay = 0; + this->field_0x76.HWORD = COORD_TO_TILE(this); + this->field_0x74.HWORD = sub_080001DA(this->field_0x76.HWORD, this->collisionLayer); + this->field_0x40 = 0x41; + sub_08028FFC(this); + } +} + +void sub_08028A48(Entity* this) { + if (this->actionDelay) { + this->actionDelay--; + } else if (sub_08028F98(this, 0)) { + sub_08029078(this); + this->previousActionFlag = 0; + this->field_0xf = 1; + } +} + +void sub_08028A74(Entity* this) { + u32 unk; + + GetNextFrame(this); + switch (this->previousActionFlag) { + case 0: + unk = 1; + if (this->frames.all & 0x80) { + this->previousActionFlag = 1; + this->actionDelay = 0x3c; + this->field_0xf = 0x10; + sub_08028FDC(this); + sub_080290E0(this, 1); + } + break; + case 1: + unk = 1; + if (--this->actionDelay == 0) { + this->previousActionFlag = 2; + this->actionDelay = 0x20; + this->field_0xf = 0; + sub_08028FDC(this); + sub_080290E0(this, 2); + } else if (--this->field_0xf == 0) { + if (sub_08028FDC(this)) { + sub_080290E0(this, 1); + } + this->field_0xf = 0x10; + } + break; + case 2: + unk = 1; + sub_080290FC(this); + if (this->frames.all & 1) { + Entity* ent = sub_0804A98C(this, 4, 0); + if (ent != NULL) { + ent->parent = this; + ent->direction = this->direction; + this->frames.all &= ~1; + this->previousActionFlag = 3; + } + } + break; + case 3: + unk = 2; + if (this->frames.all & 0x80) { + this->previousActionFlag = 4; + this->actionDelay = 0x50; + sub_080290E0(this, 1); + } + break; + case 4: + unk = 2; + if (--this->actionDelay == 0) { + if (sub_08028F98(this, 0)) { + this->previousActionFlag = 1; + this->actionDelay = 0x3c; + this->field_0xf = 0x10; + sub_08028FDC(this); + } else { + sub_08028FFC(this); + this->previousActionFlag = 0; + this->actionDelay = 0x50; + this->field_0xf = 0; + } + return; + } + break; + } + + if (!sub_08028F98(this, unk)) { + sub_08028FFC(this); + this->previousActionFlag = 0; + this->actionDelay = 0x50; + this->field_0xf = 0; + } +} + +void sub_08028BC4(Entity* this) { + Entity* iVar1; + + switch (this->previousActionFlag) { + case 0: + if (this->actionDelay == 0) { + if (this->frames.all & 0x80) { + this->previousActionFlag = 1; + sub_08028FDC(this); + sub_080290E0(this, 5); + this->spritePriority.b1 = 1; + } + } else { + this->actionDelay--; + } + break; + case 1: + if (this->frames.all & 0x80) { + this->action = 4; + this->previousActionFlag = 0; + this->actionDelay = 0x1e; + this->field_0xf = 5; + sub_080290E0(this, 0); + iVar1 = sub_0804A9FC(this, 0x1c); + if (iVar1 != NULL) { + iVar1->spritePriority.b0 = 3; + iVar1->height.HALF.HI -= 12; + sub_0805E3A0(iVar1, 2); + } + SetFlag(this->field_0x86.HWORD); + sub_0802925C(this); + } + break; + } + + GetNextFrame(this); + sub_0800445C(this); +} + +extern void sub_0804AA1C(Entity*); +void sub_08028F0C(Entity*); + +void sub_08028C84(Entity* this) { + if (--this->actionDelay == 0) { + this->actionDelay = 0x30; + if (this->field_0xf) { + if (--this->field_0xf == 0) { + sub_0804AA1C(this); + } + } else if (sub_08028FDC(this) || this->field_0x80.HALF.LO) { + this->field_0x80.HALF.LO = 0; + sub_080290E0(this, 0); + } + } + GetNextFrame(this); + sub_0800445C(this); + sub_08028F0C(this); +} + +void sub_08028CE8(Entity* this) { + struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; + u32 subtype; + + if ((gTextBox.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { + if (offer->price <= gUnk_02002A40.stats.rupees) { + if (sub_080291DC(this)) { + /* Bag full. */ + TextboxNoOverlapFollow(0x2904); + sub_08078A90(0); + } else { + ModRupees(-offer->price); + switch (offer->field_0x0 >> 2) { + case 0: + subtype = offer->field_0x9; + if (subtype == 0xff) { + subtype = gUnk_080CC9C0[Random() & 7]; + } + + CreateItemEntity(offer->field_0x8, subtype, 0); + + this->action = 6; + this->actionDelay = 4; + this->field_0x80.HALF.HI = 0; + sub_080290E0(this, 3); + SetLocalFlag(0x87); + return; + case 1: + CreateItemEntity(offer->field_0x8, offer->field_0x9, 0); + this->actionDelay = 4; + sub_0802922C(this); + return; + case 2: + CreateItemEntity(offer->field_0x8, offer->field_0x9, 0); + this->actionDelay = 8; + sub_0802922C(this); + return; + } + } + } else { + /* Not enough money. */ + TextboxNoOverlapFollow(0x2903); + sub_08078A90(0); + } + } + + sub_0800445C(this); + this->action = 4; + this->actionDelay = 0x30; + sub_080290E0(this, 0); +} + +void sub_08028DE8(Entity* this) { + if (gPlayerEntity.action == 8) { + if (this->field_0x80.HALF.HI == 0) { + sub_08078A90(1); + this->field_0x80.HALF.HI = 1; + } + } else { + TextboxNoOverlapFollow(0x2902); + this->action = 4; + this->field_0x80.HALF.HI = 0; + this->actionDelay = 1; + sub_08028EDC(this); + sub_08078A90(0); + sub_0800445C(this); + GetNextFrame(this); + } +} + +void sub_08028E40(Entity* this) { + if ((gTextBox.doTextBox & 0x7f) == 0) { + struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; + + this->action = 4; + this->previousActionFlag = gTextBox.doTextBox & 0x7f; + this->actionDelay = 1; + if (CheckLocalFlag(offer->field_0xa) == 0) { + SetLocalFlag(offer->field_0xa); + } + sub_08078A90(0); + } + sub_0800445C(this); + GetNextFrame(this); +} + +void sub_08028E84(Entity* this) { + if (UpdateFuseInteraction()) { + this->action = 4; + this->actionDelay = 1; + } +} + +bool32 sub_08029198(const struct SalesOffering*); + +void sub_08028E9C(Entity* this) { + const struct SalesOffering* offer = &gUnk_080CC954[this->entityType.form]; + if (sub_08029198(offer) && (offer->field_0x0 & 2)) { + offer = &gUnk_080CC954[offer->field_0xa]; + } + this->field_0x7c.WORD = (u32)offer; + this->field_0x80.HALF.LO = 0; +} + +void sub_08028EDC(Entity* this) { + const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; + if (sub_08029198(offer) && (offer->field_0x0 & 2)) { + offer = &gUnk_080CC954[offer->field_0xa]; + this->field_0x7c.WORD = (u32)offer; + } +} + +void sub_08028F0C(Entity* this) { + if (this->interactType == 2) { + this->action = 8; + this->interactType = 0; + sub_0806F118(this); + } else if (this->interactType != 0) { + u16 dialog; + const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; + + this->interactType = 0; + sub_0804AA1C(this); + this->direction = (GetAnimationState(this) << 3); + sub_080290E0(this, 3); + this->field_0x80.HALF.LO = 1; + this->actionDelay = 0x20; + this->field_0xf = 0; + if (sub_08029198(offer)) { + dialog = offer->field_0x6; + } else { + if ((offer->field_0x0 & 0xfc) != 0xc) { + this->action = 5; + } else { + this->action = 7; + } + dialog = offer->field_0x4; + sub_08078A90(1); + } + TextboxNoOverlapFollow(dialog); + gTextBox.field_0x10 = offer->price; + } +} + +bool32 sub_08028F98(Entity* this, u32 param_2) { + Entity* ent = sub_08049DF4(1); + if (ent == NULL || sub_080041A0(this, ent, 0x28, 0x28)) { + return FALSE; + } + + if (param_2 != 2) { + u32 distance = param_2 ? 0x58 : 0x50; + + if (!sub_080041A0(this, ent, distance, distance)) { + return FALSE; + } + } + + return TRUE; +} + +bool32 sub_08028FDC(Entity* this) { + u32 direction = DirectionRoundUp(sub_08049F84(this, 1)); + if (direction == this->direction) { + return FALSE; + } else { + this->direction = direction; + return TRUE; + } +} + +void sub_08028FFC(Entity* this) { + this->action = 1; + this->flags &= ~0x80; + this->spritePriority.b1 = 0; + sub_080AE068(this); + UnloadOBJPalette(this); + this->spriteVramOffset = 0xe8; + this->palette.b.b0 = 2; + this->palette.b.b4 = 2; + this->spriteIndex = 0xa7; + this->x.HALF.HI = this->field_0x78.HWORD; + this->y.HALF.HI = this->field_0x7a.HWORD; + InitializeAnimation(this, 0); + SetTile(0x4022, this->field_0x76.HWORD, this->collisionLayer); +} + +void sub_08029078(Entity* this) { + this->action = 2; + this->flags = this->flags | 0x80; + this->spritePriority.b1 = 1; + if (LoadFixedGFX(this, 0x72) == 0) { + DeleteEntity(this); + } else { + sub_0801D040(this, 0x6e); + this->spriteIndex = 0xd0; + sub_08028FDC(this); + sub_080290E0(this, 1); + SetTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer); + } +} + +void sub_080290E0(Entity* this, u32 param_2) { + InitializeAnimation(this, this->direction >> 3 | gUnk_080CCA04[param_2]); +} + +void sub_080290FC(Entity* this) { + if (this->actionDelay != 0) { + if (--this->actionDelay < 0x10 && (this->actionDelay & 1) == 0) { + s32 sVar3 = (this->direction & 0x10) ? -1 : 1; + if ((this->direction & 8)) { + this->x.HALF.HI += (this->actionDelay & 8) ? -sVar3 : sVar3; + } else { + this->y.HALF.HI += (this->actionDelay & 8) ? sVar3 : -sVar3; + } + } + } +} + +bool32 sub_0802915C(Entity* this) { + const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; + + switch (offer->field_0x8) { + case 0x44: + if (GetInventoryValue(0x44) == 0) + return TRUE; + break; + case 0x1c: + if (CheckGlobalFlag(0x5a) == 0) + return TRUE; + break; + case 0x5c: + case 0x6c: + case 0x6f: + return TRUE; + } + return FALSE; +} + +bool32 sub_08029198(const struct SalesOffering* offer) { + u32 tmp; + + if ((offer->field_0x0 & 0xfc) != 0xc) { + switch (offer->field_0x8) { + case 0x1c: + tmp = CheckGlobalFlag(0x5a); + break; + case 0x9: + case 0x44: + tmp = GetInventoryValue(offer->field_0x8); + break; + default: + return 0; + } + } else { + tmp = CheckLocalFlag(offer->field_0xa); + } + + if (tmp == 0) { + return FALSE; + } + + return TRUE; +} + +bool32 sub_080291DC(Entity* this) { + const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; + + switch (offer->field_0x8) { + case 0x6c: + if (gBombBagSizes[gUnk_02002A40.stats.bombBagType] <= gUnk_02002A40.stats.bombCount) + return TRUE; + break; + case 0x6f: + if (gQuiverSizes[gUnk_02002A40.stats.quiverType] <= gUnk_02002A40.stats.arrowCount) + return TRUE; + break; + } + + return FALSE; +} + +#if NON_MATCHING +void sub_0802922C(Entity* this) { + const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; + + this->action = 6; + this->field_0x80.HALF.HI = 0; + + switch (offer->field_0x8) { + case 0x1c: + SetGlobalFlag(0x5a); + break; + } + + sub_080290E0(this, 3); +} +#else +NAKED +void sub_0802922C(Entity* this) { + asm(".include \"asm/non_matching/businessScrub/sub_0802925C.inc\""); +} +#endif + +void sub_0802925C(Entity* this) { + sub_08078784(this, sub_0801E99C(this)); +} + +void sub_08029270(Entity* this) { + if (this->action == 0) { + this->action++; + this->spriteSettings.b.draw = 1; + InitializeAnimation(this, 0xe); + } else { + GetNextFrame(this); + } +} + +// clang-format off +const struct SalesOffering gUnk_080CC954[] = { + {0x06, 0x00, 0xffff, 0x290f, 0x2902, 0x09, 0xff, 0x0001}, + {0x04, 0x00, 0x001e, 0x290e, 0x2902, 0x6f, 0xff, 0xffff}, + {0x04, 0x00, 0x001e, 0x290b, 0x2902, 0x6c, 0xff, 0xffff}, + {0x08, 0x00, 0x0028, 0x290c, 0x2911, 0x44, 0xff, 0xffff}, + {0x00, 0x00, 0x0064, 0x290d, 0x2902, 0x5c, 0xff, 0xffff}, + {0x04, 0x00, 0x0014, 0x2910, 0x2911, 0x1c, 0xff, 0xffff}, + {0x0c, 0x00, 0xffff, 0x2912, 0x2913, 0xff, 0xff, 0x0046}, + {0x04, 0x00, 0x0064, 0x2913, 0x2902, 0x5c, 0x75, 0xffff}, + {0x00, 0x00, 0x00C8, 0x290d, 0x2902, 0x5c, 0xff, 0xffff}, +}; + +const u8 gUnk_080CC9C0[] = { + 0x6e, + 0x6f, + 0x70, + 0x71, + 0x72, + 0x73, + 0x74, + 0x75, + +}; + +void (*const gUnk_080CC9C8[])(Entity*) = { + sub_0802891C, + sub_08028934, + sub_08001324, + sub_0804A7D4, + sub_08001242, + nullsub_140, +}; + +void (*const gUnk_080CC9E0[])(Entity*) = { + sub_08028994, + sub_08028A48, + sub_08028A74, + sub_08028BC4, + sub_08028C84, + sub_08028CE8, + sub_08028DE8, + sub_08028E40, + sub_08028E84, +}; + +const u8 gUnk_080CCA04[] = { + 0, 4, 8, 12, 16, 20, +}; +// clang-format on