diff --git a/asm/dog.s b/asm/dog.s deleted file mode 100644 index 5dddb0a4..00000000 --- a/asm/dog.s +++ /dev/null @@ -1,887 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start Dog -Dog: @ 0x08069B1C - push {r4, lr} - adds r4, r0, #0 - ldr r1, _08069B40 @ =gUnk_08111D88 - ldrb r0, [r4, #0xc] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r4, #0 - bl _call_via_r1 - adds r0, r4, #0 - bl sub_0806ED78 - adds r0, r4, #0 - bl sub_08069FE8 - pop {r4, pc} - .align 2, 0 -_08069B40: .4byte gUnk_08111D88 - - thumb_func_start sub_08069B44 -sub_08069B44: @ 0x08069B44 - push {r4, r5, r6, lr} - adds r5, r0, #0 - bl sub_08069EF0 - cmp r0, #0 - beq _08069C30 - adds r0, r5, #0 - bl sub_0805ACC0 - cmp r0, #0 - bne _08069B64 - movs r0, #0x2e - ldrsh r1, [r5, r0] - movs r2, #0x32 - ldrsh r4, [r5, r2] - b _08069B68 -_08069B64: - lsrs r1, r0, #0x10 - adds r4, r0, #0 -_08069B68: - ldrb r0, [r5, #0xe] - movs r3, #0x20 - cmp r0, #0 - beq _08069B72 - adds r3, r0, #0 -_08069B72: - subs r0, r1, r3 - adds r2, r5, #0 - adds r2, #0x6e - strh r0, [r2] - adds r1, r1, r3 - adds r0, r5, #0 - adds r0, #0x6c - strh r1, [r0] - adds r1, r4, #0 - subs r1, #8 - adds r0, #4 - strh r1, [r0] - adds r0, r4, #0 - adds r0, #8 - adds r2, #4 - strh r0, [r2] - movs r0, #0x80 - lsls r0, r0, #1 - strh r0, [r5, #0x24] - movs r0, #0x1e - strb r0, [r5, #0xe] - movs r4, #2 - strb r4, [r5, #0x14] - adds r1, r5, #0 - adds r1, #0x6a - movs r0, #0xff - strb r0, [r1] - adds r0, r5, #0 - bl sub_0801E99C - adds r1, r5, #0 - adds r1, #0x74 - strb r0, [r1] - adds r0, r5, #0 - movs r1, #2 - bl sub_0805E3A0 - adds r0, r5, #0 - movs r1, #0xa - bl InitAnimationForceUpdate - ldrb r0, [r5, #0x10] - ands r4, r0 - cmp r4, #0 - beq _08069BD2 - adds r0, r5, #0 - bl sub_0807DD50 -_08069BD2: - ldrb r0, [r5, #0xa] - cmp r0, #0 - bne _08069BF2 - ldr r0, _08069C34 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08069BF2 - movs r0, #0x36 - bl GetInventoryValue - cmp r0, #2 - beq _08069BF2 - movs r0, #4 - strb r0, [r5, #0xc] -_08069BF2: - ldrb r0, [r5, #0xa] - cmp r0, #2 - bne _08069C30 - movs r0, #0xcf - bl CheckLocalFlag - cmp r0, #0 - bne _08069C30 - ldr r0, _08069C38 @ =0x00004072 - movs r6, #0x2e - ldrsh r1, [r5, r6] - ldr r3, _08069C3C @ =gRoomControls - ldrh r2, [r3, #6] - subs r1, r1, r2 - asrs r1, r1, #4 - movs r4, #0x3f - ands r1, r4 - movs r6, #0x32 - ldrsh r2, [r5, r6] - ldrh r3, [r3, #8] - adds r3, #8 - subs r2, r2, r3 - asrs r2, r2, #4 - ands r2, r4 - lsls r2, r2, #6 - orrs r1, r2 - adds r2, r5, #0 - adds r2, #0x38 - ldrb r2, [r2] - bl SetTile -_08069C30: - pop {r4, r5, r6, pc} - .align 2, 0 -_08069C34: .4byte gPlayerState -_08069C38: .4byte 0x00004072 -_08069C3C: .4byte gRoomControls - - thumb_func_start sub_08069C40 -sub_08069C40: @ 0x08069C40 - push {r4, lr} - adds r4, r0, #0 - bl UpdateAnimationSingleFrame - adds r0, r4, #0 - bl sub_08069F90 - cmp r0, #0 - beq _08069C80 - ldr r0, _08069C68 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08069C6C - adds r0, r4, #0 - bl sub_08069CB8 - b _08069C7A - .align 2, 0 -_08069C68: .4byte gPlayerState -_08069C6C: - adds r0, r4, #0 - bl GetAnimationState - strb r0, [r4, #0x14] - adds r0, r4, #0 - bl sub_08069D00 -_08069C7A: - movs r0, #0x1e - strb r0, [r4, #0xe] - b _08069CB2 -_08069C80: - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _08069CB2 - movs r0, #2 - strb r0, [r4, #0xc] - bl Random - movs r1, #0x1f - ands r0, r1 - adds r0, #0x1e - strb r0, [r4, #0xe] - bl Random - ldr r2, _08069CB4 @ =gUnk_08111DA8 - movs r1, #7 - ands r1, r0 - adds r1, r1, r2 - ldrb r0, [r1] - strb r0, [r4, #0x15] - adds r0, r4, #0 - bl sub_08069F6C -_08069CB2: - pop {r4, pc} - .align 2, 0 -_08069CB4: .4byte gUnk_08111DA8 - - thumb_func_start sub_08069CB8 -sub_08069CB8: @ 0x08069CB8 - push {r4, r5, lr} - adds r4, r0, #0 - ldr r1, _08069CF8 @ =gPlayerEntity - bl GetFacingDirection - ldr r2, _08069CFC @ =gUnk_08111DB0 - ldrb r1, [r4, #0x14] - lsls r1, r1, #5 - adds r0, r0, r1 - adds r0, r0, r2 - ldrb r1, [r0] - lsrs r0, r1, #6 - strb r0, [r4, #0x14] - movs r0, #0x3f - ands r1, r0 - adds r5, r4, #0 - adds r5, #0x6b - strb r1, [r5] - adds r0, r4, #0 - bl sub_0806A028 - adds r0, r4, #0 - adds r0, #0x58 - ldrb r0, [r0] - ldrb r1, [r5] - cmp r0, r1 - beq _08069CF6 - ldrb r1, [r5] - adds r0, r4, #0 - bl InitAnimationForceUpdate -_08069CF6: - pop {r4, r5, pc} - .align 2, 0 -_08069CF8: .4byte gPlayerEntity -_08069CFC: .4byte gUnk_08111DB0 - - thumb_func_start sub_08069D00 -sub_08069D00: @ 0x08069D00 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r5, r4, #0 - adds r5, #0x6b - movs r7, #8 - strb r7, [r5] - bl sub_0806A028 - adds r6, r4, #0 - adds r6, #0x58 - ldrb r0, [r6] - cmp r0, #0x1f - bls _08069D2A - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08069D4E - strb r7, [r5] -_08069D2A: - bl Random - ldr r1, _08069D50 @ =0x000001FF - ands r1, r0 - cmp r1, #2 - bhi _08069D3C - adds r0, r4, #0 - bl sub_08069FBC -_08069D3C: - ldrb r2, [r6] - ldrb r1, [r5] - ldrb r0, [r4, #0x14] - adds r1, r1, r0 - cmp r2, r1 - beq _08069D4E - adds r0, r4, #0 - bl InitAnimationForceUpdate -_08069D4E: - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08069D50: .4byte 0x000001FF - - thumb_func_start sub_08069D54 -sub_08069D54: @ 0x08069D54 - push {r4, lr} - adds r4, r0, #0 - bl sub_08069F90 - cmp r0, #0 - bne _08069DD8 - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - beq _08069DD8 - adds r0, r4, #0 - bl UpdateAnimationSingleFrame - adds r0, r4, #0 - bl ProcessMovement - ldrh r1, [r4, #0x2a] - movs r0, #0x2e - ldrsh r2, [r4, r0] - adds r0, r4, #0 - adds r0, #0x6e - ldrh r0, [r0] - cmp r2, r0 - bge _08069D92 - adds r0, #1 - strh r0, [r4, #0x2e] - movs r1, #0xe0 - lsls r1, r1, #4 - b _08069DA4 -_08069D92: - adds r0, r4, #0 - adds r0, #0x6c - ldrh r0, [r0] - cmp r2, r0 - ble _08069DA4 - subs r0, #1 - strh r0, [r4, #0x2e] - movs r1, #0xe0 - lsls r1, r1, #8 -_08069DA4: - movs r0, #0x32 - ldrsh r2, [r4, r0] - adds r0, r4, #0 - adds r0, #0x70 - ldrh r0, [r0] - cmp r2, r0 - bge _08069DBA - adds r0, #1 - strh r0, [r4, #0x32] - movs r1, #0xe - b _08069DCA -_08069DBA: - adds r0, r4, #0 - adds r0, #0x72 - ldrh r0, [r0] - cmp r2, r0 - ble _08069DCA - subs r0, #1 - strh r0, [r4, #0x32] - movs r1, #0xe0 -_08069DCA: - adds r0, r4, #0 - bl sub_0800417E - adds r0, r4, #0 - bl sub_08069F6C - b _08069DF6 -_08069DD8: - adds r0, r4, #0 - bl sub_08069F90 - cmp r0, #0 - beq _08069DE6 - movs r0, #1 - b _08069DE8 -_08069DE6: - movs r0, #3 -_08069DE8: - strb r0, [r4, #0xc] - bl Random - movs r1, #0x1f - ands r0, r1 - adds r0, #0x1e - strb r0, [r4, #0xe] -_08069DF6: - pop {r4, pc} - - thumb_func_start sub_08069DF8 -sub_08069DF8: @ 0x08069DF8 - push {r4, lr} - adds r4, r0, #0 - bl UpdateAnimationSingleFrame - adds r0, r4, #0 - bl sub_08069F90 - cmp r0, #0 - beq _08069E0E - movs r0, #1 - b _08069E34 -_08069E0E: - ldrb r0, [r4, #0xe] - subs r0, #1 - strb r0, [r4, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - beq _08069E22 - adds r0, r4, #0 - bl sub_08069D00 - b _08069E42 -_08069E22: - bl Random - movs r1, #0xff - ands r1, r0 - cmp r1, #0x2f - bhi _08069E32 - movs r0, #2 - b _08069E34 -_08069E32: - movs r0, #3 -_08069E34: - strb r0, [r4, #0xc] - bl Random - movs r1, #0x1f - ands r0, r1 - adds r0, #0x1e - strb r0, [r4, #0xe] -_08069E42: - pop {r4, pc} - - thumb_func_start sub_08069E44 -sub_08069E44: @ 0x08069E44 - push {lr} - movs r1, #0 - bl sub_0807DD94 - pop {pc} - .align 2, 0 - - thumb_func_start sub_08069E50 -sub_08069E50: @ 0x08069E50 - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - bl GetAnimationState - strb r0, [r4, #0x14] - adds r5, r4, #0 - adds r5, #0x6b - movs r7, #8 - strb r7, [r5] - adds r0, r4, #0 - bl sub_0806A028 - adds r0, r4, #0 - bl UpdateAnimationSingleFrame - adds r6, r4, #0 - adds r6, #0x58 - ldrb r0, [r6] - cmp r0, #0x1f - bls _08069E88 - adds r0, r4, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _08069EC8 - strb r7, [r5] -_08069E88: - adds r0, r4, #0 - bl sub_08069FBC - ldrb r2, [r6] - ldrb r1, [r5] - ldrb r0, [r4, #0x14] - adds r1, r1, r0 - cmp r2, r1 - beq _08069EA0 - adds r0, r4, #0 - bl InitAnimationForceUpdate -_08069EA0: - movs r0, #0x36 - bl GetInventoryValue - cmp r0, #2 - bne _08069EC8 - movs r0, #7 - strb r0, [r4, #0xc] - adds r0, r4, #0 - movs r1, #0x29 - bl InitAnimationForceUpdate - adds r0, r4, #0 - bl sub_080788E0 - movs r0, #0xd1 - bl EnqueueSFX - movs r0, #0xcd - bl EnqueueSFX -_08069EC8: - pop {r4, r5, r6, r7, pc} - .align 2, 0 - - thumb_func_start sub_08069ECC -sub_08069ECC: @ 0x08069ECC - push {r4, lr} - adds r4, r0, #0 - bl UpdateFuseInteraction - cmp r0, #0 - beq _08069EDC - movs r0, #1 - strb r0, [r4, #0xc] -_08069EDC: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08069EE0 -sub_08069EE0: @ 0x08069EE0 - push {lr} - bl UpdateAnimationSingleFrame - pop {pc} - - thumb_func_start sub_08069EE8 -sub_08069EE8: @ 0x08069EE8 - movs r1, #5 - strb r1, [r0, #0xc] - bx lr - .align 2, 0 - - thumb_func_start sub_08069EF0 -sub_08069EF0: @ 0x08069EF0 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xa] - lsls r1, r0, #1 - adds r1, r1, r0 - lsls r1, r1, #2 - ldr r0, _08069F20 @ =gUnk_08111D58 - adds r1, r1, r0 - adds r0, r4, #0 - bl LoadExtraSpriteData - cmp r0, #0 - beq _08069F28 - movs r0, #1 - strb r0, [r4, #0xc] - ldr r1, _08069F24 @ =gUnk_08111E30 - ldrb r0, [r4, #0xa] - adds r0, r0, r1 - ldrb r1, [r0] - adds r0, r4, #0 - adds r0, #0x68 - strh r1, [r0] - movs r0, #1 - b _08069F2A - .align 2, 0 -_08069F20: .4byte gUnk_08111D58 -_08069F24: .4byte gUnk_08111E30 -_08069F28: - movs r0, #0 -_08069F2A: - pop {r4, pc} - - thumb_func_start Dog_Head -Dog_Head: @ 0x08069F2C - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x5a - ldrb r2, [r0] - movs r0, #0x81 - rsbs r0, r0, #0 - ands r2, r0 - cmp r2, #0 - beq _08069F46 - adds r0, r4, #0 - adds r0, #0x68 - ldrh r0, [r0] - adds r2, r2, r0 -_08069F46: - subs r2, #1 - adds r0, r4, #0 - movs r1, #0 - bl SetExtraSpriteFrame - ldrb r2, [r4, #0x1e] - adds r0, r4, #0 - movs r1, #1 - bl SetExtraSpriteFrame - adds r0, r4, #0 - movs r1, #1 - movs r2, #0 - bl SetSpriteSubEntryOffsetData1 - adds r0, r4, #0 - bl sub_0807000C - pop {r4, pc} - - thumb_func_start sub_08069F6C -sub_08069F6C: @ 0x08069F6C - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0x15] - bl sub_0806F5A4 - strb r0, [r4, #0x14] - ldrb r0, [r4, #0x14] - adds r1, r0, #4 - adds r0, r4, #0 - adds r0, #0x58 - ldrb r0, [r0] - cmp r1, r0 - beq _08069F8C - adds r0, r4, #0 - bl InitAnimationForceUpdate -_08069F8C: - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_08069F90 -sub_08069F90: @ 0x08069F90 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xa] - cmp r0, #2 - bne _08069FA8 - movs r0, #0xcf - bl CheckLocalFlag - cmp r0, #0 - bne _08069FA8 - movs r0, #1 - b _08069FB4 -_08069FA8: - ldr r1, _08069FB8 @ =gPlayerEntity - adds r0, r4, #0 - movs r2, #0x14 - movs r3, #0x14 - bl sub_080041A0 -_08069FB4: - pop {r4, pc} - .align 2, 0 -_08069FB8: .4byte gPlayerEntity - - thumb_func_start sub_08069FBC -sub_08069FBC: @ 0x08069FBC - push {lr} - adds r2, r0, #0 - ldr r0, _08069FE4 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - movs r1, #0x20 - cmp r0, #0 - beq _08069FD0 - movs r1, #0x24 -_08069FD0: - ldrb r0, [r2, #0x14] - cmp r0, #1 - beq _08069FDA - cmp r0, #3 - bne _08069FE0 -_08069FDA: - adds r0, r2, #0 - adds r0, #0x6b - strb r1, [r0] -_08069FE0: - pop {pc} - .align 2, 0 -_08069FE4: .4byte gPlayerState - - thumb_func_start sub_08069FE8 -sub_08069FE8: @ 0x08069FE8 - push {r4, r5, lr} - adds r4, r0, #0 - ldr r0, _0806A010 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - rsbs r0, r0, #0 - lsrs r5, r0, #0x1f - adds r0, r4, #0 - adds r0, #0x6a - ldrb r0, [r0] - cmp r5, r0 - beq _0806A020 - cmp r5, #0 - bne _0806A014 - adds r0, r4, #0 - bl sub_08078778 - b _0806A020 - .align 2, 0 -_0806A010: .4byte gPlayerState -_0806A014: - adds r0, r4, #0 - adds r0, #0x74 - ldrb r1, [r0] - adds r0, r4, #0 - bl sub_080787A8 -_0806A020: - adds r0, r4, #0 - adds r0, #0x6a - strb r5, [r0] - pop {r4, r5, pc} - - thumb_func_start sub_0806A028 -sub_0806A028: @ 0x0806A028 - push {r4, lr} - adds r4, r0, #0 - adds r0, #0x39 - movs r2, #0 - ldrsb r2, [r0, r2] - cmp r2, #0 - beq _0806A07E - ldr r0, _0806A054 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0806A060 - cmp r2, #2 - bne _0806A058 - movs r0, #6 - strb r0, [r4, #0xc] - adds r0, r4, #0 - bl sub_0806F118 - b _0806A076 - .align 2, 0 -_0806A054: .4byte gPlayerState -_0806A058: - adds r0, r4, #0 - bl sub_0806A080 - b _0806A076 -_0806A060: - adds r0, r4, #0 - bl sub_08069FBC - adds r0, r4, #0 - bl sub_0806A080 - movs r0, #0xd1 - bl SoundReq - bl sub_080791D0 -_0806A076: - adds r1, r4, #0 - adds r1, #0x39 - movs r0, #0 - strb r0, [r1] -_0806A07E: - pop {r4, pc} - - thumb_func_start sub_0806A080 -sub_0806A080: @ 0x0806A080 - push {lr} - ldrb r2, [r0, #0xb] - lsls r1, r2, #2 - adds r1, r1, r2 - lsls r1, r1, #4 - ldr r2, _0806A09C @ =gSave - ldrb r2, [r2, #8] - lsls r2, r2, #3 - ldr r3, _0806A0A0 @ =gUnk_08111E34 - adds r2, r2, r3 - adds r1, r1, r2 - bl ShowNPCDialogue - pop {pc} - .align 2, 0 -_0806A09C: .4byte gSave -_0806A0A0: .4byte gUnk_08111E34 - - thumb_func_start sub_0806A0A4 -sub_0806A0A4: @ 0x0806A0A4 - push {r4, r5, r6, lr} - adds r4, r0, #0 - ldr r0, _0806A0F8 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0806A100 - movs r5, #4 - movs r0, #0xcf - bl CheckLocalFlag - cmp r0, #0 - bne _0806A120 - movs r5, #3 - movs r0, #0xcf - bl SetLocalFlag - movs r1, #0x2e - ldrsh r0, [r4, r1] - ldr r2, _0806A0FC @ =gRoomControls - ldrh r1, [r2, #6] - subs r0, r0, r1 - asrs r0, r0, #4 - movs r3, #0x3f - ands r0, r3 - movs r6, #0x32 - ldrsh r1, [r4, r6] - ldrh r2, [r2, #8] - adds r2, #8 - subs r1, r1, r2 - asrs r1, r1, #4 - ands r1, r3 - lsls r1, r1, #6 - orrs r0, r1 - adds r1, r4, #0 - adds r1, #0x38 - ldrb r1, [r1] - bl sub_0807BA8C - b _0806A120 - .align 2, 0 -_0806A0F8: .4byte gPlayerState -_0806A0FC: .4byte gRoomControls -_0806A100: - movs r5, #2 - movs r0, #0xcf - bl CheckLocalFlag - cmp r0, #0 - bne _0806A120 - movs r5, #1 - movs r0, #0xdb - bl CheckLocalFlag - cmp r0, #0 - bne _0806A120 - movs r5, #0 - movs r0, #0xdb - bl SetLocalFlag -_0806A120: - ldr r2, _0806A13C @ =gUnk_08111F74 - ldr r0, _0806A140 @ =gSave - ldrb r1, [r0, #8] - lsls r0, r1, #2 - adds r0, r0, r1 - adds r0, r0, r5 - lsls r0, r0, #1 - adds r0, r0, r2 - ldrh r0, [r0] - adds r1, r4, #0 - bl TextboxNoOverlap - pop {r4, r5, r6, pc} - .align 2, 0 -_0806A13C: .4byte gUnk_08111F74 -_0806A140: .4byte gSave - - thumb_func_start sub_0806A144 -sub_0806A144: @ 0x0806A144 - push {r4, r5, lr} - adds r5, r0, #0 - movs r4, #4 - ldr r0, _0806A18C @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0806A17A - movs r4, #3 - movs r0, #0x46 - bl GetInventoryValue - cmp r0, #0 - bne _0806A17A - movs r0, #0x29 - bl CheckGlobalFlag - cmp r0, #0 - beq _0806A17A - movs r0, #0x85 - bl CheckLocalFlag - movs r4, #2 - cmp r0, #0 - bne _0806A17A - movs r4, #1 -_0806A17A: - ldr r0, _0806A190 @ =gUnk_08111FD8 - lsls r1, r4, #1 - adds r1, r1, r0 - ldrh r0, [r1] - adds r1, r5, #0 - bl TextboxNoOverlap - pop {r4, r5, pc} - .align 2, 0 -_0806A18C: .4byte gPlayerState -_0806A190: .4byte gUnk_08111FD8 - - thumb_func_start Dog_Fusion -Dog_Fusion: @ 0x0806A194 - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xc] - cmp r0, #0 - bne _0806A1CE - adds r0, r4, #0 - bl sub_08069EF0 - cmp r0, #0 - beq _0806A1D4 - ldrb r0, [r4, #0xc] - adds r0, #1 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0x18] - movs r0, #4 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #1 - orrs r0, r1 - strb r0, [r4, #0x18] - adds r0, r4, #0 - movs r1, #2 - bl sub_0805E3A0 - adds r0, r4, #0 - movs r1, #0x23 - bl InitializeAnimation - b _0806A1D4 -_0806A1CE: - adds r0, r4, #0 - bl GetNextFrame -_0806A1D4: - pop {r4, pc} - .align 2, 0 diff --git a/linker.ld b/linker.ld index b9f4494e..e8d7a300 100644 --- a/linker.ld +++ b/linker.ld @@ -605,7 +605,7 @@ SECTIONS { src/npc/goron.o(.text); src/npc/goronMerchant.o(.text); asm/gorman.o(.text); - asm/dog.o(.text); + src/npc/dog.o(.text); src/npc/syrup.o(.text); asm/syrup.o(.text); src/npc/rem.o(.text); diff --git a/src/gba/m4a.c b/src/gba/m4a.c index 82dbb39e..2049ba5c 100644 --- a/src/gba/m4a.c +++ b/src/gba/m4a.c @@ -1673,4 +1673,4 @@ void ply_xswee(MusicPlayerInfo* mplayInfo, MusicPlayerTrack* track) { } void nullsub_544() { -} \ No newline at end of file +} diff --git a/src/npc/dog.c b/src/npc/dog.c new file mode 100644 index 00000000..dfa6c92a --- /dev/null +++ b/src/npc/dog.c @@ -0,0 +1,360 @@ +#include "entity.h" +#include "functions.h" +#include "script.h" +#include "flags.h" +#include "random.h" +#include "npc.h" +#include "audio.h" +#include "save.h" +#include "textbox.h" + +extern void (*gUnk_08111D88[])(Entity*); +void sub_08069FE8(Entity*); +u32 sub_08069EF0(); + +extern u8 gUnk_08111DA8[]; +u32 sub_08069F90(Entity*); +void sub_08069F6C(Entity*); +void sub_08069D00(Entity*); +void sub_08069CB8(Entity*); + +extern u8 gUnk_08111DB0[]; +void sub_0806A028(Entity*); + +void sub_08069FBC(Entity*); + +extern SpriteLoadData gUnk_08111D58[]; +extern u8 gUnk_08111E30[]; + +void sub_0806A080(Entity*); + +extern Dialog gUnk_08111E34[]; + +extern u16 gUnk_08111F74[]; + +extern u16 gUnk_08111FD8[]; + +void Dog(Entity* this) { + gUnk_08111D88[this->action](this); + sub_0806ED78(this); + sub_08069FE8(this); +} + +void sub_08069B44(Entity* this) { + u32 uVar2; + u32 sVar3; + u32 uVar4; + u32 uVar5; + if (sub_08069EF0() != 0) { + uVar5 = sub_0805ACC0(this); + if (uVar5 == 0) { + sVar3 = this->x.HALF.HI; + uVar2 = this->y.HALF.HI; + } else { + sVar3 = uVar5 >> 0x10; + uVar2 = uVar5; + } + + uVar4 = this->actionDelay == 0 ? 0x20 : this->actionDelay; + + this->field_0x6e.HWORD = sVar3 - uVar4; + this->field_0x6c.HWORD = sVar3 + uVar4; + this->field_0x70.HALF.LO = uVar2 - 8; + this->field_0x70.HALF.HI = uVar2 + 8; + this->speed = 0x100; + this->actionDelay = 0x1e; + this->animationState = 2; + this->field_0x6a.HALF.LO = 0xff; + this->field_0x74.HALF.LO = sub_0801E99C(this); + sub_0805E3A0(this, 2); + InitAnimationForceUpdate(this, 10); + if ((this->flags & 2) != 0) { + sub_0807DD50(this); + } + if (((this->type == 0) && ((gPlayerState.flags.all & 0x80) == 0)) && (GetInventoryValue(0x36) != 2)) { + this->action = 4; + } + if ((this->type == 2) && (CheckLocalFlag(0xcf) == 0)) { + SetTile(0x4072, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer); + } + } +} + +void sub_08069C40(Entity* this) { + UpdateAnimationSingleFrame(this); + if (sub_08069F90(this) != 0) { + if ((gPlayerState.flags.all & 0x80) != 0) { + sub_08069CB8(this); + } else { + this->animationState = GetAnimationState(this); + sub_08069D00(this); + } + this->actionDelay = 0x1e; + } else { + this->actionDelay -= 1; + if (this->actionDelay == 0) { + this->action = 2; + this->actionDelay = (Random() & 0x1f) + 0x1e; + this->direction = gUnk_08111DA8[Random() & 7]; + sub_08069F6C(this); + } + } +} + +void sub_08069CB8(Entity* this) { + u32 direction; + u32 animState; + + direction = GetFacingDirection(this, &gPlayerEntity); + animState = gUnk_08111DB0[direction + this->animationState * 0x20]; + this->animationState = animState >> 6; + this->field_0x6a.HALF.HI = animState & 0x3f; + sub_0806A028(this); + if (this->animIndex != this->field_0x6a.HALF.HI) { + InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI); + } +} + +void sub_08069D00(Entity* this) { + this->field_0x6a.HALF.HI = 8; + sub_0806A028(this); + if (0x1f < this->animIndex) { + if ((this->frames.all & 0x80) == 0) { + return; + } + this->field_0x6a.HALF.HI = 8; + } + if ((Random() & 0x1ff) < 3) { + sub_08069FBC(this); + } + if (this->animIndex != this->field_0x6a.HALF.HI + this->animationState) { + InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI + this->animationState); + } +} + +void sub_08069D54(Entity* this) { + u16 collisions; + if (sub_08069F90(this) == 0) { + this->actionDelay -= 1; + if (this->actionDelay != 0) { + UpdateAnimationSingleFrame(this); + ProcessMovement(this); + collisions = this->collisions; + + if (this->x.HALF.HI < this->field_0x6e.HWORD) { + this->x.HALF.HI = this->field_0x6e.HWORD + 1; + collisions = 0xe00; + } else if (this->x.HALF.HI > this->field_0x6c.HWORD) { + this->x.HALF.HI = this->field_0x6c.HWORD - 1; + collisions = 0xe000; + } + if (this->y.HALF.HI < this->field_0x70.HALF_U.LO) { + this->y.HALF.HI = this->field_0x70.HALF_U.LO + 1; + collisions = 0xe; + } else if (this->y.HALF.HI > this->field_0x70.HALF_U.HI) { + this->y.HALF.HI = this->field_0x70.HALF_U.HI - 1; + collisions = 0xe0; + } + sub_0800417E(this, collisions); + sub_08069F6C(this); + return; + } + } + if (sub_08069F90(this) != 0) { + this->action = 1; + } else { + this->action = 3; + } + this->actionDelay = (Random() & 0x1f) + 0x1e; +} + +void sub_08069DF8(Entity* this) { + UpdateAnimationSingleFrame(this); + if (sub_08069F90(this) != 0) { + this->action = 1; + } else { + this->actionDelay -= 1; + if (this->actionDelay != 0) { + sub_08069D00(this); + return; + } + if ((Random() & 0xff) < 0x30) { + this->action = 2; + } else { + this->action = 3; + } + } + this->actionDelay = (Random() & 0x1f) + 0x1e; +} + +void sub_08069E44(Entity* this) { + sub_0807DD94(this, NULL); +} + +void sub_08069E50(Entity* this) { + this->animationState = GetAnimationState(this); + this->field_0x6a.HALF.HI = 8; + sub_0806A028(this); + UpdateAnimationSingleFrame(this); + if (this->animIndex > 0x1f) { + if ((this->frames.all & 0x80) == 0) { + return; + } + this->field_0x6a.HALF.HI = 8; + } + sub_08069FBC(this); + if (this->animIndex != this->field_0x6a.HALF.HI + this->animationState) { + InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI + this->animationState); + } + if (GetInventoryValue(0x36) == 2) { + this->action = 7; + InitAnimationForceUpdate(this, 0x29); + sub_080788E0(this); + EnqueueSFX(0xd1); + EnqueueSFX(0xcd); + } +} + +void sub_08069ECC(Entity* this) { + if (UpdateFuseInteraction(this) != 0) { + this->action = 1; + } +} + +void sub_08069EE0(Entity* this) { + UpdateAnimationSingleFrame(this); +} + +void sub_08069EE8(Entity* this) { + this->action = 5; +} + +u32 sub_08069EF0(Entity* this) { + if (LoadExtraSpriteData(this, &gUnk_08111D58[this->type * 3]) == 0) { + return 0; + } + this->action = 1; + this->field_0x68.HWORD = gUnk_08111E30[this->type]; + return 1; +} + +void Dog_Head(Entity* this) { + u32 frame; + frame = this->frames.all & 0xffffff7f; + if (frame != 0) { + frame = frame + this->field_0x68.HWORD; + } + SetExtraSpriteFrame(this, 0, frame - 1); + SetExtraSpriteFrame(this, 1, this->frameIndex); + SetSpriteSubEntryOffsetData1(this, 1, 0); + sub_0807000C(this); +} + +void sub_08069F6C(Entity* this) { + this->animationState = sub_0806F5A4(this->direction); + if (this->animationState + 4 != this->animIndex) { + InitAnimationForceUpdate(this, this->animationState + 4); + } +} + +u32 sub_08069F90(Entity* this) { + if ((this->type == 2) && (CheckLocalFlag(0xcf) == 0)) { + return 1; + } else { + return sub_080041A0(this, &gPlayerEntity, 0x14, 0x14); + } +} + +void sub_08069FBC(Entity* this) { + u32 tmp = (gPlayerState.flags.all & 0x80) != 0 ? 0x24 : 0x20; + if ((this->animationState == 1) || (this->animationState == 3)) { + this->field_0x6a.HALF.HI = tmp; + } +} + +void sub_08069FE8(Entity* this) { + u32 tmp = -((s32) - (gPlayerState.flags.all & 0x80) >> 0x1f); + if (tmp != this->field_0x6a.HALF.LO) { + if (tmp == 0) { + sub_08078778(this); + } else { + sub_080787A8(this, this->field_0x74.HALF.LO); + } + } + this->field_0x6a.HALF.LO = tmp; +} + +void sub_0806A028(Entity* this) { + if (this->interactType != 0) { + if ((gPlayerState.flags.all & 0x80) != 0) { + if (this->interactType == 2) { + this->action = 6; + sub_0806F118(this); + } else { + sub_0806A080(this); + } + } else { + sub_08069FBC(this); + sub_0806A080(this); + SoundReq(SFX_VO_DOG); + sub_080791D0(); + } + this->interactType = 0; + } +} + +void sub_0806A080(Entity* this) { + ShowNPCDialogue(this, (Dialog*)&gUnk_08111E34 + this->type2 * 10 + gSave.unk8); +} + +void sub_0806A0A4(Entity* this) { + s32 dialog; + + if ((gPlayerState.flags.all & 0x80) != 0) { + dialog = 4; + if (CheckLocalFlag(0xcf) == 0) { + dialog = 3; + SetLocalFlag(0xcf); + sub_0807BA8C(TILE(this->x.HALF.HI, this->y.HALF.HI - 8), (u32)this->collisionLayer); + } + } else { + + dialog = 2; + if (CheckLocalFlag(0xcf) == 0) { + dialog = 1; + if (CheckLocalFlag(0xdb) == 0) { + dialog = 0; + SetLocalFlag(0xdb); + } + } + } + TextboxNoOverlap(gUnk_08111F74[(u32)gSave.unk8 * 5 + dialog], this); +} + +void sub_0806A144(Entity* this) { + s32 dialog = 4; + if ((gPlayerState.flags.all & 0x80) != 0) { + dialog = 3; + if ((GetInventoryValue(0x46) == 0) && (CheckGlobalFlag(0x29) != 0)) { + if (CheckLocalFlag(0x85) == 0) { + dialog = 1; + } else { + dialog = 2; + } + } + } + TextboxNoOverlap(gUnk_08111FD8[dialog], this); +} + +void Dog_Fusion(Entity* this) { + if (this->action == 0) { + if (sub_08069EF0(this) != 0) { + this->action += 1; + this->spriteSettings.b.draw = 1; + sub_0805E3A0(this, 2); + InitializeAnimation(this, 0x23); + } + } else { + GetNextFrame(this); + } +} diff --git a/src/npc/fusionMenuNPC.c b/src/npc/fusionMenuNPC.c index 2754f207..5f2128ed 100644 --- a/src/npc/fusionMenuNPC.c +++ b/src/npc/fusionMenuNPC.c @@ -3,15 +3,15 @@ #include "npc.h" void FusionMenuNPC(Entity* this) { - if (gNPCFunctions[this->field_0xf][2] != NULL) { - gNPCFunctions[this->field_0xf][2](this); - } else { - DeleteThisEntity(); - } + if (gNPCFunctions[this->field_0xf][2] != NULL) { + gNPCFunctions[this->field_0xf][2](this); + } else { + DeleteThisEntity(); + } } void FusionMenuNPC_Head(Entity* this) { - if (gNPCFunctions[this->field_0xf][1] != NULL) { - gNPCFunctions[this->field_0xf][1](this); - } -} \ No newline at end of file + if (gNPCFunctions[this->field_0xf][1] != NULL) { + gNPCFunctions[this->field_0xf][1](this); + } +} diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 06b6e9a2..a34046b7 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -183,4 +183,4 @@ const u16 GoronMerchant_KinstonePrices[] = { 300, 200, 50, -}; \ No newline at end of file +}; diff --git a/src/npc/npc26.c b/src/npc/npc26.c index 18157cb9..e3517992 100644 --- a/src/npc/npc26.c +++ b/src/npc/npc26.c @@ -63,4 +63,4 @@ static void sub_08066A50(Entity* this) { static void (*const gUnk_081106D4[])(Entity*) = { sub_080669B8, sub_080669DC, sub_08066A30 }; -static void (*const gUnk_081106E0[])(Entity*) = { sub_08066A38, sub_08066A50 }; \ No newline at end of file +static void (*const gUnk_081106E0[])(Entity*) = { sub_08066A38, sub_08066A50 }; diff --git a/src/npc/npc4F.c b/src/npc/npc4F.c index 0285ac2d..07e05132 100644 --- a/src/npc/npc4F.c +++ b/src/npc/npc4F.c @@ -11,4 +11,4 @@ void NPC4F(Entity* this) { if (this->frameDuration == 0xfe) { this->frameDuration = (Random() & 0x1f) + 0x14; } -} \ No newline at end of file +} diff --git a/src/player.c b/src/player.c index c501409f..364e7821 100644 --- a/src/player.c +++ b/src/player.c @@ -1779,7 +1779,7 @@ NONMATCH("asm/non_matching/player/sub_08072D54.s", void sub_08072D54(Entity* thi } sub_08008790(this, 7); if (gPlayerState.field_0x14 != 0) { - if (!sub_08008B22() != 0) { + if (sub_08008B22() == 0) { gPlayerState.field_0x10[1] = 7; if (!(gPlayerState.flags.all & 0x80)) { sub_080791BC();