diff --git a/asm/non_matching/vaati/sub_0806B7BC.inc b/asm/non_matching/vaati/sub_0806B7BC.inc new file mode 100644 index 00000000..78f9e721 --- /dev/null +++ b/asm/non_matching/vaati/sub_0806B7BC.inc @@ -0,0 +1,216 @@ + .syntax unified + push {r4, r5, lr} + adds r5, r0, #0 + movs r0, #3 + bl CheckRoomFlag + cmp r0, #0 + bne _0806B7CC + b _0806B968 +_0806B7CC: + ldrb r0, [r5, #0xa] + cmp r0, #1 + beq _0806B84C + cmp r0, #1 + bgt _0806B7DC + cmp r0, #0 + beq _0806B7E6 + b _0806B93C +_0806B7DC: + cmp r0, #2 + beq _0806B86C + cmp r0, #3 + beq _0806B874 + b _0806B93C +_0806B7E6: + ldrh r0, [r5, #0x32] + adds r0, #1 + strh r0, [r5, #0x32] + ldrb r0, [r5, #0xe] + subs r0, #1 + strb r0, [r5, #0xe] + movs r1, #0xff + lsls r0, r0, #0x18 + cmp r0, #0 + bne _0806B82C + movs r0, #0x3b + movs r1, #3 + movs r2, #0 + bl CreateNPC + adds r4, r0, #0 + cmp r4, #0 + bne _0806B80C + b _0806B968 +_0806B80C: + adds r0, r5, #0 + adds r1, r4, #0 + bl CopyPosition + ldr r0, _0806B828 @ =0x00001634 + bl TextboxNoOverlapFollow + ldrb r0, [r5, #0xd] + adds r0, #1 + strb r0, [r5, #0xd] + bl DeleteThisEntity + b _0806B968 + .align 2, 0 +_0806B828: .4byte 0x00001634 +_0806B82C: + ldrb r0, [r5, #0xf] + subs r0, #1 + strb r0, [r5, #0xf] + ands r0, r1 + cmp r0, #0 + beq _0806B83A + b _0806B95A +_0806B83A: + movs r0, #0x20 + strb r0, [r5, #0xf] + ldr r0, _0806B848 @ =0x000001A9 + bl SoundReq + b _0806B95A + .align 2, 0 +_0806B848: .4byte 0x000001A9 +_0806B84C: + adds r0, r5, #0 + bl sub_0806B9BC + adds r4, r0, #0 + cmp r4, #0 + bne _0806B85C + bl DeleteThisEntity +_0806B85C: + movs r3, #0x84 + lsls r3, r3, #0xe + adds r0, r4, #0 + adds r1, r5, #0 + movs r2, #0 + bl PositionRelative + b _0806B95A +_0806B86C: + adds r0, r5, #0 + bl sub_0806B96C + b _0806B95A +_0806B874: + ldrb r0, [r5, #0xd] + cmp r0, #1 + beq _0806B8A2 + cmp r0, #1 + bgt _0806B884 + cmp r0, #0 + beq _0806B88E + b _0806B91E +_0806B884: + cmp r0, #2 + beq _0806B8C4 + cmp r0, #3 + beq _0806B906 + b _0806B91E +_0806B88E: + ldrb r0, [r5, #0xe] + subs r0, #1 + strb r0, [r5, #0xe] + lsls r0, r0, #0x18 + cmp r0, #0 + bne _0806B91E + ldrb r0, [r5, #0xd] + adds r0, #1 + strb r0, [r5, #0xd] + b _0806B91E +_0806B8A2: + adds r0, r5, #0 + adds r0, #0x5a + ldrb r1, [r0] + movs r0, #0x80 + ands r0, r1 + cmp r0, #0 + beq _0806B91E + movs r0, #2 + strb r0, [r5, #0xd] + ldr r1, _0806B8C0 @ =0x0000013F + adds r0, r5, #0 + bl sub_0801D2B4 + b _0806B8FA + .align 2, 0 +_0806B8C0: .4byte 0x0000013F +_0806B8C4: + adds r2, r5, #0 + adds r2, #0x5a + ldrb r1, [r2] + movs r0, #0x10 + ands r0, r1 + cmp r0, #0 + beq _0806B91E + movs r0, #0xef + ands r0, r1 + strb r0, [r2] + ldrb r0, [r5, #0xe] + adds r0, #1 + strb r0, [r5, #0xe] + lsls r0, r0, #0x18 + lsrs r0, r0, #0x18 + cmp r0, #1 + beq _0806B91E + cmp r0, #0xa + bne _0806B91E + ldrb r0, [r5, #0xd] + adds r0, #1 + strb r0, [r5, #0xd] + movs r0, #0xf4 + bl EnqueueSFX + movs r0, #0 + strb r0, [r5, #0xe] +_0806B8FA: + ldrb r1, [r5, #0xd] + subs r1, #1 + adds r0, r5, #0 + bl InitAnimationForceUpdate + b _0806B91E +_0806B906: + adds r0, r5, #0 + adds r0, #0x5a + ldrb r1, [r0] + movs r0, #0x80 + ands r0, r1 + cmp r0, #0 + beq _0806B91E + movs r0, #0 + bl SetRoomFlag + bl DeleteThisEntity +_0806B91E: + ldrb r0, [r5, #0xf] + subs r0, #1 + strb r0, [r5, #0xf] + lsls r0, r0, #0x18 + cmp r0, #0 + bne _0806B95A + movs r0, #0x20 + strb r0, [r5, #0xf] + ldr r0, _0806B938 @ =0x000001A9 + bl SoundReq + b _0806B95A + .align 2, 0 +_0806B938: .4byte 0x000001A9 +_0806B93C: + adds r0, r5, #0 + bl sub_0806B9BC + adds r4, r0, #0 + cmp r4, #0 + bne _0806B94E + bl DeleteThisEntity + b _0806B968 +_0806B94E: + ldrb r0, [r4, #0xd] + cmp r0, #0 + beq _0806B968 + ldrb r0, [r5, #0xa] + cmp r0, #4 + beq _0806B962 +_0806B95A: + adds r0, r5, #0 + bl UpdateAnimationSingleFrame + b _0806B968 +_0806B962: + adds r0, r5, #0 + bl GetNextFrame +_0806B968: + pop {r4, r5, pc} + .align 2, 0 + .syntax divided diff --git a/asm/vaatiReborn.s b/asm/vaatiReborn.s deleted file mode 100644 index 3e900ff0..00000000 --- a/asm/vaatiReborn.s +++ /dev/null @@ -1,451 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start VaatiReborn -VaatiReborn: @ 0x0806B664 - push {lr} - ldr r2, _0806B678 @ =gUnk_08112F78 - ldrb r1, [r0, #0xc] - lsls r1, r1, #2 - adds r1, r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {pc} - .align 2, 0 -_0806B678: .4byte gUnk_08112F78 - - thumb_func_start sub_0806B67C -sub_0806B67C: @ 0x0806B67C - push {r4, r5, r6, lr} - adds r6, r0, #0 - movs r1, #0 - movs r0, #1 - strb r0, [r6, #0xc] - strb r1, [r6, #0xd] - strb r1, [r6, #0xe] - ldrb r0, [r6, #0xa] - cmp r0, #5 - bls _0806B692 - b _0806B7B8 -_0806B692: - lsls r0, r0, #2 - ldr r1, _0806B69C @ =_0806B6A0 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_0806B69C: .4byte _0806B6A0 -_0806B6A0: @ jump table - .4byte _0806B6B8 @ case 0 - .4byte _0806B7A6 @ case 1 - .4byte _0806B70C @ case 2 - .4byte _0806B726 @ case 3 - .4byte _0806B7B0 @ case 4 - .4byte _0806B7A6 @ case 5 -_0806B6B8: - ldrh r0, [r6, #0x32] - subs r0, #0xa0 - strh r0, [r6, #0x32] - movs r0, #0xa0 - strb r0, [r6, #0xe] - movs r0, #0x20 - strb r0, [r6, #0xf] - adds r1, r6, #0 - adds r1, #0x63 - strb r0, [r1] - movs r5, #0 -_0806B6CE: - movs r0, #0x3b - movs r1, #2 - adds r2, r5, #0 - bl CreateNPC - adds r4, r0, #0 - cmp r4, #0 - beq _0806B6E0 - str r6, [r4, #0x50] -_0806B6E0: - adds r5, #1 - cmp r5, #3 - bls _0806B6CE - movs r0, #0x3b - movs r1, #1 - movs r2, #0 - bl CreateNPC - adds r4, r0, #0 - str r6, [r4, #0x50] - adds r1, r4, #0 - adds r1, #0x63 - movs r0, #0xff - strb r0, [r1] - movs r3, #0x80 - lsls r3, r3, #9 - adds r0, r6, #0 - adds r1, r4, #0 - movs r2, #0 - bl PositionRelative - b _0806B7A6 -_0806B70C: - ldrb r1, [r6, #0xb] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - beq _0806B71E - ldrb r0, [r6, #0x18] - movs r1, #0x40 - orrs r0, r1 - strb r0, [r6, #0x18] -_0806B71E: - adds r0, r6, #0 - bl sub_0806B96C - b _0806B7A6 -_0806B726: - movs r0, #1 - strb r0, [r6, #0xe] - movs r0, #0x20 - strb r0, [r6, #0xf] - movs r0, #0x3b - movs r1, #4 - movs r2, #0 - bl CreateNPC - adds r4, r0, #0 - cmp r4, #0 - beq _0806B76C - adds r0, r6, #0 - adds r1, r4, #0 - bl CopyPosition - str r6, [r4, #0x50] - adds r0, r6, #0 - adds r0, #0x29 - ldrb r1, [r0] - lsls r1, r1, #0x1d - lsrs r1, r1, #0x1d - subs r1, #1 - adds r3, r4, #0 - adds r3, #0x29 - movs r0, #7 - ands r1, r0 - ldrb r2, [r3] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - movs r0, #0 - strb r0, [r4, #0x1e] -_0806B76C: - movs r0, #0x3b - movs r1, #5 - movs r2, #0 - bl CreateNPC - adds r4, r0, #0 - cmp r4, #0 - beq _0806B7A6 - adds r0, r6, #0 - adds r1, r4, #0 - bl CopyPosition - str r6, [r4, #0x50] - adds r0, r6, #0 - adds r0, #0x29 - ldrb r1, [r0] - lsls r1, r1, #0x1d - lsrs r1, r1, #0x1d - adds r1, #1 - adds r3, r4, #0 - adds r3, #0x29 - movs r0, #7 - ands r1, r0 - ldrb r2, [r3] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] -_0806B7A6: - adds r0, r6, #0 - movs r1, #0 - bl InitAnimationForceUpdate - b _0806B7B8 -_0806B7B0: - adds r0, r6, #0 - movs r1, #0 - bl InitializeAnimation -_0806B7B8: - pop {r4, r5, r6, pc} - .align 2, 0 - - thumb_func_start sub_0806B7BC -sub_0806B7BC: @ 0x0806B7BC - push {r4, r5, lr} - adds r5, r0, #0 - movs r0, #3 - bl CheckRoomFlag - cmp r0, #0 - bne _0806B7CC - b _0806B968 -_0806B7CC: - ldrb r0, [r5, #0xa] - cmp r0, #1 - beq _0806B84C - cmp r0, #1 - bgt _0806B7DC - cmp r0, #0 - beq _0806B7E6 - b _0806B93C -_0806B7DC: - cmp r0, #2 - beq _0806B86C - cmp r0, #3 - beq _0806B874 - b _0806B93C -_0806B7E6: - ldrh r0, [r5, #0x32] - adds r0, #1 - strh r0, [r5, #0x32] - ldrb r0, [r5, #0xe] - subs r0, #1 - strb r0, [r5, #0xe] - movs r1, #0xff - lsls r0, r0, #0x18 - cmp r0, #0 - bne _0806B82C - movs r0, #0x3b - movs r1, #3 - movs r2, #0 - bl CreateNPC - adds r4, r0, #0 - cmp r4, #0 - bne _0806B80C - b _0806B968 -_0806B80C: - adds r0, r5, #0 - adds r1, r4, #0 - bl CopyPosition - ldr r0, _0806B828 @ =0x00001634 - bl TextboxNoOverlapFollow - ldrb r0, [r5, #0xd] - adds r0, #1 - strb r0, [r5, #0xd] - bl DeleteThisEntity - b _0806B968 - .align 2, 0 -_0806B828: .4byte 0x00001634 -_0806B82C: - ldrb r0, [r5, #0xf] - subs r0, #1 - strb r0, [r5, #0xf] - ands r0, r1 - cmp r0, #0 - beq _0806B83A - b _0806B95A -_0806B83A: - movs r0, #0x20 - strb r0, [r5, #0xf] - ldr r0, _0806B848 @ =0x000001A9 - bl SoundReq - b _0806B95A - .align 2, 0 -_0806B848: .4byte 0x000001A9 -_0806B84C: - adds r0, r5, #0 - bl sub_0806B9BC - adds r4, r0, #0 - cmp r4, #0 - bne _0806B85C - bl DeleteThisEntity -_0806B85C: - movs r3, #0x84 - lsls r3, r3, #0xe - adds r0, r4, #0 - adds r1, r5, #0 - movs r2, #0 - bl PositionRelative - b _0806B95A -_0806B86C: - adds r0, r5, #0 - bl sub_0806B96C - b _0806B95A -_0806B874: - ldrb r0, [r5, #0xd] - cmp r0, #1 - beq _0806B8A2 - cmp r0, #1 - bgt _0806B884 - cmp r0, #0 - beq _0806B88E - b _0806B91E -_0806B884: - cmp r0, #2 - beq _0806B8C4 - cmp r0, #3 - beq _0806B906 - b _0806B91E -_0806B88E: - ldrb r0, [r5, #0xe] - subs r0, #1 - strb r0, [r5, #0xe] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _0806B91E - ldrb r0, [r5, #0xd] - adds r0, #1 - strb r0, [r5, #0xd] - b _0806B91E -_0806B8A2: - adds r0, r5, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0806B91E - movs r0, #2 - strb r0, [r5, #0xd] - ldr r1, _0806B8C0 @ =0x0000013F - adds r0, r5, #0 - bl sub_0801D2B4 - b _0806B8FA - .align 2, 0 -_0806B8C0: .4byte 0x0000013F -_0806B8C4: - adds r2, r5, #0 - adds r2, #0x5a - ldrb r1, [r2] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _0806B91E - movs r0, #0xef - ands r0, r1 - strb r0, [r2] - ldrb r0, [r5, #0xe] - adds r0, #1 - strb r0, [r5, #0xe] - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #1 - beq _0806B91E - cmp r0, #0xa - bne _0806B91E - ldrb r0, [r5, #0xd] - adds r0, #1 - strb r0, [r5, #0xd] - movs r0, #0xf4 - bl EnqueueSFX - movs r0, #0 - strb r0, [r5, #0xe] -_0806B8FA: - ldrb r1, [r5, #0xd] - subs r1, #1 - adds r0, r5, #0 - bl InitAnimationForceUpdate - b _0806B91E -_0806B906: - adds r0, r5, #0 - adds r0, #0x5a - ldrb r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - beq _0806B91E - movs r0, #0 - bl SetRoomFlag - bl DeleteThisEntity -_0806B91E: - ldrb r0, [r5, #0xf] - subs r0, #1 - strb r0, [r5, #0xf] - lsls r0, r0, #0x18 - cmp r0, #0 - bne _0806B95A - movs r0, #0x20 - strb r0, [r5, #0xf] - ldr r0, _0806B938 @ =0x000001A9 - bl SoundReq - b _0806B95A - .align 2, 0 -_0806B938: .4byte 0x000001A9 -_0806B93C: - adds r0, r5, #0 - bl sub_0806B9BC - adds r4, r0, #0 - cmp r4, #0 - bne _0806B94E - bl DeleteThisEntity - b _0806B968 -_0806B94E: - ldrb r0, [r4, #0xd] - cmp r0, #0 - beq _0806B968 - ldrb r0, [r5, #0xa] - cmp r0, #4 - beq _0806B962 -_0806B95A: - adds r0, r5, #0 - bl UpdateAnimationSingleFrame - b _0806B968 -_0806B962: - adds r0, r5, #0 - bl GetNextFrame -_0806B968: - pop {r4, r5, pc} - .align 2, 0 - - thumb_func_start sub_0806B96C -sub_0806B96C: @ 0x0806B96C - push {r4, r5, lr} - adds r4, r0, #0 - bl sub_0806B9BC - adds r5, r0, #0 - cmp r5, #0 - bne _0806B97E - bl DeleteThisEntity -_0806B97E: - ldrb r3, [r4, #0xb] - lsls r3, r3, #1 - ldr r0, _0806B9B8 @ =gUnk_08112F80 - adds r3, r3, r0 - ldrb r1, [r5, #0x18] - lsls r1, r1, #0x1e - lsrs r1, r1, #0x1e - ldrb r2, [r4, #0x18] - movs r0, #4 - rsbs r0, r0, #0 - ands r0, r2 - orrs r0, r1 - strb r0, [r4, #0x18] - movs r2, #0 - ldrsb r2, [r3, r2] - lsls r2, r2, #0x10 - ldrb r3, [r3, #1] - lsls r3, r3, #0x18 - asrs r3, r3, #0x18 - adds r3, #0x21 - lsls r3, r3, #0x10 - adds r0, r5, #0 - adds r1, r4, #0 - bl PositionRelative - adds r0, r4, #0 - bl UpdateAnimationSingleFrame - pop {r4, r5, pc} - .align 2, 0 -_0806B9B8: .4byte gUnk_08112F80 - - thumb_func_start sub_0806B9BC -sub_0806B9BC: @ 0x0806B9BC - push {lr} - ldr r1, [r0, #0x50] - cmp r1, #0 - beq _0806B9CC - ldr r0, [r1, #4] - cmp r0, #0 - bne _0806B9CC - movs r1, #0 -_0806B9CC: - adds r0, r1, #0 - pop {pc} diff --git a/data/const/npc/vaatiReborn.s b/data/const/npc/vaatiReborn.s deleted file mode 100644 index b9db1ee2..00000000 --- a/data/const/npc/vaatiReborn.s +++ /dev/null @@ -1,12 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08112F78:: @ 08112F78 - .4byte sub_0806B67C - .4byte sub_0806B7BC - -gUnk_08112F80:: @ 08112F80 - .incbin "baserom.gba", 0x112F80, 0x0000008 diff --git a/include/npc.h b/include/npc.h index feec7fd9..c30b628b 100644 --- a/include/npc.h +++ b/include/npc.h @@ -5,6 +5,137 @@ #ifndef NPC_H #define NPC_H +enum NPC { + /*0x00*/ NPC_NONE_0, + /*0x01*/ GENTARI, + /*0x02*/ FESTARI, + /*0x03*/ FOREST_MINISH, + /*0x04*/ POSTMAN, + /*0x05*/ NPC_UNK_5, + /*0x06*/ TPWNSPERSON, + /*0x07*/ KID, + /*0x08*/ GUARD, + /*0x09*/ NPC_UNK_9, + /*0x0a*/ STAMP, + /*0x0b*/ MAID, + /*0x0c*/ MARCY, + /*0x0d*/ WHEATON, + /*0x0e*/ PITA, + /*0x0f*/ MINISH_EZLO, + /*0x10*/ MAILBOX, + /*0x11*/ BEEDLE, + /*0x12*/ BROCCO, + /*0x13*/ SITTING_PERSON, + /*0x14*/ PINA, + /*0x15*/ GUARD_1, + /*0x16*/ MAID_1, + /*0x17*/ DIN, + /*0x18*/ NAYRU, + /*0x19*/ FARORE, + /*0x1a*/ STURGEON, + /*0x1b*/ TINGLE_SIBLINGS, + /*0x1c*/ STOCKWELL, + /*0x1d*/ TALON, + /*0x1e*/ MALON, + /*0x1f*/ EPONA, + /*0x20*/ MILK_CART, + /*0x21*/ GHOST_BROTHERS, + /*0x22*/ SMITH, + /*0x23*/ NPC_UNK_23, + /*0x24*/ KING_DALTUS, + /*0x25*/ MINISTER_POTHO, + /*0x26*/ NPC_UNK_26, + /*0x27*/ VAATI, + /*0x28*/ ZELDA, + /*0x29*/ MUTOH, + /*0x2a*/ CARPENTER, + /*0x2b*/ CASTOR_WILDS_STATUE, + /*0x2c*/ CAT, + /*0x2d*/ MOUNTAIN_MINISH, + /*0x2e*/ ZELDA_FOLLOWER, + /*0x2f*/ MELARI, + /*0x30*/ BLADE_BROTHERS, + /*0x31*/ COW, + /*0x32*/ GORON, + /*0x33*/ GORON_MERCHANT, + /*0x34*/ GORMAN, + /*0x35*/ DOG, + /*0x36*/ SYRUP, + /*0x37*/ REM, + /*0x38*/ TOWN_MINISH, + /*0x39*/ LIBRARI, + /*0x3a*/ PERCY, + /*0x3b*/ VAATI_REBORN, + /*0x3c*/ MOBLIN_LADY, + /*0x3d*/ LIBRARIANS, + /*0x3e*/ FARMERS, + /*0x3f*/ CARLOV, + /*0x40*/ DAMPE, + /*0x41*/ DR_LEFT, + /*0x42*/ KING_GUSTAF, + /*0x43*/ GINA, + /*0x44*/ SIMON, + /*0x45*/ ANJU, + /*0x46*/ MAMA, + /*0x47*/ EMMA, + /*0x48*/ TEACHERS, + /*0x49*/ WIND_TRIBESPEOPLE, + /*0x4a*/ GREGAL, + /*0x4b*/ MAYOR_HAGEN, + /*0x4c*/ BIG_GORON, + /*0x4d*/ EZLO_CAP, + /*0x4e*/ NPC_UNK_4E, + /*0x4f*/ NPC_UNK_4F, + /*0x50*/ CLOTHES_RACK, + /*0x51*/ PICOLYTE_BOTTLE, + /*0x52*/ SMALL_TOWN_MINISH, + /*0x53*/ HURDY_GURDY_MAN, + /*0x54*/ CUCCO, + /*0x55*/ CUCCO_CHICK, + /*0x56*/ FUSION_MENU_NPC, + /*0x57*/ PHONOGRAPH, + /*0x58*/ NPC_UNK_58, + /*0x59*/ NPC_NONE_1, + /*0x5a*/ NPC_NONE_2, + /*0x5b*/ NPC_NONE_3, + /*0x5c*/ NPC_NONE_4, + /*0x5d*/ NPC_NONE_5, + /*0x5e*/ NPC_NONE_6, + /*0x5f*/ NPC_NONE_7, + /*0x60*/ NPC_NONE_8, + /*0x61*/ NPC_NONE_9, + /*0x62*/ NPC_NONE_10, + /*0x63*/ NPC_NONE_11, + /*0x64*/ NPC_NONE_12, + /*0x65*/ NPC_NONE_13, + /*0x66*/ NPC_NONE_14, + /*0x67*/ NPC_NONE_15, + /*0x68*/ NPC_NONE_16, + /*0x69*/ NPC_NONE_17, + /*0x6a*/ NPC_NONE_18, + /*0x6b*/ NPC_NONE_19, + /*0x6c*/ NPC_NONE_20, + /*0x6d*/ NPC_NONE_21, + /*0x6e*/ NPC_NONE_22, + /*0x6f*/ NPC_NONE_23, + /*0x70*/ NPC_NONE_24, + /*0x71*/ NPC_NONE_25, + /*0x72*/ NPC_NONE_26, + /*0x73*/ NPC_NONE_27, + /*0x74*/ NPC_NONE_28, + /*0x75*/ NPC_NONE_29, + /*0x76*/ NPC_NONE_30, + /*0x77*/ NPC_NONE_31, + /*0x78*/ NPC_NONE_32, + /*0x79*/ NPC_NONE_33, + /*0x7a*/ NPC_NONE_34, + /*0x7b*/ NPC_NONE_35, + /*0x7c*/ NPC_NONE_36, + /*0x7d*/ NPC_NONE_37, + /*0x7e*/ NPC_NONE_38, + /*0x7f*/ NPC_NONE_39, +}; + extern void Gentari(Entity*); extern void Gentari_Fusion(Entity*); extern void Festari(Entity*); diff --git a/linker.ld b/linker.ld index 98943203..b817528c 100644 --- a/linker.ld +++ b/linker.ld @@ -612,7 +612,7 @@ SECTIONS { src/npc/librari.o(.text); src/npc/percy.o(.text); asm/percy.o(.text); - asm/vaatiReborn.o(.text); + src/npc/vaatiReborn.o(.text); src/npc/moblinLady.o(.text); asm/librarians.o(.text); asm/farmers.o(.text); @@ -1330,7 +1330,7 @@ SECTIONS { data/animations/npc/librari.o(.rodata); data/const/npc/percy.o(.rodata); data/animations/npc/percy.o(.rodata); - data/const/npc/vaatiReborn.o(.rodata); + src/npc/vaatiReborn.o(.rodata); data/animations/npc/vaatiReborn.o(.rodata); data/const/npc/moblinLady.o(.rodata); data/animations/npc/moblinLady.o(.rodata); diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index 03914d2f..ff0fe542 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -241,10 +241,7 @@ bool32 sub_0803E4A0(Entity* this) { if (this->parent->currentHealth == 0) { return TRUE; } else { - ret = FALSE; - if (this->parent->next == NULL) { - ret = TRUE; - } + ret = this->parent->next == NULL; } } else { return TRUE; diff --git a/src/npc.c b/src/npc.c index 4a94399b..50e4c7ff 100644 --- a/src/npc.c +++ b/src/npc.c @@ -4,134 +4,134 @@ //clang-format off void (*const gNPCFunctions[][3])(Entity* ent) = { - /*0x00*/ { DeleteEntity, NULL, NULL }, - /*0x01*/ { Gentari, NULL, Gentari_Fusion }, - /*0x02*/ { Festari, NULL, Festari_Fusion }, - /*0x03*/ { ForestMinish, ForestMinish_Head, ForestMinish_Fusion }, - /*0x04*/ { Postman, NULL, Postman_Fusion }, - /*0x05*/ { NPC5, NULL, NULL }, - /*0x06*/ { Townsperson, Townsperson_Head, Townsperson_Fusion }, - /*0x07*/ { Kid, Kid_Head, Kid_Fusion }, - /*0x08*/ { Guard, Guard_Head, NULL }, - /*0x09*/ { NPC9, NULL, NULL }, - /*0x0a*/ { Stamp, NULL, NULL }, - /*0x0b*/ { Maid, Maid_Head, NULL }, - /*0x0c*/ { Marcy, NULL, NULL }, - /*0x0d*/ { Wheaton, NULL, NULL }, - /*0x0e*/ { Pita, NULL, NULL }, - /*0x0f*/ { MinishEzlo, MinishEzlo_Head, NULL }, - /*0x10*/ { Mailbox, NULL, NULL }, - /*0x11*/ { Beedle, Beedle_Head, NULL }, - /*0x12*/ { Brocco, NULL, Brocco_Fusion }, - /*0x13*/ { SittingPerson, SittingPerson_Head, SittingPerson_Fusion }, - /*0x14*/ { Pina, NULL, Pina_Fusion }, - /*0x15*/ { Guard, Guard_Head, NULL }, - /*0x16*/ { Maid, Maid_Head, NULL }, - /*0x17*/ { Din, NULL, Din_Fusion }, - /*0x18*/ { Nayru, NULL, Nayru_Fusion }, - /*0x19*/ { Farore, NULL, Farore_Fusion }, - /*0x1a*/ { Sturgeon, Sturgeon_Head, Sturgeon_Fusion }, - /*0x1b*/ { TingleSiblings, NULL, TingleSiblings_Fusion }, - /*0x1c*/ { Stockwell, NULL, NULL }, - /*0x1d*/ { Talon, Talon_Head, Talon_Fusion }, - /*0x1e*/ { Malon, NULL, Malon_Fusion }, - /*0x1f*/ { Epona, NULL, Epona_Fusion }, - /*0x20*/ { MilkCart, NULL, NULL }, - /*0x21*/ { GhostBrothers, NULL, GhostBrothers_Fusion }, - /*0x22*/ { Smith, Smith_Head, Smith_Fusion }, - /*0x23*/ { NPC23, NULL, NULL }, - /*0x24*/ { KingDaltus, NULL, KingDaltus_Fusion }, - /*0x25*/ { MinisterPotho, NULL, MinisterPotho_Fusion }, - /*0x26*/ { NPC26, NULL, NULL }, - /*0x27*/ { Vaati, NULL, NULL }, - /*0x28*/ { Zelda, NULL, NULL }, - /*0x29*/ { Mutoh, Mutoh_Head, Mutoh_Fusion }, - /*0x2a*/ { Carpenter, Carpenter_Head, Carpenter_Fusion }, - /*0x2b*/ { CastorWildsStatue, NULL, CastorWildsStatue_Fusion }, - /*0x2c*/ { Cat, NULL, Cat_Fusion }, - /*0x2d*/ { MountainMinish, MountainMinish_Head, MountainMinish_Fusion }, - /*0x2e*/ { ZeldaFollower, NULL, NULL }, - /*0x2f*/ { Melari, Melari_Head, Melari_Fusion }, - /*0x30*/ { BladeBrothers, NULL, BladeBrothers_Fusion }, - /*0x31*/ { Cow, NULL, Cow_Fusion }, - /*0x32*/ { Goron, NULL, Goron_Fusion }, - /*0x33*/ { GoronMerchant, NULL, NULL }, - /*0x34*/ { Gorman, Gorman_Head, NULL }, - /*0x35*/ { Dog, Dog_Head, Dog_Fusion }, - /*0x36*/ { Syrup, Syrup_Head, NULL }, - /*0x37*/ { Rem, NULL, NULL }, - /*0x38*/ { TownMinish, TownMinish_Head, TownMinish_Fusion }, - /*0x39*/ { Librari, NULL, Librari_Fusion }, - /*0x3a*/ { Percy, Percy_Head, Percy_Fusion }, - /*0x3b*/ { VaatiReborn, NULL, NULL }, - /*0x3c*/ { MoblinLady, NULL, NULL }, - /*0x3d*/ { Librarians, NULL, NULL }, - /*0x3e*/ { Farmers, Farmers_Head, Farmers_Fusion }, - /*0x3f*/ { Carlov, NULL, NULL }, - /*0x40*/ { Dampe, NULL, Dampe_Fusion }, - /*0x41*/ { DrLeft, NULL, NULL }, - /*0x42*/ { KingGustaf, NULL, NULL }, - /*0x43*/ { Gina, NULL, Gina_Fusion }, - /*0x44*/ { Simon, NULL, NULL }, - /*0x45*/ { Anju, NULL, Anju_Fusion }, - /*0x46*/ { Mama, Mama_Head, Mama_Fusion }, - /*0x47*/ { Emma, NULL, NULL }, - /*0x48*/ { Teachers, Teachers_Head, Teachers_Fusion }, - /*0x49*/ { WindTribespeople, WindTribespeople_Head, WindTribespeople_Fusion }, - /*0x4a*/ { Gregal, NULL, Gregal_Fusion }, - /*0x4b*/ { MayorHagen, NULL, MayorHagen_Fusion }, - /*0x4c*/ { BigGoron, NULL, NULL }, - /*0x4d*/ { EzloCap, NULL, NULL }, - /*0x4e*/ { NPC4E, NULL, NPC4E_Fusion }, - /*0x4f*/ { NPC4F, NULL, NULL }, - /*0x50*/ { ClothesRack, NULL, NULL }, - /*0x51*/ { PicolyteBottle, NULL, NULL }, - /*0x52*/ { SmallTownMinish, NULL, NULL }, - /*0x53*/ { HurdyGurdyMan, HurdyGurdyMan_Head, HurdyGurdyMan_Fusion }, - /*0x54*/ { Cucco, NULL, Cucco_Fusion }, - /*0x55*/ { CuccoChick, NULL, CuccoChick_Fusion }, - /*0x56*/ { FusionMenuNPC, FusionMenuNPC_Head, NULL }, - /*0x57*/ { Phonograph, NULL, NULL }, - /*0x58*/ { NPC58, NPC58_Head, NULL }, - /*0x59*/ { DeleteEntity, NULL, NULL }, - /*0x5a*/ { DeleteEntity, NULL, NULL }, - /*0x5b*/ { DeleteEntity, NULL, NULL }, - /*0x5c*/ { DeleteEntity, NULL, NULL }, - /*0x5d*/ { DeleteEntity, NULL, NULL }, - /*0x5e*/ { DeleteEntity, NULL, NULL }, - /*0x5f*/ { DeleteEntity, NULL, NULL }, - /*0x60*/ { DeleteEntity, NULL, NULL }, - /*0x61*/ { DeleteEntity, NULL, NULL }, - /*0x62*/ { DeleteEntity, NULL, NULL }, - /*0x63*/ { DeleteEntity, NULL, NULL }, - /*0x64*/ { DeleteEntity, NULL, NULL }, - /*0x65*/ { DeleteEntity, NULL, NULL }, - /*0x66*/ { DeleteEntity, NULL, NULL }, - /*0x67*/ { DeleteEntity, NULL, NULL }, - /*0x68*/ { DeleteEntity, NULL, NULL }, - /*0x69*/ { DeleteEntity, NULL, NULL }, - /*0x6a*/ { DeleteEntity, NULL, NULL }, - /*0x6b*/ { DeleteEntity, NULL, NULL }, - /*0x6c*/ { DeleteEntity, NULL, NULL }, - /*0x6d*/ { DeleteEntity, NULL, NULL }, - /*0x6e*/ { DeleteEntity, NULL, NULL }, - /*0x6f*/ { DeleteEntity, NULL, NULL }, - /*0x70*/ { DeleteEntity, NULL, NULL }, - /*0x71*/ { DeleteEntity, NULL, NULL }, - /*0x72*/ { DeleteEntity, NULL, NULL }, - /*0x73*/ { DeleteEntity, NULL, NULL }, - /*0x74*/ { DeleteEntity, NULL, NULL }, - /*0x75*/ { DeleteEntity, NULL, NULL }, - /*0x76*/ { DeleteEntity, NULL, NULL }, - /*0x77*/ { DeleteEntity, NULL, NULL }, - /*0x78*/ { DeleteEntity, NULL, NULL }, - /*0x79*/ { DeleteEntity, NULL, NULL }, - /*0x7a*/ { DeleteEntity, NULL, NULL }, - /*0x7b*/ { DeleteEntity, NULL, NULL }, - /*0x7c*/ { DeleteEntity, NULL, NULL }, - /*0x7d*/ { DeleteEntity, NULL, NULL }, - /*0x7e*/ { DeleteEntity, NULL, NULL }, - /*0x7f*/ { DeleteEntity, NULL, NULL } + [NPC_NONE_0] = { DeleteEntity, NULL, NULL }, + [GENTARI] = { Gentari, NULL, Gentari_Fusion }, + [FESTARI] = { Festari, NULL, Festari_Fusion }, + [FOREST_MINISH] = { ForestMinish, ForestMinish_Head, ForestMinish_Fusion }, + [POSTMAN] = { Postman, NULL, Postman_Fusion }, + [NPC_UNK_5] = { NPC5, NULL, NULL }, + [TPWNSPERSON] = { Townsperson, Townsperson_Head, Townsperson_Fusion }, + [KID] = { Kid, Kid_Head, Kid_Fusion }, + [GUARD] = { Guard, Guard_Head, NULL }, + [NPC_UNK_9] = { NPC9, NULL, NULL }, + [STAMP] = { Stamp, NULL, NULL }, + [MAID] = { Maid, Maid_Head, NULL }, + [MARCY] = { Marcy, NULL, NULL }, + [WHEATON] = { Wheaton, NULL, NULL }, + [PITA] = { Pita, NULL, NULL }, + [MINISH_EZLO] = { MinishEzlo, MinishEzlo_Head, NULL }, + [MAILBOX] = { Mailbox, NULL, NULL }, + [BEEDLE] = { Beedle, Beedle_Head, NULL }, + [BROCCO] = { Brocco, NULL, Brocco_Fusion }, + [SITTING_PERSON] = { SittingPerson, SittingPerson_Head, SittingPerson_Fusion }, + [PINA] = { Pina, NULL, Pina_Fusion }, + [GUARD_1] = { Guard, Guard_Head, NULL }, + [MAID_1] = { Maid, Maid_Head, NULL }, + [DIN] = { Din, NULL, Din_Fusion }, + [NAYRU] = { Nayru, NULL, Nayru_Fusion }, + [FARORE] = { Farore, NULL, Farore_Fusion }, + [STURGEON] = { Sturgeon, Sturgeon_Head, Sturgeon_Fusion }, + [TINGLE_SIBLINGS] = { TingleSiblings, NULL, TingleSiblings_Fusion }, + [STOCKWELL] = { Stockwell, NULL, NULL }, + [TALON] = { Talon, Talon_Head, Talon_Fusion }, + [MALON] = { Malon, NULL, Malon_Fusion }, + [EPONA] = { Epona, NULL, Epona_Fusion }, + [MILK_CART] = { MilkCart, NULL, NULL }, + [GHOST_BROTHERS] = { GhostBrothers, NULL, GhostBrothers_Fusion }, + [SMITH] = { Smith, Smith_Head, Smith_Fusion }, + [NPC_UNK_23] = { NPC23, NULL, NULL }, + [KING_DALTUS] = { KingDaltus, NULL, KingDaltus_Fusion }, + [MINISTER_POTHO] = { MinisterPotho, NULL, MinisterPotho_Fusion }, + [NPC_UNK_26] = { NPC26, NULL, NULL }, + [VAATI] = { Vaati, NULL, NULL }, + [ZELDA] = { Zelda, NULL, NULL }, + [MUTOH] = { Mutoh, Mutoh_Head, Mutoh_Fusion }, + [CARPENTER] = { Carpenter, Carpenter_Head, Carpenter_Fusion }, + [CASTOR_WILDS_STATUE] = { CastorWildsStatue, NULL, CastorWildsStatue_Fusion }, + [CAT] = { Cat, NULL, Cat_Fusion }, + [MOUNTAIN_MINISH] = { MountainMinish, MountainMinish_Head, MountainMinish_Fusion }, + [ZELDA_FOLLOWER] = { ZeldaFollower, NULL, NULL }, + [MELARI] = { Melari, Melari_Head, Melari_Fusion }, + [BLADE_BROTHERS] = { BladeBrothers, NULL, BladeBrothers_Fusion }, + [COW] = { Cow, NULL, Cow_Fusion }, + [GORON] = { Goron, NULL, Goron_Fusion }, + [GORON_MERCHANT] = { GoronMerchant, NULL, NULL }, + [GORMAN] = { Gorman, Gorman_Head, NULL }, + [DOG] = { Dog, Dog_Head, Dog_Fusion }, + [SYRUP] = { Syrup, Syrup_Head, NULL }, + [REM] = { Rem, NULL, NULL }, + [TOWN_MINISH] = { TownMinish, TownMinish_Head, TownMinish_Fusion }, + [LIBRARI] = { Librari, NULL, Librari_Fusion }, + [PERCY] = { Percy, Percy_Head, Percy_Fusion }, + [VAATI_REBORN] = { VaatiReborn, NULL, NULL }, + [MOBLIN_LADY] = { MoblinLady, NULL, NULL }, + [LIBRARIANS] = { Librarians, NULL, NULL }, + [FARMERS] = { Farmers, Farmers_Head, Farmers_Fusion }, + [CARLOV] = { Carlov, NULL, NULL }, + [DAMPE] = { Dampe, NULL, Dampe_Fusion }, + [DR_LEFT] = { DrLeft, NULL, NULL }, + [KING_GUSTAF] = { KingGustaf, NULL, NULL }, + [GINA] = { Gina, NULL, Gina_Fusion }, + [SIMON] = { Simon, NULL, NULL }, + [ANJU] = { Anju, NULL, Anju_Fusion }, + [MAMA] = { Mama, Mama_Head, Mama_Fusion }, + [EMMA] = { Emma, NULL, NULL }, + [TEACHERS] = { Teachers, Teachers_Head, Teachers_Fusion }, + [WIND_TRIBESPEOPLE] = { WindTribespeople, WindTribespeople_Head, WindTribespeople_Fusion }, + [GREGAL] = { Gregal, NULL, Gregal_Fusion }, + [MAYOR_HAGEN] = { MayorHagen, NULL, MayorHagen_Fusion }, + [BIG_GORON] = { BigGoron, NULL, NULL }, + [EZLO_CAP] = { EzloCap, NULL, NULL }, + [NPC_UNK_4E] = { NPC4E, NULL, NPC4E_Fusion }, + [NPC_UNK_4F] = { NPC4F, NULL, NULL }, + [CLOTHES_RACK] = { ClothesRack, NULL, NULL }, + [PICOLYTE_BOTTLE] = { PicolyteBottle, NULL, NULL }, + [SMALL_TOWN_MINISH] = { SmallTownMinish, NULL, NULL }, + [HURDY_GURDY_MAN] = { HurdyGurdyMan, HurdyGurdyMan_Head, HurdyGurdyMan_Fusion }, + [CUCCO] = { Cucco, NULL, Cucco_Fusion }, + [CUCCO_CHICK] = { CuccoChick, NULL, CuccoChick_Fusion }, + [FUSION_MENU_NPC] = { FusionMenuNPC, FusionMenuNPC_Head, NULL }, + [PHONOGRAPH] = { Phonograph, NULL, NULL }, + [NPC_UNK_58] = { NPC58, NPC58_Head, NULL }, + [NPC_NONE_1] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_2] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_3] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_4] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_5] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_6] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_7] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_8] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_9] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_10] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_11] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_12] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_13] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_14] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_15] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_16] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_17] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_18] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_19] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_20] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_21] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_22] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_23] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_24] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_25] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_26] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_27] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_28] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_29] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_30] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_31] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_32] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_33] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_34] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_35] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_36] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_37] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_38] = { DeleteEntity, NULL, NULL }, + [NPC_NONE_39] = { DeleteEntity, NULL, NULL } }; //clang-format on const u8 npc_unk[] = { 0x04, 0x05, 0x06, 0x06 }; diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c new file mode 100644 index 00000000..bf8defee --- /dev/null +++ b/src/npc/vaatiReborn.c @@ -0,0 +1,115 @@ +#include "global.h" +#include "npc.h" +#include "coord.h" +#include "flags.h" +#include "audio.h" +#include "textbox.h" +#include "functions.h" + +void sub_0806B67C(Entity*); +void sub_0806B7BC(Entity*); +void sub_0806B96C(Entity*); +Entity* sub_0806B9BC(Entity*); + +typedef struct xy { + s8 x; + s8 y; +} PACKED xy; + +void (*const gUnk_08112F78[])(Entity*) = { + sub_0806B67C, + sub_0806B7BC, +}; +const xy gUnk_08112F80[] = { { 10, -29 }, { -10, -29 }, { 15, -21 }, { -15, -21 } }; + +void VaatiReborn(Entity* this) { + gUnk_08112F78[this->action](this); +} + +void sub_0806B67C(Entity* this) { + Entity* entity; + u32 i; + + this->action = 1; + this->subAction = 0; + this->actionDelay = 0; + switch (this->type) { + case 0: + this->y.HALF.HI -= 0xa0; + this->actionDelay = 0xa0; + this->field_0xf = 0x20; + this->spriteOffsetY = 0x20; + for (i = 0; i < 4; i++) { + entity = CreateNPC(VAATI_REBORN, 2, i); + if (entity != NULL) { + entity->parent = this; + } + } + entity = CreateNPC(VAATI_REBORN, 1, 0); + entity->parent = this; + entity->spriteOffsetY = -1; + PositionRelative(this, entity, 0, 0x10000); + InitAnimationForceUpdate(this, 0); + break; + case 1: + case 5: + InitAnimationForceUpdate(this, 0); + break; + case 2: + if ((this->type2 & 2) != 0) { + this->spriteSettings.b.flipX = 1; + } + sub_0806B96C(this); + InitAnimationForceUpdate(this, 0); + break; + case 3: + this->actionDelay = 1; + this->field_0xf = 0x20; + entity = CreateNPC(VAATI_REBORN, 4, 0); + if (entity != NULL) { + CopyPosition(this, entity); + entity->parent = this; + entity->spritePriority.b0 = this->spritePriority.b0 - 1; + entity->frameIndex = 0; + } + entity = CreateNPC(VAATI_REBORN, 5, 0); + if (entity != NULL) { + CopyPosition(this, entity); + entity->parent = this; + entity->spritePriority.b0 = this->spritePriority.b0 + 1; + } + InitAnimationForceUpdate(this, 0); + break; + case 4: + InitializeAnimation(this, 0); + break; + default: + break; + } +} + +ASM_FUNC("asm/non_matching/vaati/sub_0806B7BC.inc", void sub_0806B7BC(Entity* this)) + +void sub_0806B96C(Entity* this) { + Entity* entity; + const xy* ptr; + + entity = sub_0806B9BC(this); + if (entity == NULL) { + DeleteThisEntity(); + } + ptr = &gUnk_08112F80[this->type2]; + this->spriteSettings.b.draw = entity->spriteSettings.b.draw; + PositionRelative(entity, this, ptr->x << 0x10, (ptr->y + 0x21) << 0x10); + UpdateAnimationSingleFrame(this); +} + +Entity* sub_0806B9BC(Entity* this) { + Entity* entity; + + entity = this->parent; + if (entity != NULL && entity->next == NULL) { + entity = NULL; + } + return entity; +}