diff --git a/asm/macros/scripts.inc b/asm/macros/scripts.inc index d1c48d25..5adcf2fb 100644 --- a/asm/macros/scripts.inc +++ b/asm/macros/scripts.inc @@ -462,7 +462,7 @@ .2byte \s .endm -.macro _0807E9F0 +.macro UpdateFusion .2byte 0x0456 .endm diff --git a/asm/non_matching/DispCtrlSet.inc b/asm/non_matching/DispCtrlSet.inc deleted file mode 100644 index cadf64af..00000000 --- a/asm/non_matching/DispCtrlSet.inc +++ /dev/null @@ -1,131 +0,0 @@ - .syntax unified - ldr r3, _08016DF0 @ =gScreen - ldrh r1, [r3] - ldrh r0, [r3, #6] - ands r0, r1 - movs r1, #0x80 - lsls r1, r1, #0x13 - strh r0, [r1] - adds r1, #8 - ldrh r0, [r3, #8] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x14] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x20] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x2c] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0xa] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0xc] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x16] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x18] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x22] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x24] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x2e] - strh r0, [r1] - adds r1, #2 - ldrh r0, [r3, #0x30] - strh r0, [r1] - adds r1, r3, #0 - adds r1, #0x38 - ldr r2, _08016DF4 @ =0x04000020 - ldrh r0, [r3, #0x38] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #2] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #4] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #6] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #8] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xa] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xc] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xe] - strh r0, [r2] - adds r1, #0x10 - adds r2, #2 - ldrh r0, [r1] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #2] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #4] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #6] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #8] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xa] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xc] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xe] - strh r0, [r2] - adds r1, #0x10 - adds r2, #2 - ldrh r0, [r1] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #2] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #4] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #6] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #8] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xa] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0xc] - strh r0, [r2] - adds r2, #4 - ldrh r0, [r1, #0xe] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0x10] - strh r0, [r2] - adds r2, #2 - ldrh r0, [r1, #0x12] - strh r0, [r2] - bx lr - .align 2, 0 -_08016DF0: .4byte gScreen -_08016DF4: .4byte 0x04000020 - .syntax divided diff --git a/asm/non_matching/beanstalkSubtask/sub_0801A570.inc b/asm/non_matching/beanstalkSubtask/sub_0801A570.inc deleted file mode 100644 index 79670f74..00000000 --- a/asm/non_matching/beanstalkSubtask/sub_0801A570.inc +++ /dev/null @@ -1,454 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - adds r6, r0, #0 - mov sl, r1 - cmp r6, #0 - bne _0801A58C - ldr r0, _0801A588 @ =0x0000FFFF - b _0801A8C2 - .align 2, 0 -_0801A588: .4byte 0x0000FFFF -_0801A58C: - adds r4, r6, #0 - adds r4, #0x38 - ldrb r0, [r4] - bl GetLayerByIndex - mov r8, r0 - ldr r0, _0801A668 @ =0x00005004 - add r0, r8 - mov ip, r0 - movs r5, #4 - movs r7, #2 - ldrb r0, [r6, #0x14] - lsrs r0, r0, #1 - mov sb, r4 - cmp r0, #1 - beq _0801A678 - cmp r0, #1 - ble _0801A5BC - cmp r0, #2 - bne _0801A5B6 - b _0801A73C -_0801A5B6: - cmp r0, #3 - bne _0801A5BC - b _0801A7FC -_0801A5BC: - movs r1, #0x2e - ldrsh r0, [r6, r1] - ldr r2, _0801A66C @ =gRoomControls - ldrh r1, [r2, #6] - subs r0, r0, r1 - asrs r4, r0, #4 - movs r3, #0x3f - ands r4, r3 - movs r1, #0x32 - ldrsh r0, [r6, r1] - ldrh r1, [r2, #8] - adds r1, #0xa - subs r0, r0, r1 - asrs r0, r0, #4 - ands r0, r3 - lsls r0, r0, #6 - orrs r4, r0 - mov r2, r8 - adds r2, #4 - movs r3, #0xdc - lsls r3, r3, #2 - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A5EA: - ldrh r0, [r1] - lsls r0, r0, #1 - add r0, ip - ldrh r0, [r0] - cmp r0, r3 - beq _0801A600 - subs r1, #2 - subs r4, #1 - subs r5, #1 - cmp r5, #0 - bne _0801A5EA -_0801A600: - subs r4, #0x40 - movs r3, #0xdd - lsls r3, r3, #2 - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A60A: - ldrh r0, [r1] - lsls r0, r0, #1 - add r0, ip - ldrh r0, [r0] - cmp r0, r3 - bne _0801A620 - adds r7, #1 - subs r1, #0x80 - subs r4, #0x40 - cmp r7, #3 - bls _0801A60A -_0801A620: - mov r2, sl - cmp r2, #0 - bne _0801A628 - b _0801A8C0 -_0801A628: - mov r0, sb - ldrb r1, [r0] - adds r0, r4, #0 - bl GetMetaTileType - adds r5, r0, #0 - ldr r1, _0801A670 @ =0xFFFFFC97 - adds r0, r5, r1 - cmp r0, #1 - bls _0801A63E - b _0801A8B4 -_0801A63E: - ldr r2, _0801A674 @ =0x00001FC4 - adds r0, r4, r2 - mov r2, r8 - adds r1, r2, r0 - movs r5, #0 - cmp r5, r7 - blo _0801A64E - b _0801A8B6 -_0801A64E: - ldrb r0, [r1] - cmp r0, #0 - beq _0801A656 - b _0801A8B4 -_0801A656: - adds r5, #1 - cmp r5, r7 - blo _0801A65E - b _0801A8B6 -_0801A65E: - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, #0 - beq _0801A656 - b _0801A8B4 - .align 2, 0 -_0801A668: .4byte 0x00005004 -_0801A66C: .4byte gRoomControls -_0801A670: .4byte 0xFFFFFC97 -_0801A674: .4byte 0x00001FC4 -_0801A678: - movs r0, #0x2e - ldrsh r1, [r6, r0] - ldr r3, _0801A730 @ =gRoomControls - ldrh r0, [r3, #6] - subs r0, #0xa - subs r1, r1, r0 - asrs r4, r1, #4 - movs r2, #0x3f - ands r4, r2 - movs r1, #0x32 - ldrsh r0, [r6, r1] - ldrh r1, [r3, #8] - subs r0, r0, r1 - asrs r0, r0, #4 - ands r0, r2 - lsls r0, r0, #6 - orrs r4, r0 - mov r2, r8 - adds r2, #4 - mov r3, ip - movs r6, #0xdc - lsls r6, r6, #2 - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A6A8: - ldrh r0, [r1] - lsls r0, r0, #1 - adds r0, r3, r0 - ldrh r0, [r0] - cmp r0, r6 - beq _0801A6BE - adds r1, #0x80 - adds r4, #0x40 - subs r5, #1 - cmp r5, #0 - bne _0801A6A8 -_0801A6BE: - subs r4, #0x40 - movs r3, #0xdd - lsls r3, r3, #2 - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A6C8: - ldrh r0, [r1] - lsls r0, r0, #1 - add r0, ip - ldrh r0, [r0] - cmp r0, r3 - bne _0801A6DE - adds r7, #1 - subs r1, #0x80 - subs r4, #0x40 - cmp r7, #3 - bls _0801A6C8 -_0801A6DE: - mov r2, sl - cmp r2, #0 - bne _0801A6E6 - b _0801A8C0 -_0801A6E6: - mov r0, sb - ldrb r1, [r0] - adds r0, r4, #0 - bl GetMetaTileType - adds r5, r0, #0 - ldr r0, _0801A734 @ =0x00000369 - cmp r5, r0 - beq _0801A700 - adds r0, #4 - cmp r5, r0 - beq _0801A700 - b _0801A8B4 -_0801A700: - adds r0, r4, r7 - ldr r1, _0801A738 @ =0x00002004 - adds r0, r0, r1 - mov r2, r8 - adds r1, r2, r0 - movs r5, #0 - cmp r5, r7 - blo _0801A712 - b _0801A8B6 -_0801A712: - ldrb r0, [r1] - cmp r0, #0 - beq _0801A71A - b _0801A8B4 -_0801A71A: - adds r5, #1 - cmp r5, r7 - blo _0801A722 - b _0801A8B6 -_0801A722: - lsls r0, r5, #6 - adds r0, r0, r1 - ldrb r0, [r0] - cmp r0, #0 - beq _0801A71A - b _0801A8B4 - .align 2, 0 -_0801A730: .4byte gRoomControls -_0801A734: .4byte 0x00000369 -_0801A738: .4byte 0x00002004 -_0801A73C: - movs r1, #0x2e - ldrsh r0, [r6, r1] - ldr r2, _0801A7E8 @ =gRoomControls - ldrh r1, [r2, #6] - subs r0, r0, r1 - asrs r4, r0, #4 - movs r3, #0x3f - ands r4, r3 - movs r1, #0x32 - ldrsh r0, [r6, r1] - ldrh r1, [r2, #8] - subs r1, #0xa - subs r0, r0, r1 - asrs r0, r0, #4 - ands r0, r3 - lsls r0, r0, #6 - orrs r4, r0 - mov r2, r8 - adds r2, #4 - mov r3, ip - ldr r6, _0801A7EC @ =0x0000036F - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A76A: - ldrh r0, [r1] - lsls r0, r0, #1 - adds r0, r3, r0 - ldrh r0, [r0] - cmp r0, r6 - beq _0801A780 - adds r1, #2 - adds r4, #1 - subs r5, #1 - cmp r5, #0 - bne _0801A76A -_0801A780: - subs r4, #1 - ldr r3, _0801A7F0 @ =0x00000372 - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A788: - ldrh r0, [r1] - lsls r0, r0, #1 - add r0, ip - ldrh r0, [r0] - cmp r0, r3 - bne _0801A79E - adds r7, #1 - subs r1, #2 - subs r4, #1 - cmp r7, #3 - bls _0801A788 -_0801A79E: - mov r2, sl - cmp r2, #0 - bne _0801A7A6 - b _0801A8C0 -_0801A7A6: - mov r0, sb - ldrb r1, [r0] - adds r0, r4, #0 - bl GetMetaTileType - adds r5, r0, #0 - ldr r0, _0801A7F4 @ =0x00000369 - cmp r5, r0 - beq _0801A7BE - adds r0, #2 - cmp r5, r0 - bne _0801A8B4 -_0801A7BE: - lsls r0, r7, #6 - adds r0, r4, r0 - ldr r1, _0801A7F8 @ =0x00002004 - adds r0, r0, r1 - mov r2, r8 - adds r1, r2, r0 - movs r5, #0 - cmp r5, r7 - bhs _0801A8B6 - ldrb r0, [r1] - cmp r0, #0 - bne _0801A8B4 -_0801A7D6: - adds r5, #1 - cmp r5, r7 - bhs _0801A8B6 - adds r0, r1, r5 - ldrb r0, [r0] - cmp r0, #0 - beq _0801A7D6 - b _0801A8B4 - .align 2, 0 -_0801A7E8: .4byte gRoomControls -_0801A7EC: .4byte 0x0000036F -_0801A7F0: .4byte 0x00000372 -_0801A7F4: .4byte 0x00000369 -_0801A7F8: .4byte 0x00002004 -_0801A7FC: - movs r0, #0x2e - ldrsh r1, [r6, r0] - ldr r3, _0801A890 @ =gRoomControls - ldrh r0, [r3, #6] - adds r0, #0xa - subs r1, r1, r0 - asrs r4, r1, #4 - movs r2, #0x3f - ands r4, r2 - movs r1, #0x32 - ldrsh r0, [r6, r1] - ldrh r1, [r3, #8] - subs r0, r0, r1 - asrs r0, r0, #4 - ands r0, r2 - lsls r0, r0, #6 - orrs r4, r0 - mov r2, r8 - adds r2, #4 - mov r3, ip - ldr r6, _0801A894 @ =0x0000036F - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A82A: - ldrh r0, [r1] - lsls r0, r0, #1 - adds r0, r3, r0 - ldrh r0, [r0] - cmp r0, r6 - beq _0801A840 - subs r1, #0x80 - subs r4, #0x40 - subs r5, #1 - cmp r5, #0 - bne _0801A82A -_0801A840: - subs r4, #1 - ldr r3, _0801A898 @ =0x00000372 - lsls r0, r4, #1 - adds r1, r0, r2 -_0801A848: - ldrh r0, [r1] - lsls r0, r0, #1 - add r0, ip - ldrh r0, [r0] - cmp r0, r3 - bne _0801A85E - adds r7, #1 - subs r1, #2 - subs r4, #1 - cmp r7, #3 - bls _0801A848 -_0801A85E: - mov r2, sl - cmp r2, #0 - beq _0801A8C0 - mov r0, sb - ldrb r1, [r0] - adds r0, r4, #0 - bl GetMetaTileType - adds r5, r0, #0 - ldr r0, _0801A89C @ =0x00000369 - cmp r5, r0 - beq _0801A87C - adds r0, #3 - cmp r5, r0 - bne _0801A8B4 -_0801A87C: - ldr r1, _0801A8A0 @ =0x00002003 - adds r0, r4, r1 - mov r2, r8 - adds r1, r2, r0 - movs r5, #0 - cmp r5, r7 - bhs _0801A8B6 - ldrb r0, [r1] - b _0801A8B0 - .align 2, 0 -_0801A890: .4byte gRoomControls -_0801A894: .4byte 0x0000036F -_0801A898: .4byte 0x00000372 -_0801A89C: .4byte 0x00000369 -_0801A8A0: .4byte 0x00002003 -_0801A8A4: - adds r5, #1 - cmp r5, r7 - bhs _0801A8B6 - lsls r0, r5, #6 - adds r0, r0, r1 - ldrb r0, [r0] -_0801A8B0: - cmp r0, #0 - beq _0801A8A4 -_0801A8B4: - ldr r4, _0801A8CC @ =0x0000FFFF -_0801A8B6: - mov r0, sl - cmp r0, #0 - beq _0801A8C0 - lsls r0, r7, #0xc - orrs r4, r0 -_0801A8C0: - adds r0, r4, #0 -_0801A8C2: - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_0801A8CC: .4byte 0x0000FFFF - .syntax divided diff --git a/asm/non_matching/code_0807CC3C/sub_0807D280.inc b/asm/non_matching/code_0807CC3C/sub_0807D280.inc deleted file mode 100644 index bc06cc5e..00000000 --- a/asm/non_matching/code_0807CC3C/sub_0807D280.inc +++ /dev/null @@ -1,264 +0,0 @@ - - .syntax unified - - .text - - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - adds r6, r0, #0 - adds r5, r1, #0 - ldr r1, _0807D2B0 @ =gRoomControls - movs r0, #0xa - ldrsh r2, [r1, r0] - ldrh r0, [r1, #6] - subs r3, r2, r0 - movs r0, #0xc - ldrsh r2, [r1, r0] - ldrh r0, [r1, #8] - subs r4, r2, r0 - ldrb r0, [r1, #0x10] - mov r8, r1 - cmp r0, #1 - beq _0807D330 - cmp r0, #1 - bgt _0807D2B4 - cmp r0, #0 - beq _0807D2BA - b _0807D404 - .align 2, 0 -_0807D2B0: .4byte gRoomControls -_0807D2B4: - cmp r0, #2 - beq _0807D3A0 - b _0807D404 -_0807D2BA: - mov r2, r8 - ldrh r1, [r2, #0x18] - movs r0, #3 - ands r0, r1 - cmp r0, #1 - beq _0807D2C8 - b _0807D462 -_0807D2C8: - movs r2, #0x1c - asrs r3, r3, #4 - mov sb, r3 - movs r3, #0x40 - adds r3, r3, r5 - mov ip, r3 - ldr r4, _0807D328 @ =0x040000D4 - ldr r7, _0807D32C @ =0x80000020 - movs r0, #0xe8 - lsls r0, r0, #3 - adds r3, r5, r0 - subs r0, #0x80 - adds r1, r5, r0 -_0807D2E2: - str r1, [r4] - str r3, [r4, #4] - str r7, [r4, #8] - ldr r0, [r4, #8] - subs r3, #0x40 - subs r1, #0x40 - subs r2, #1 - cmp r2, #0 - bgt _0807D2E2 - mov r1, r8 - ldrh r0, [r1, #0x20] - lsrs r0, r0, #4 - subs r0, #1 - ldrh r1, [r1, #0x18] - lsrs r1, r1, #2 - subs r0, r0, r1 - lsls r0, r0, #8 - mov r2, sb - lsls r1, r2, #1 - adds r0, r0, r1 - lsls r0, r0, #1 - adds r6, r6, r0 - ldr r0, _0807D328 @ =0x040000D4 - str r6, [r0] - str r5, [r0, #4] - ldr r2, _0807D32C @ =0x80000020 - str r2, [r0, #8] - ldr r1, [r0, #8] - movs r3, #0x80 - lsls r3, r3, #1 - adds r1, r6, r3 - str r1, [r0] - mov r1, ip - b _0807D3F0 - .align 2, 0 -_0807D328: .4byte 0x040000D4 -_0807D32C: .4byte 0x80000020 -_0807D330: - mov r2, r8 - ldrh r3, [r2, #0x18] - movs r0, #3 - ands r0, r3 - cmp r0, #0 - beq _0807D33E - b _0807D462 -_0807D33E: - asrs r7, r4, #4 - movs r0, #0x3c - adds r0, r0, r5 - mov sb, r0 - cmp r3, #0 - beq _0807D36A - ldr r4, _0807D398 @ =0x040000D4 - ldr r1, _0807D39C @ =0x8000001E - mov ip, r1 - adds r3, r5, #4 - adds r1, r5, #0 - movs r2, #0x15 -_0807D356: - str r3, [r4] - str r1, [r4, #4] - mov r0, ip - str r0, [r4, #8] - ldr r0, [r4, #8] - adds r3, #0x40 - adds r1, #0x40 - subs r2, #1 - cmp r2, #0 - bge _0807D356 -_0807D36A: - lsls r1, r7, #8 - mov r2, r8 - ldrh r0, [r2, #0x18] - lsrs r0, r0, #2 - lsls r0, r0, #1 - adds r1, r1, r0 - lsls r1, r1, #1 - adds r6, r6, r1 - mov r5, sb - movs r1, #0x80 - lsls r1, r1, #1 - movs r2, #0x15 -_0807D382: - ldrh r0, [r6] - strh r0, [r5] - ldrh r0, [r6, #2] - strh r0, [r5, #2] - adds r5, #0x40 - adds r6, r6, r1 - subs r2, #1 - cmp r2, #0 - bge _0807D382 - b _0807D462 - .align 2, 0 -_0807D398: .4byte 0x040000D4 -_0807D39C: .4byte 0x8000001E -_0807D3A0: - mov r0, r8 - ldrh r1, [r0, #0x18] - movs r0, #3 - ands r0, r1 - cmp r0, #0 - bne _0807D462 - lsls r2, r1, #0x10 - cmp r2, #0 - beq _0807D3C2 - ldr r1, _0807D3F8 @ =0x040000D4 - adds r0, r5, #0 - adds r0, #0x80 - str r0, [r1] - str r5, [r1, #4] - ldr r0, _0807D3FC @ =0x800003C0 - str r0, [r1, #8] - ldr r0, [r1, #8] -_0807D3C2: - lsrs r0, r2, #0x12 - lsls r0, r0, #8 - asrs r1, r3, #4 - lsls r1, r1, #1 - adds r0, r0, r1 - lsls r0, r0, #1 - adds r6, r6, r0 - ldr r0, _0807D3F8 @ =0x040000D4 - str r6, [r0] - movs r2, #0xa0 - lsls r2, r2, #3 - adds r1, r5, r2 - str r1, [r0, #4] - ldr r2, _0807D400 @ =0x80000020 - str r2, [r0, #8] - ldr r1, [r0, #8] - movs r3, #0x80 - lsls r3, r3, #1 - adds r1, r6, r3 - str r1, [r0] - movs r3, #0xa8 - lsls r3, r3, #3 - adds r1, r5, r3 -_0807D3F0: - str r1, [r0, #4] - str r2, [r0, #8] - ldr r0, [r0, #8] - b _0807D462 - .align 2, 0 -_0807D3F8: .4byte 0x040000D4 -_0807D3FC: .4byte 0x800003C0 -_0807D400: .4byte 0x80000020 -_0807D404: - mov r0, r8 - ldrh r1, [r0, #0x18] - movs r0, #3 - ands r0, r1 - cmp r0, #1 - bne _0807D462 - movs r2, #0 - asrs r7, r4, #4 - mov ip, r5 -_0807D416: - movs r1, #0x1d - mov r3, ip - adds r3, #0x3a -_0807D41C: - ldrh r0, [r3] - strh r0, [r3, #4] - subs r3, #2 - subs r1, #1 - cmp r1, #0 - bge _0807D41C - movs r1, #0x40 - add ip, r1 - adds r2, #1 - cmp r2, #0x15 - ble _0807D416 - lsls r0, r7, #8 - mov r2, r8 - ldrh r1, [r2, #0x1e] - lsrs r1, r1, #4 - subs r1, #1 - ldrh r2, [r2, #0x18] - lsrs r2, r2, #2 - subs r1, r1, r2 - lsls r1, r1, #1 - adds r0, r0, r1 - lsls r0, r0, #1 - adds r6, r6, r0 - movs r1, #0x80 - lsls r1, r1, #1 - movs r2, #0x15 -_0807D450: - ldrh r0, [r6] - strh r0, [r5] - ldrh r0, [r6, #2] - strh r0, [r5, #2] - adds r5, #0x40 - adds r6, r6, r1 - subs r2, #1 - cmp r2, #0 - bge _0807D450 -_0807D462: - pop {r3, r4} - mov r8, r3 - mov sb, r4 - pop {r4, r5, r6, r7, pc} - .align 2, 0 - - .syntax divided diff --git a/asm/non_matching/code_0807CC3C/sub_0807D46C.inc b/asm/non_matching/code_0807CC3C/sub_0807D46C.inc deleted file mode 100644 index ad1dee94..00000000 --- a/asm/non_matching/code_0807CC3C/sub_0807D46C.inc +++ /dev/null @@ -1,346 +0,0 @@ - - .syntax unified - - .text - - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #8 - str r0, [sp] - str r1, [sp, #4] - ldr r0, _0807D494 @ =gRoomControls - ldrb r2, [r0, #0x10] - mov sb, r0 - cmp r2, #1 - bne _0807D488 - b _0807D5C4 -_0807D488: - cmp r2, #1 - bgt _0807D498 - cmp r2, #0 - beq _0807D4A4 - b _0807D6CC - .align 2, 0 -_0807D494: .4byte gRoomControls -_0807D498: - cmp r2, #2 - beq _0807D4A4 - cmp r2, #3 - bne _0807D4A2 - b _0807D5C4 -_0807D4A2: - b _0807D6CC -_0807D4A4: - mov r1, sb - movs r2, #0xa - ldrsh r0, [r1, r2] - ldrh r1, [r1, #6] - subs r5, r0, r1 - cmp r5, #7 - ble _0807D4B4 - subs r5, #8 -_0807D4B4: - mov r3, sb - ldr r0, [r3, #0x30] - movs r2, #0x2e - ldrsh r0, [r0, r2] - subs r0, r0, r1 - subs r3, r0, #4 - mov r8, r3 - cmp r3, #7 - ble _0807D4CA - subs r0, #0xc - mov r8, r0 -_0807D4CA: - mov r0, sb - movs r2, #0xc - ldrsh r1, [r0, r2] - ldrh r0, [r0, #8] - subs r1, r1, r0 - mov ip, r1 - cmp r1, #7 - ble _0807D4E0 - movs r3, #8 - rsbs r3, r3, #0 - add ip, r3 -_0807D4E0: - mov r1, sb - ldrh r0, [r1, #0x18] - lsls r0, r0, #3 - mov r2, r8 - subs r0, r2, r0 - adds r7, r5, #0 - adds r7, #0xf8 - cmp r0, r5 - blt _0807D548 - mov r1, ip - asrs r3, r1, #3 - lsls r1, r3, #8 - ldr r2, [sp] - adds r1, r2, r1 - asrs r0, r0, #3 - lsls r2, r0, #1 - adds r4, r1, r2 - movs r1, #0x1f - ands r0, r1 - lsls r0, r0, #1 - ldr r2, [sp, #4] - adds r6, r2, r0 - ands r3, r1 - lsls r2, r3, #5 - mov r3, sb - ldrh r0, [r3, #0x20] - lsls r1, r0, #0x10 - lsrs r0, r1, #0x10 - cmp r0, #0xaf - bhi _0807D520 - lsrs r3, r1, #0x13 - b _0807D522 -_0807D520: - movs r3, #0x16 -_0807D522: - adds r7, r5, #0 - adds r7, #0xf8 - cmp r3, #0 - ble _0807D548 - ldr r0, _0807D55C @ =0x000003FF - mov sl, r0 -_0807D52E: - lsls r0, r2, #1 - adds r0, r0, r6 - ldrh r1, [r4] - strh r1, [r0] - movs r1, #0x80 - lsls r1, r1, #1 - adds r4, r4, r1 - adds r2, #0x20 - mov r0, sl - ands r2, r0 - subs r3, #1 - cmp r3, #0 - bgt _0807D52E -_0807D548: - mov r1, sb - ldrh r0, [r1, #0x18] - adds r0, #1 - lsls r0, r0, #3 - add r0, r8 - ldrh r2, [r1, #0x1e] - cmp r7, r2 - blt _0807D560 - adds r1, r7, #0 - b _0807D566 - .align 2, 0 -_0807D55C: .4byte 0x000003FF -_0807D560: - movs r3, #0x80 - lsls r3, r3, #1 - adds r1, r5, r3 -_0807D566: - cmp r0, r1 - blt _0807D56C - b _0807D6CC -_0807D56C: - mov r1, ip - asrs r3, r1, #3 - lsls r1, r3, #8 - ldr r2, [sp] - adds r1, r2, r1 - asrs r0, r0, #3 - lsls r2, r0, #1 - adds r4, r1, r2 - movs r1, #0x1f - ands r0, r1 - lsls r0, r0, #1 - ldr r2, [sp, #4] - adds r6, r2, r0 - ands r3, r1 - lsls r2, r3, #5 - mov r3, sb - ldrh r0, [r3, #0x20] - lsls r1, r0, #0x10 - lsrs r0, r1, #0x10 - cmp r0, #0xaf - bhi _0807D59A - lsrs r3, r1, #0x13 - b _0807D59C -_0807D59A: - movs r3, #0x16 -_0807D59C: - cmp r3, #0 - bgt _0807D5A2 - b _0807D6CC -_0807D5A2: - movs r7, #0x80 - lsls r7, r7, #1 - ldr r5, _0807D5C0 @ =0x000003FF -_0807D5A8: - lsls r0, r2, #1 - adds r0, r0, r6 - ldrh r1, [r4] - strh r1, [r0] - adds r4, r4, r7 - adds r2, #0x20 - ands r2, r5 - subs r3, #1 - cmp r3, #0 - bgt _0807D5A8 - b _0807D6CC - .align 2, 0 -_0807D5C0: .4byte 0x000003FF -_0807D5C4: - mov r1, sb - movs r2, #0xc - ldrsh r0, [r1, r2] - ldrh r2, [r1, #8] - subs r5, r0, r2 - cmp r5, #7 - ble _0807D5D4 - subs r5, #8 -_0807D5D4: - mov r3, sb - movs r0, #0xa - ldrsh r1, [r3, r0] - ldrh r0, [r3, #6] - subs r1, r1, r0 - mov r8, r1 - cmp r1, #7 - ble _0807D5EA - movs r1, #8 - rsbs r1, r1, #0 - add r8, r1 -_0807D5EA: - mov r3, sb - ldr r0, [r3, #0x30] - movs r1, #0x32 - ldrsh r0, [r0, r1] - subs r0, r0, r2 - subs r2, r0, #4 - mov ip, r2 - cmp r2, #7 - ble _0807D600 - subs r0, #0xc - mov ip, r0 -_0807D600: - mov r3, sb - ldrh r0, [r3, #0x18] - lsls r0, r0, #3 - mov r1, ip - subs r0, r1, r0 - adds r7, r5, #0 - adds r7, #0xa8 - movs r2, #0xb0 - adds r2, r2, r5 - mov sl, r2 - cmp r0, r5 - blt _0807D66A - asrs r2, r0, #3 - lsls r0, r2, #8 - ldr r3, [sp] - adds r0, r3, r0 - mov r1, r8 - asrs r3, r1, #3 - lsls r1, r3, #1 - adds r4, r0, r1 - movs r0, #0x1f - ands r2, r0 - lsls r2, r2, #6 - ldr r1, [sp, #4] - adds r6, r1, r2 - adds r2, r0, #0 - ands r2, r3 - mov r3, sb - ldrh r0, [r3, #0x1e] - lsls r1, r0, #0x10 - lsrs r0, r1, #0x10 - cmp r0, #0xff - bhi _0807D646 - lsrs r3, r1, #0x13 - b _0807D648 -_0807D646: - movs r3, #0x20 -_0807D648: - adds r7, r5, #0 - adds r7, #0xa8 - adds r5, #0xb0 - mov sl, r5 - cmp r3, #0 - ble _0807D66A - movs r5, #0x1f -_0807D656: - lsls r0, r2, #1 - adds r0, r0, r6 - ldrh r1, [r4] - strh r1, [r0] - adds r4, #2 - adds r2, #1 - ands r2, r5 - subs r3, #1 - cmp r3, #0 - bgt _0807D656 -_0807D66A: - mov r1, sb - ldrh r0, [r1, #0x18] - adds r0, #1 - lsls r0, r0, #3 - add r0, ip - mov r2, sl - ldrh r1, [r1, #0x20] - cmp r7, r1 - blt _0807D67E - adds r2, r7, #0 -_0807D67E: - cmp r0, r2 - bge _0807D6CC - asrs r2, r0, #3 - lsls r0, r2, #8 - ldr r1, [sp] - adds r0, r1, r0 - mov r1, r8 - asrs r3, r1, #3 - lsls r1, r3, #1 - adds r4, r0, r1 - movs r0, #0x1f - ands r2, r0 - lsls r2, r2, #6 - ldr r1, [sp, #4] - adds r6, r1, r2 - adds r2, r0, #0 - ands r2, r3 - mov r3, sb - ldrh r0, [r3, #0x1e] - lsls r1, r0, #0x10 - lsrs r0, r1, #0x10 - cmp r0, #0xff - bhi _0807D6B0 - lsrs r3, r1, #0x13 - b _0807D6B2 -_0807D6B0: - movs r3, #0x20 -_0807D6B2: - cmp r3, #0 - ble _0807D6CC - movs r5, #0x1f -_0807D6B8: - lsls r0, r2, #1 - adds r0, r0, r6 - ldrh r1, [r4] - strh r1, [r0] - adds r4, #2 - adds r2, #1 - ands r2, r5 - subs r3, #1 - cmp r3, #0 - bgt _0807D6B8 -_0807D6CC: - add sp, #8 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - - .syntax divided diff --git a/asm/non_matching/code_0807CC3C/sub_0807D6D8.inc b/asm/non_matching/code_0807CC3C/sub_0807D6D8.inc deleted file mode 100644 index 2e4df6c5..00000000 --- a/asm/non_matching/code_0807CC3C/sub_0807D6D8.inc +++ /dev/null @@ -1,482 +0,0 @@ - - .syntax unified - - .text - - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #0x44 - str r0, [sp] - str r1, [sp, #4] - ldr r5, _0807D8BC @ =gRoomControls - ldrh r0, [r5, #0x18] - cmp r0, #0 - bne _0807D6F2 - b _0807DA62 -_0807D6F2: - ldrh r0, [r5, #0x1a] - cmp r0, #0 - bne _0807D6FA - b _0807DA62 -_0807D6FA: - movs r1, #0xa - ldrsh r0, [r5, r1] - ldrh r1, [r5, #6] - subs r0, r0, r1 - movs r4, #0x10 - rsbs r4, r4, #0 - ands r0, r4 - str r0, [sp, #0x24] - ldr r3, [r5, #0x30] - movs r2, #0x2e - ldrsh r0, [r3, r2] - subs r0, r0, r1 - movs r2, #8 - rsbs r2, r2, #0 - ands r0, r2 - str r0, [sp, #0x14] - ldr r1, [sp, #0x24] - subs r0, r0, r1 - str r0, [sp, #0x1c] - movs r1, #0xc - ldrsh r0, [r5, r1] - ldrh r1, [r5, #8] - subs r0, r0, r1 - ands r0, r4 - str r0, [sp, #0x28] - movs r4, #0x32 - ldrsh r0, [r3, r4] - subs r0, r0, r1 - ands r0, r2 - str r0, [sp, #0x18] - ldr r1, [sp, #0x28] - subs r0, r0, r1 - str r0, [sp, #0x20] - ldrh r0, [r5, #0x18] - adds r2, r0, #0 - muls r2, r0, r2 - str r2, [sp, #0xc] - ldrh r3, [r5, #0x1a] - str r3, [sp, #8] - adds r4, r3, #0 - muls r4, r3, r4 - str r4, [sp, #0x10] - adds r4, r0, #0 - movs r0, #0 - mov sb, r0 - lsls r0, r4, #1 - rsbs r0, r0, #0 - adds r0, #1 - ldr r1, [sp, #0x10] - muls r0, r1, r0 - lsls r6, r2, #1 - adds r7, r0, r6 - adds r2, r4, #0 - muls r2, r1, r2 - mov r8, r2 - mov r0, r8 - ldr r1, [sp, #0xc] - bl __divsi3 - mov ip, r0 - cmp sb, ip - ble _0807D778 - b _0807D8D8 -_0807D778: - mov sl, r5 - ldr r3, [sp, #0xc] - adds r0, r6, r3 - lsls r0, r0, #1 - str r0, [sp, #0x3c] - mov r0, r8 - str r0, [sp, #0x40] - ldr r1, [sp, #0x14] - subs r1, r1, r4 - mov r8, r1 - ldr r2, [sp, #0x14] - adds r6, r4, r2 - movs r0, #0x80 - lsls r0, r0, #1 - ldr r3, [sp, #0x24] - adds r0, r3, r0 - str r0, [sp, #0x2c] -_0807D79A: - ldr r0, [sp, #0x28] - adds r0, #0xb0 - ldr r1, [sp, #0x18] - add r1, sb - cmp r0, r1 - ble _0807D812 - ldr r0, [sp, #0x20] - add r0, sb - asrs r0, r0, #3 - movs r5, #0x1f - ands r0, r5 - cmp r0, #0x1f - beq _0807D812 - lsls r0, r0, #6 - ldr r3, [sp, #4] - adds r2, r3, r0 - asrs r0, r1, #3 - lsls r0, r0, #8 - ldr r1, [sp] - adds r3, r1, r0 - ldr r0, [sp, #0x2c] - cmp r0, r6 - ble _0807D7EA - ldr r0, [sp, #0x1c] - adds r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - asrs r0, r6, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r1, sl - ldrh r0, [r1, #0x1c] - movs r1, #1 - orrs r0, r1 - mov r1, sl - strh r0, [r1, #0x1c] -_0807D7EA: - ldr r0, [sp, #0x24] - cmp r0, r8 - bge _0807D812 - ldr r0, [sp, #0x1c] - subs r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - mov r2, r8 - asrs r0, r2, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r3, sl - ldrh r0, [r3, #0x1c] - movs r1, #2 - orrs r0, r1 - strh r0, [r3, #0x1c] -_0807D812: - ldr r0, [sp, #0x18] - mov r2, sb - subs r1, r0, r2 - adds r0, r1, #0 - adds r0, #8 - ldr r3, [sp, #0x28] - cmp r3, r0 - bge _0807D88E - ldr r3, [sp, #0x20] - subs r0, r3, r2 - asrs r0, r0, #3 - movs r5, #0x1f - ands r0, r5 - cmp r0, #0x1f - beq _0807D88E - lsls r0, r0, #6 - ldr r3, [sp, #4] - adds r2, r3, r0 - asrs r0, r1, #3 - lsls r0, r0, #8 - ldr r1, [sp] - adds r3, r1, r0 - ldr r0, [sp, #0x2c] - cmp r0, r6 - ble _0807D866 - ldr r0, [sp, #0x1c] - adds r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - asrs r0, r6, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r1, sl - ldrh r0, [r1, #0x1c] - movs r1, #4 - orrs r0, r1 - mov r1, sl - strh r0, [r1, #0x1c] -_0807D866: - ldr r0, [sp, #0x24] - cmp r0, r8 - bge _0807D88E - ldr r0, [sp, #0x1c] - subs r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - mov r2, r8 - asrs r0, r2, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r3, sl - ldrh r0, [r3, #0x1c] - movs r1, #8 - orrs r0, r1 - strh r0, [r3, #0x1c] -_0807D88E: - cmp r7, #0 - ble _0807D8C0 - lsls r0, r4, #2 - rsbs r0, r0, #0 - adds r0, #4 - ldr r1, [sp, #0x10] - muls r0, r1, r0 - ldr r2, [sp, #0x3c] - adds r0, r0, r2 - adds r7, r7, r0 - ldr r3, [sp, #0x40] - subs r3, r3, r1 - str r3, [sp, #0x40] - movs r0, #1 - add r8, r0 - subs r6, #1 - subs r4, #1 - adds r0, r3, #0 - ldr r1, [sp, #0xc] - bl __divsi3 - mov ip, r0 - b _0807D8C4 - .align 2, 0 -_0807D8BC: .4byte gRoomControls -_0807D8C0: - ldr r1, [sp, #0x3c] - adds r7, r7, r1 -_0807D8C4: - ldr r2, [sp, #0xc] - lsls r0, r2, #2 - ldr r3, [sp, #0x3c] - adds r3, r3, r0 - str r3, [sp, #0x3c] - movs r0, #1 - add sb, r0 - cmp sb, ip - bgt _0807D8D8 - b _0807D79A -_0807D8D8: - movs r4, #0 - ldr r1, [sp, #8] - mov sb, r1 - ldr r2, [sp, #0x10] - lsls r6, r2, #1 - lsls r0, r1, #1 - rsbs r0, r0, #0 - adds r0, #1 - ldr r3, [sp, #0xc] - muls r0, r3, r0 - adds r7, r6, r0 - mov r5, sb - muls r5, r3, r5 - adds r0, r5, #0 - adds r1, r2, #0 - bl __divsi3 - mov ip, r0 - cmp r4, ip - ble _0807D902 - b _0807DA62 -_0807D902: - ldr r0, _0807DA40 @ =gRoomControls - mov sl, r0 - ldr r1, [sp, #0x10] - adds r0, r6, r1 - lsls r0, r0, #1 - str r0, [sp, #0x34] - ldr r6, [sp, #0x14] - mov r8, r6 - str r5, [sp, #0x38] - movs r3, #0x80 - lsls r3, r3, #1 - ldr r2, [sp, #0x24] - adds r3, r2, r3 - str r3, [sp, #0x30] -_0807D91E: - ldr r0, [sp, #0x28] - adds r0, #0xb0 - ldr r1, [sp, #0x18] - add r1, sb - cmp r0, r1 - ble _0807D996 - ldr r0, [sp, #0x20] - add r0, sb - asrs r0, r0, #3 - movs r5, #0x1f - ands r0, r5 - cmp r0, #0x1f - beq _0807D996 - lsls r0, r0, #6 - ldr r3, [sp, #4] - adds r2, r3, r0 - asrs r0, r1, #3 - lsls r0, r0, #8 - ldr r1, [sp] - adds r3, r1, r0 - ldr r0, [sp, #0x30] - cmp r0, r6 - ble _0807D96E - ldr r0, [sp, #0x1c] - adds r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - asrs r0, r6, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r1, sl - ldrh r0, [r1, #0x1c] - movs r1, #0x10 - orrs r0, r1 - mov r1, sl - strh r0, [r1, #0x1c] -_0807D96E: - ldr r0, [sp, #0x24] - cmp r0, r8 - bge _0807D996 - ldr r0, [sp, #0x1c] - subs r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - mov r2, r8 - asrs r0, r2, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r3, sl - ldrh r0, [r3, #0x1c] - movs r1, #0x20 - orrs r0, r1 - strh r0, [r3, #0x1c] -_0807D996: - ldr r0, [sp, #0x18] - mov r2, sb - subs r1, r0, r2 - adds r0, r1, #0 - adds r0, #8 - ldr r3, [sp, #0x28] - cmp r3, r0 - bge _0807DA12 - ldr r3, [sp, #0x20] - subs r0, r3, r2 - asrs r0, r0, #3 - movs r5, #0x1f - ands r0, r5 - cmp r0, #0x1f - beq _0807DA12 - lsls r0, r0, #6 - ldr r3, [sp, #4] - adds r2, r3, r0 - asrs r0, r1, #3 - lsls r0, r0, #8 - ldr r1, [sp] - adds r3, r1, r0 - ldr r0, [sp, #0x30] - cmp r0, r6 - ble _0807D9EA - ldr r0, [sp, #0x1c] - adds r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - asrs r0, r6, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r1, sl - ldrh r0, [r1, #0x1c] - movs r1, #0x40 - orrs r0, r1 - mov r1, sl - strh r0, [r1, #0x1c] -_0807D9EA: - ldr r0, [sp, #0x24] - cmp r0, r8 - bge _0807DA12 - ldr r0, [sp, #0x1c] - subs r1, r0, r4 - asrs r1, r1, #3 - ands r1, r5 - lsls r1, r1, #1 - adds r1, r1, r2 - mov r2, r8 - asrs r0, r2, #3 - lsls r0, r0, #1 - adds r0, r0, r3 - ldrh r0, [r0] - strh r0, [r1] - mov r3, sl - ldrh r0, [r3, #0x1c] - movs r1, #0x80 - orrs r0, r1 - strh r0, [r3, #0x1c] -_0807DA12: - cmp r7, #0 - ble _0807DA44 - mov r1, sb - lsls r0, r1, #2 - rsbs r0, r0, #0 - adds r0, #4 - ldr r2, [sp, #0xc] - muls r0, r2, r0 - ldr r3, [sp, #0x34] - adds r0, r3, r0 - adds r7, r7, r0 - ldr r0, [sp, #0x38] - subs r0, r0, r2 - str r0, [sp, #0x38] - movs r1, #1 - rsbs r1, r1, #0 - add sb, r1 - ldr r1, [sp, #0x10] - bl __divsi3 - mov ip, r0 - b _0807DA48 - .align 2, 0 -_0807DA40: .4byte gRoomControls -_0807DA44: - ldr r2, [sp, #0x34] - adds r7, r7, r2 -_0807DA48: - ldr r3, [sp, #0x10] - lsls r0, r3, #2 - ldr r1, [sp, #0x34] - adds r1, r1, r0 - str r1, [sp, #0x34] - movs r2, #1 - rsbs r2, r2, #0 - add r8, r2 - adds r6, #1 - adds r4, #1 - cmp r4, ip - bgt _0807DA62 - b _0807D91E -_0807DA62: - add sp, #0x44 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 - - .syntax divided diff --git a/asm/non_matching/common/sub_0801E31C.inc b/asm/non_matching/common/sub_0801E31C.inc deleted file mode 100644 index 5ba7e20e..00000000 --- a/asm/non_matching/common/sub_0801E31C.inc +++ /dev/null @@ -1,189 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #0x20 - str r0, [sp] - str r1, [sp, #4] - mov sl, r2 - mov sb, r3 - ldr r0, _0801E3AC @ =gUnk_03003DE4 - ldrb r1, [r0] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #9 - ldr r1, _0801E3B0 @ =gUnk_02017AA0 - adds r0, r0, r1 - movs r1, #0xa0 - lsls r1, r1, #4 - bl MemClear - cmp sl, sb - bge _0801E3DC - movs r6, #0 - mov r8, sl - mov r7, r8 - mov r0, r8 - lsls r1, r0, #1 - movs r0, #3 - subs r5, r0, r1 - cmp r6, r8 - ble _0801E35E - b _0801E45E -_0801E35E: - mov r1, r8 - lsls r0, r1, #2 - ldr r4, _0801E3B4 @ =gUnk_02018EE0 - adds r0, r0, r4 - str r0, [sp, #0x10] - mov r1, sb - mov r0, r8 - muls r0, r1, r0 - str r0, [sp, #0x14] - movs r3, #0 -_0801E372: - adds r0, r3, #0 - mov r1, sl - str r3, [sp, #0x18] - bl Div - adds r4, r0, #0 - lsls r4, r4, #0x10 - lsrs r4, r4, #0x10 - str r4, [sp, #0x1c] - ldr r0, [sp, #0x14] - mov r1, sl - bl Div - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - lsls r2, r6, #2 - ldr r4, _0801E3B4 @ =gUnk_02018EE0 - adds r1, r2, r4 - str r0, [r1] - ldr r0, [sp, #0x1c] - ldr r1, [sp, #0x10] - str r0, [r1] - ldr r3, [sp, #0x18] - cmp r5, #0 - bge _0801E3B8 - adds r0, r5, #6 - adds r5, r0, r2 - b _0801E3D2 - .align 2, 0 -_0801E3AC: .4byte gUnk_03003DE4 -_0801E3B0: .4byte gUnk_02017AA0 -_0801E3B4: .4byte gUnk_02018EE0 -_0801E3B8: - adds r1, r5, #0 - adds r1, #0xa - subs r0, r6, r7 - lsls r0, r0, #2 - adds r5, r1, r0 - ldr r4, [sp, #0x10] - subs r4, #4 - str r4, [sp, #0x10] - ldr r0, [sp, #0x14] - mov r1, sb - subs r0, r0, r1 - str r0, [sp, #0x14] - subs r7, #1 -_0801E3D2: - add r3, sb - adds r6, #1 - cmp r6, r7 - ble _0801E372 - b _0801E45E -_0801E3DC: - movs r6, #0 - mov r8, sb - mov r7, r8 - mov r4, r8 - lsls r1, r4, #1 - movs r0, #3 - subs r5, r0, r1 - cmp r6, r8 - bgt _0801E45E - lsls r0, r4, #2 - ldr r1, _0801E438 @ =gUnk_02018EE0 - adds r0, r0, r1 - str r0, [sp, #8] - mov r0, sl - mov r4, r8 - muls r4, r0, r4 - str r4, [sp, #0xc] - movs r3, #0 -_0801E400: - adds r0, r3, #0 - mov r1, sb - str r3, [sp, #0x18] - bl Div - adds r4, r0, #0 - lsls r4, r4, #0x10 - lsrs r4, r4, #0x10 - str r4, [sp, #0x1c] - ldr r0, [sp, #0xc] - mov r1, sb - bl Div - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - lsls r2, r6, #2 - ldr r4, _0801E438 @ =gUnk_02018EE0 - adds r1, r2, r4 - str r0, [r1] - ldr r0, [sp, #0x1c] - ldr r1, [sp, #8] - str r0, [r1] - ldr r3, [sp, #0x18] - cmp r5, #0 - bge _0801E43C - adds r0, r5, #6 - adds r5, r0, r2 - b _0801E456 - .align 2, 0 -_0801E438: .4byte gUnk_02018EE0 -_0801E43C: - adds r1, r5, #0 - adds r1, #0xa - subs r0, r6, r7 - lsls r0, r0, #2 - adds r5, r1, r0 - ldr r4, [sp, #8] - subs r4, #4 - str r4, [sp, #8] - ldr r0, [sp, #0xc] - mov r1, sl - subs r0, r0, r1 - str r0, [sp, #0xc] - subs r7, #1 -_0801E456: - add r3, sl - adds r6, #1 - cmp r6, r7 - ble _0801E400 -_0801E45E: - ldr r0, [sp] - ldr r1, [sp, #4] - mov r2, r8 - bl sub_0801E290 - ldr r0, _0801E48C @ =gUnk_03003DE4 - ldrb r1, [r0] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #9 - ldr r1, _0801E490 @ =gUnk_02017AA0 - adds r0, r0, r1 - ldr r1, _0801E494 @ =0x04000040 - ldr r2, _0801E498 @ =0xA2600001 - bl SetVBlankDMA - add sp, #0x20 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_0801E48C: .4byte gUnk_03003DE4 -_0801E490: .4byte gUnk_02017AA0 -_0801E494: .4byte 0x04000040 -_0801E498: .4byte 0xA2600001 - .syntax divided diff --git a/asm/non_matching/common/sub_0801E49C.inc b/asm/non_matching/common/sub_0801E49C.inc deleted file mode 100644 index 345c5ed7..00000000 --- a/asm/non_matching/common/sub_0801E49C.inc +++ /dev/null @@ -1,211 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #8 - mov r8, r0 - str r1, [sp, #4] - mov sb, r2 - adds r5, r3, #0 - ldr r0, _0801E5E4 @ =0x0000FFFF - movs r2, #0xf0 - lsls r2, r2, #3 - ldr r1, _0801E5E8 @ =gUnk_02018EE0 - bl MemFill16 - adds r3, r5, #0 - subs r3, #0x40 - movs r2, #0xff - ands r3, r2 - ldr r1, _0801E5EC @ =gSineTable - adds r0, r3, #0 - adds r0, #0x40 - lsls r0, r0, #1 - adds r0, r0, r1 - movs r4, #0 - ldrsh r0, [r0, r4] - mov r4, sb - muls r4, r0, r4 - adds r0, r4, #0 - asrs r0, r0, #8 - mov r4, r8 - adds r7, r4, r0 - lsls r0, r3, #1 - adds r0, r0, r1 - movs r3, #0 - ldrsh r0, [r0, r3] - mov r4, sb - muls r4, r0, r4 - adds r0, r4, #0 - asrs r0, r0, #8 - ldr r3, [sp, #4] - adds r3, r3, r0 - mov sl, r3 - adds r3, r5, #0 - adds r3, #0x68 - ands r3, r2 - adds r0, r3, #0 - adds r0, #0x40 - lsls r0, r0, #1 - adds r0, r0, r1 - movs r4, #0 - ldrsh r0, [r0, r4] - mov r4, sb - muls r4, r0, r4 - adds r0, r4, #0 - asrs r0, r0, #8 - mov r4, r8 - adds r6, r4, r0 - lsls r0, r3, #1 - adds r0, r0, r1 - movs r3, #0 - ldrsh r0, [r0, r3] - mov r4, sb - muls r4, r0, r4 - adds r0, r4, #0 - asrs r0, r0, #8 - ldr r3, [sp, #4] - adds r4, r3, r0 - adds r3, r5, #0 - subs r3, #0xe8 - ands r3, r2 - adds r0, r3, #0 - adds r0, #0x40 - lsls r0, r0, #1 - adds r0, r0, r1 - movs r2, #0 - ldrsh r0, [r0, r2] - mov r2, sb - muls r2, r0, r2 - adds r0, r2, #0 - asrs r0, r0, #8 - mov r2, r8 - adds r5, r2, r0 - lsls r0, r3, #1 - adds r0, r0, r1 - movs r3, #0 - ldrsh r0, [r0, r3] - mov r1, sb - muls r1, r0, r1 - adds r0, r1, #0 - asrs r0, r0, #8 - ldr r2, [sp, #4] - adds r2, r2, r0 - mov r8, r2 - movs r0, #0 - str r0, [sp] - adds r0, r7, #0 - mov r1, sl - adds r2, r6, #0 - adds r3, r4, #0 - bl sub_0801E64C - movs r0, #1 - str r0, [sp] - adds r0, r7, #0 - mov r1, sl - adds r2, r5, #0 - mov r3, r8 - bl sub_0801E64C - movs r0, #2 - str r0, [sp] - adds r0, r6, #0 - adds r1, r4, #0 - adds r2, r5, #0 - mov r3, r8 - bl sub_0801E64C - ldr r5, _0801E5F0 @ =gUnk_03003DE4 - ldrb r1, [r5] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #9 - ldr r6, _0801E5F4 @ =gUnk_02017AA0 - adds r0, r0, r6 - movs r1, #0xa0 - lsls r1, r1, #4 - bl MemClear - ldr r2, _0801E5E8 @ =gUnk_02018EE0 - ldrb r1, [r5] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #9 - adds r1, r0, r6 - movs r3, #0xa0 - mov sl, r3 -_0801E5B0: - ldr r7, [r2] - ldr r6, [r2, #4] - ldr r5, [r2, #8] - adds r2, #0xc - cmp r7, r6 - ble _0801E5C2 - adds r4, r7, #0 - adds r7, r6, #0 - adds r6, r4, #0 -_0801E5C2: - cmp r7, r5 - ble _0801E5CC - adds r4, r7, #0 - adds r7, r5, #0 - adds r5, r4, #0 -_0801E5CC: - cmp r6, r5 - ble _0801E5D6 - adds r4, r6, #0 - adds r6, r5, #0 - adds r5, r4, #0 -_0801E5D6: - movs r0, #1 - rsbs r0, r0, #0 - cmp r7, r0 - beq _0801E5F8 - strb r5, [r1] - strb r7, [r1, #1] - b _0801E60A - .align 2, 0 -_0801E5E4: .4byte 0x0000FFFF -_0801E5E8: .4byte gUnk_02018EE0 -_0801E5EC: .4byte gSineTable -_0801E5F0: .4byte gUnk_03003DE4 -_0801E5F4: .4byte gUnk_02017AA0 -_0801E5F8: - cmp r6, r7 - beq _0801E602 - strb r5, [r1] - strb r6, [r1, #1] - b _0801E60A -_0801E602: - cmp r5, r7 - beq _0801E60A - strb r7, [r1, #1] - strb r7, [r1] -_0801E60A: - movs r4, #1 - rsbs r4, r4, #0 - add sl, r4 - adds r1, #2 - mov r0, sl - cmp r0, #0 - bgt _0801E5B0 - ldr r0, _0801E63C @ =gUnk_03003DE4 - ldrb r1, [r0] - lsls r0, r1, #2 - adds r0, r0, r1 - lsls r0, r0, #9 - ldr r1, _0801E640 @ =gUnk_02017AA0 - adds r0, r0, r1 - ldr r1, _0801E644 @ =0x04000040 - ldr r2, _0801E648 @ =0xA2600001 - bl SetVBlankDMA - add sp, #8 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_0801E63C: .4byte gUnk_03003DE4 -_0801E640: .4byte gUnk_02017AA0 -_0801E644: .4byte 0x04000040 -_0801E648: .4byte 0xA2600001 - .syntax divided diff --git a/asm/non_matching/common/zMalloc.inc b/asm/non_matching/common/zMalloc.inc deleted file mode 100644 index 742dd67c..00000000 --- a/asm/non_matching/common/zMalloc.inc +++ /dev/null @@ -1,171 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - mov ip, r0 - movs r0, #3 - add ip, r0 - subs r0, #7 - mov r1, ip - ands r1, r0 - mov ip, r1 - ldr r6, _0801D90C @ =gzHeap - mov sb, r6 - ldrh r7, [r6] - movs r5, #1 - movs r3, #0x80 - lsls r3, r3, #5 - add r3, sb - subs r4, r3, r1 - movs r2, #0 - b _0801D926 - .align 2, 0 -_0801D90C: .4byte gzHeap -_0801D910: - cmp r1, r4 - bhi _0801D918 - cmp r3, r0 - bls _0801D952 -_0801D918: - cmp r4, r1 - bhi _0801D920 - cmp r0, r3 - bls _0801D952 -_0801D920: - adds r0, r2, #1 - lsls r0, r0, #0x10 - lsrs r2, r0, #0x10 -_0801D926: - cmp r2, r7 - bhs _0801D94A - lsls r0, r2, #2 - add r0, sb - ldrh r1, [r0, #2] - ldr r6, _0801D95C @ =gzHeap - adds r1, r1, r6 - ldrh r0, [r0, #4] - adds r0, r0, r6 - cmp r1, r4 - bhi _0801D940 - cmp r4, r0 - bls _0801D952 -_0801D940: - cmp r1, r3 - bhi _0801D910 - cmp r3, r0 - bhi _0801D910 - movs r5, #0 -_0801D94A: - lsls r0, r7, #2 - mov sl, r0 - cmp r5, #0 - bne _0801D9D8 -_0801D952: - movs r1, #0 - mov r8, r1 - lsls r6, r7, #2 - mov sl, r6 - b _0801D970 - .align 2, 0 -_0801D95C: .4byte gzHeap -_0801D960: - movs r5, #0 -_0801D962: - mov r0, r8 - adds r0, #1 - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - mov r8, r0 - cmp r8, r7 - bhs _0801D9D4 -_0801D970: - mov r1, r8 - lsls r0, r1, #2 - add r0, sb - ldrh r0, [r0, #2] - ldr r6, _0801D994 @ =gzHeap - adds r3, r0, r6 - mov r0, ip - subs r4, r3, r0 - movs r5, #0 - mov r0, sl - adds r0, #2 - add r0, sb - adds r0, #4 - cmp r4, r0 - blo _0801D962 - movs r5, #1 - movs r2, #0 - b _0801D9AE - .align 2, 0 -_0801D994: .4byte gzHeap -_0801D998: - cmp r1, r4 - bhi _0801D9A0 - cmp r3, r0 - bls _0801D960 -_0801D9A0: - cmp r4, r1 - bhi _0801D9A8 - cmp r0, r3 - bls _0801D960 -_0801D9A8: - adds r0, r2, #1 - lsls r0, r0, #0x10 - lsrs r2, r0, #0x10 -_0801D9AE: - cmp r2, r7 - bhs _0801D9D0 - lsls r0, r2, #2 - add r0, sb - ldrh r1, [r0, #2] - adds r1, r1, r6 - ldrh r0, [r0, #4] - adds r0, r0, r6 - cmp r1, r4 - bhi _0801D9C6 - cmp r4, r0 - blo _0801D960 -_0801D9C6: - cmp r1, r3 - bhs _0801D998 - cmp r3, r0 - bhi _0801D998 - movs r5, #0 -_0801D9D0: - cmp r5, #0 - beq _0801D962 -_0801D9D4: - cmp r5, #0 - beq _0801DA00 -_0801D9D8: - ldr r0, _0801D9FC @ =gUnk_02035542 - mov r1, sl - adds r2, r1, r0 - subs r3, r0, #2 - subs r1, r4, r3 - strh r1, [r2] - adds r0, #2 - add r0, sl - add r1, ip - strh r1, [r0] - adds r0, r7, #1 - strh r0, [r3] - adds r0, r4, #0 - mov r1, ip - bl MemClear - adds r0, r4, #0 - b _0801DA02 - .align 2, 0 -_0801D9FC: .4byte gUnk_02035542 -_0801DA00: - movs r0, #0 -_0801DA02: - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .syntax divided diff --git a/asm/non_matching/figurineDevice/sub_08088160.inc b/asm/non_matching/figurineDevice/sub_08088160.inc deleted file mode 100644 index a9b6dee6..00000000 --- a/asm/non_matching/figurineDevice/sub_08088160.inc +++ /dev/null @@ -1,365 +0,0 @@ - .syntax unified -.ifdef JP - push {r4, lr} - adds r2, r0, #0 - lsls r1, r1, #3 - ldr r0, _08087FB0 @ =gUnk_080FC3E4 - adds r1, r1, r0 - movs r4, #0 - adds r0, r2, #0 - adds r0, #0x7c - ldrb r0, [r0] - ldrb r3, [r1, #6] - cmp r0, r3 - bhs _08088068 - ldrb r0, [r1, #6] - cmp r0, #0x10 - beq _08087FC6 - cmp r0, #0x10 - bgt _08087FB4 - cmp r0, #8 - beq _08087FBC - b _0808806A - .align 2, 0 -_08087FB0: .4byte gUnk_080FC3E4 -_08087FB4: - cmp r0, #0x20 - beq _08087FCA - cmp r0, #0x40 - bne _0808806A -_08087FBC: - ldr r0, [r1] - ldrh r1, [r1, #4] - bl CheckLocalFlagByBank - b _08088064EU -_08087FC6: - ldrh r0, [r1, #4] - b _08088060EU -_08087FCA: - ldrh r0, [r1, #4] - cmp r0, #4 - bhi _0808806A - lsls r0, r0, #2 - ldr r1, _08087FDC @ =_08087FE0 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08087FDC: .4byte _08087FE0 -_08087FE0: @ jump table - .4byte _08087FF4 @ case 0 - .4byte _0808800C @ case 1 - .4byte _0808801A @ case 2 - .4byte _08088032 @ case 3 - .4byte _0808804A @ case 4 -_08087FF4: - movs r0, #0x20 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x10 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x19 - b _08088060EU -_0808800C: - adds r0, r2, #0 - adds r0, #0x7c - ldrb r0, [r0] - cmp r0, #4 - bls _0808806A - movs r0, #0x28 - b _08088060EU -_0808801A: - movs r0, #0x54 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x56 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x3d - b _08088060EU -_08088032: - movs r0, #0x3b - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x4a - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0xd - b _08088060EU -_0808804A: - movs r0, #0x49 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x55 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088068 - movs r0, #0x3c -_08088060EU: - bl CheckKinstoneFused -_08088064EU: - cmp r0, #0 - beq _0808806A -_08088068: - movs r4, #1 -_0808806A: - adds r0, r4, #0 - pop {r4, pc} - .align 2, 0 -.else -.ifdef EU - push {r4, lr} - adds r2, r0, #0 - lsls r1, r1, #3 - ldr r0, _08087B44 @ =gUnk_080FC3E4 - adds r1, r1, r0 - movs r4, #0 - adds r0, r2, #0 - adds r0, #0x7d - ldrb r0, [r0] - ldrb r3, [r1, #6] - cmp r0, r3 - bhs _08087BFC - ldrb r0, [r1, #6] - cmp r0, #0x10 - beq _08087B5A - cmp r0, #0x10 - bgt _08087B48 - cmp r0, #8 - beq _08087B50 - b _08087BFE - .align 2, 0 -_08087B44: .4byte gUnk_080FC3E4 -_08087B48: - cmp r0, #0x20 - beq _08087B5E - cmp r0, #0x40 - bne _08087BFE -_08087B50: - ldr r0, [r1] - ldrh r1, [r1, #4] - bl CheckLocalFlagByBank - b _08087BF8 -_08087B5A: - ldrh r0, [r1, #4] - b _08087BF4 -_08087B5E: - ldrh r0, [r1, #4] - cmp r0, #4 - bhi _08087BFE - lsls r0, r0, #2 - ldr r1, _08087B70 @ =_08087B74 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08087B70: .4byte _08087B74 -_08087B74: @ jump table - .4byte _08087B88 @ case 0 - .4byte _08087BA0 @ case 1 - .4byte _08087BAE @ case 2 - .4byte _08087BC6 @ case 3 - .4byte _08087BDE @ case 4 -_08087B88: - movs r0, #0x20 - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x10 - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x19 - b _08087BF4 -_08087BA0: - adds r0, r2, #0 - adds r0, #0x7d - ldrb r0, [r0] - cmp r0, #4 - bls _08087BFE - movs r0, #0x28 - b _08087BF4 -_08087BAE: - movs r0, #0x54 - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x56 - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x3d - b _08087BF4 -_08087BC6: - movs r0, #0x3b - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x4a - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0xd - b _08087BF4 -_08087BDE: - movs r0, #0x49 - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x55 - bl CheckKinstoneFused - cmp r0, #0 - bne _08087BFC - movs r0, #0x3c -_08087BF4: - bl CheckKinstoneFused -_08087BF8: - cmp r0, #0 - beq _08087BFE -_08087BFC: - movs r4, #1 -_08087BFE: - adds r0, r4, #0 - pop {r4, pc} - .align 2, 0 -.else - push {r4, lr} - adds r2, r0, #0 - lsls r1, r1, #3 - ldr r0, _08088188 @ =gUnk_080FC3E4 - adds r1, r1, r0 - movs r4, #0 - adds r0, r2, #0 - adds r0, #0x7c - ldrb r0, [r0] - ldrb r3, [r1, #6] - cmp r0, r3 - bhs _08088266 - ldrb r0, [r1, #6] - cmp r0, #0x10 - beq _0808819E - cmp r0, #0x10 - bgt _0808818C - cmp r0, #8 - beq _08088194 - b _08088268 - .align 2, 0 -_08088188: .4byte gUnk_080FC3E4 -_0808818C: - cmp r0, #0x20 - beq _080881A6 - cmp r0, #0x40 - bne _08088268 -_08088194: - ldr r0, [r1] - ldrh r1, [r1, #4] - bl CheckLocalFlagByBank - b _08088262 -_0808819E: - ldrh r0, [r1, #4] -.ifndef JP - bl CheckKinstoneFused -.endif - b _08088262 -_080881A6: - ldrh r0, [r1, #4] - cmp r0, #5 - bhi _08088268 - lsls r0, r0, #2 - ldr r1, _080881B8 @ =_080881BC - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_080881B8: .4byte _080881BC -_080881BC: @ jump table - .4byte _080881D4 @ case 0 - .4byte _080881F0 @ case 1 - .4byte _080881FE @ case 2 - .4byte _0808821A @ case 3 - .4byte _08088236 @ case 4 - .4byte _08088252 @ case 5 -_080881D4: - movs r0, #0x20 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x10 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x19 -_080881EA: - bl CheckKinstoneFused - b _08088262 -_080881F0: - adds r0, r2, #0 - adds r0, #0x7c - ldrb r0, [r0] - cmp r0, #4 - bls _08088268 - movs r0, #0x28 - b _080881EA -_080881FE: - movs r0, #0x54 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x56 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x3d - bl CheckKinstoneFused - b _08088262 -_0808821A: - movs r0, #0x3b - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x4a - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0xd - bl CheckKinstoneFused - b _08088262 -_08088236: - movs r0, #0x49 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x55 - bl CheckKinstoneFused - cmp r0, #0 - bne _08088266 - movs r0, #0x3c - bl CheckKinstoneFused - b _08088262 -_08088252: - adds r0, r2, #0 - adds r0, #0x7c - ldrb r0, [r0] - cmp r0, #1 - bls _08088268 - movs r0, #0x12 - bl CheckGlobalFlag -_08088262: - cmp r0, #0 - beq _08088268 -_08088266: - movs r4, #1 -_08088268: - adds r0, r4, #0 - pop {r4, pc} -.endif -.endif - .syntax divided diff --git a/asm/non_matching/itemTryPickupObject/sub_080762D8.inc b/asm/non_matching/itemTryPickupObject/sub_080762D8.inc deleted file mode 100644 index 92bdec0b..00000000 --- a/asm/non_matching/itemTryPickupObject/sub_080762D8.inc +++ /dev/null @@ -1,219 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - adds r5, r0, #0 - adds r6, r1, #0 - ldr r4, _08076334 @ =gPlayerState - ldrb r0, [r4, #5] - movs r1, #0xcf - ands r1, r0 - strb r1, [r4, #5] - adds r0, r5, #0 - adds r1, r6, #0 - bl PlayerTryDropObject - cmp r0, #0 - bne _080762F6 - b _08076486 -_080762F6: - ldr r0, _08076338 @ =gPlayerEntity - adds r1, r0, #0 - adds r1, #0x3d - ldrb r1, [r1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r3, r0, #0 - cmp r1, #8 - bgt _0807636C - adds r0, #0x42 - ldrb r0, [r0] - cmp r0, #0 - bne _0807636C - ldr r2, [r5, #0x18] - cmp r2, #0 - beq _08076340 - ldrh r1, [r2, #0xc] - ldr r0, _0807633C @ =0x00000502 - cmp r1, r0 - bne _08076376 - adds r0, r4, #0 - adds r0, #0x90 - ldrh r1, [r0] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08076340 - movs r0, #6 - strb r0, [r2, #0xd] - b _08076376 - .align 2, 0 -_08076334: .4byte gPlayerState -_08076338: .4byte gPlayerEntity -_0807633C: .4byte 0x00000502 -_08076340: - ldr r2, _08076364 @ =gPlayerState - adds r1, r2, #0 - adds r1, #0xa8 - movs r0, #5 - strb r0, [r1] - ldr r0, _08076368 @ =gHUD - adds r0, #0x2e - movs r1, #8 - strb r1, [r0] - ldrb r0, [r2, #2] - cmp r0, #0 - beq _0807635A - b _0807647E -_0807635A: - ldrb r0, [r2, #5] - cmp r0, #1 - bne _08076394 - b _08076380 - .align 2, 0 -_08076364: .4byte gPlayerState -_08076368: .4byte gHUD -_0807636C: - ldr r1, [r5, #0x18] - cmp r1, #0 - beq _08076376 - movs r0, #6 - strb r0, [r1, #0xd] -_08076376: - adds r0, r5, #0 - adds r1, r6, #0 - bl PlayerCancelHoldItem - b _08076486 -_08076380: - adds r0, r3, #0 - movs r1, #6 - adds r2, r5, #0 - bl sub_0800875A - cmp r0, #0 - beq _08076394 - adds r0, r5, #0 - movs r1, #0 - b _080763EC -_08076394: - ldr r1, _080763F4 @ =gUnk_0811BE38 - ldr r7, _080763F8 @ =gPlayerEntity - ldrb r0, [r7, #0x14] - lsrs r0, r0, #1 - lsls r3, r0, #1 - adds r1, r3, r1 - ldr r4, _080763FC @ =gPlayerState - adds r2, r4, #0 - adds r2, #0x90 - ldrh r0, [r1] - ldrh r2, [r2] - ands r0, r2 - cmp r0, #0 - beq _08076400 - adds r0, r5, #0 - bl UpdateItemAnim - ldr r0, [r4, #0x30] - movs r1, #8 - ands r0, r1 - movs r1, #0x94 - lsls r1, r1, #4 - cmp r0, #0 - bne _080763C8 - movs r1, #0xd0 - lsls r1, r1, #2 -_080763C8: - ldrh r0, [r5, #0x10] - cmp r1, r0 - beq _080763D4 - adds r0, r5, #0 - bl SetItemAnim -_080763D4: - ldrb r0, [r4, #5] - movs r1, #0x10 - orrs r1, r0 - strb r1, [r4, #5] - adds r2, r4, #0 - adds r2, #0xa8 - movs r0, #0x1a - strb r0, [r2] - cmp r1, #1 - beq _08076486 - ldr r1, [r5, #0x18] - adds r0, r5, #0 -_080763EC: - adds r2, r6, #0 - bl sub_08076088 - b _08076486 - .align 2, 0 -_080763F4: .4byte gUnk_0811BE38 -_080763F8: .4byte gPlayerEntity -_080763FC: .4byte gPlayerState -_08076400: - ldr r0, _08076418 @ =gUnk_0811BE40 - adds r0, r3, r0 - ldrh r0, [r0] - ands r0, r2 - cmp r0, #0 - beq _08076460 - ldrb r0, [r7, #0xf] - cmp r0, #5 - bhi _0807641C - adds r0, #1 - strb r0, [r7, #0xf] - b _08076486 - .align 2, 0 -_08076418: .4byte gUnk_0811BE40 -_0807641C: - ldrb r0, [r5, #0xa] - adds r1, r4, #0 - adds r1, #0x35 - strb r0, [r1] - ldrb r0, [r4, #6] - movs r1, #0x80 - orrs r0, r1 - strb r0, [r4, #6] - ldrb r1, [r4, #5] - movs r0, #0x20 - orrs r0, r1 - strb r0, [r4, #5] - adds r1, r4, #0 - adds r1, #0xa8 - movs r0, #0x19 - strb r0, [r1] - ldr r0, [r4, #0x30] - movs r1, #8 - ands r0, r1 - ldr r1, _0807645C @ =0x0000093C - cmp r0, #0 - bne _0807644C - movs r1, #0xcf - lsls r1, r1, #2 -_0807644C: - ldrh r0, [r5, #0x10] - cmp r1, r0 - bne _08076476 - adds r0, r5, #0 - bl UpdateItemAnim - b _08076486 - .align 2, 0 -_0807645C: .4byte 0x0000093C -_08076460: - strb r0, [r7, #0xf] - ldr r0, [r4, #0x30] - movs r1, #8 - ands r0, r1 - cmp r0, #0 - bne _08076472 - movs r1, #0xd0 - lsls r1, r1, #2 - b _08076476 -_08076472: - movs r1, #0x94 - lsls r1, r1, #4 -_08076476: - adds r0, r5, #0 - bl SetItemAnim - b _08076486 -_0807647E: - adds r0, r5, #0 - adds r1, r6, #0 - bl PlayerCancelHoldItem -_08076486: - pop {r4, r5, r6, r7, pc} - .syntax divided diff --git a/asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc b/asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc deleted file mode 100644 index 33c4dfdf..00000000 --- a/asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc +++ /dev/null @@ -1,112 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - ldr r4, _080A4210 @ =gOamCmd - movs r0, #0 - strh r0, [r4, #4] - strh r0, [r4, #6] - ldr r0, _080A4214 @ =gMenu - ldrh r0, [r0, #0x10] - ldr r1, _080A4218 @ =0x00000B21 - bl __divsi3 - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - movs r5, #3 - rsbs r5, r5, #0 - movs r1, #0xff - mov r8, r1 - adds r7, r4, #0 - ldr r6, _080A421C @ =gSineTable - rsbs r0, r0, #0 - adds r4, r0, #0 - subs r4, #0x45 - ldr r2, _080A4220 @ =gSave+0x12b - mov sb, r2 -_080A4180: - adds r2, r4, #0 - mov r3, r8 - ands r2, r3 - lsls r0, r2, #1 - adds r0, r0, r6 - movs r3, #0 - ldrsh r1, [r0, r3] - lsls r0, r1, #4 - adds r0, r0, r1 - lsls r0, r0, #2 - cmp r0, #0 - bge _080A419A - adds r0, #0xff -_080A419A: - asrs r0, r0, #8 - adds r0, #0x4f - strh r0, [r7, #2] - adds r0, r2, #0 - adds r0, #0x40 - mov r1, r8 - ands r0, r1 - lsls r0, r0, #1 - adds r0, r0, r6 - movs r2, #0 - ldrsh r1, [r0, r2] - lsls r0, r1, #5 - adds r0, r0, r1 - lsls r0, r0, #1 - cmp r0, #0 - bge _080A41BC - adds r0, #0xff -_080A41BC: - asrs r0, r0, #8 - subs r0, #0x10 - strh r0, [r7] - ldr r2, _080A4214 @ =gMenu - ldr r0, [r2, #0x10] - cmp r0, #0 - bge _080A41CE - ldr r3, _080A4224 @ =0x0000FFFF - adds r0, r0, r3 -_080A41CE: - asrs r0, r0, #0x10 - adds r3, r0, r5 - cmp r3, #0 - blt _080A4200 - mov r1, sb - adds r0, r3, r1 - ldrb r1, [r0] - ldr r0, _080A4228 @ =gSave - cmp r5, #0 - bne _080A41EE - ldrb r2, [r2, #1] - cmp r2, #4 - bgt _080A41EE - cmp r2, #3 - blt _080A41EE - subs r1, #1 -_080A41EE: - cmp r1, #0 - ble _080A4200 - movs r2, #0x8c - lsls r2, r2, #1 - adds r0, r0, r2 - adds r0, r3, r0 - ldrb r0, [r0] - bl sub_080A42E0 -_080A4200: - adds r4, #0x17 - adds r5, #1 - cmp r5, #3 - ble _080A4180 - pop {r3, r4} - mov r8, r3 - mov sb, r4 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_080A4210: .4byte gOamCmd -_080A4214: .4byte gMenu -_080A4218: .4byte 0x00000B21 -_080A421C: .4byte gSineTable -_080A4220: .4byte gSave+0x12b -_080A4224: .4byte 0x0000FFFF -_080A4228: .4byte gSave - .syntax divided diff --git a/asm/non_matching/npc23/sub_08066490.inc b/asm/non_matching/npc23/sub_08066490.inc deleted file mode 100644 index 87549b7f..00000000 --- a/asm/non_matching/npc23/sub_08066490.inc +++ /dev/null @@ -1,66 +0,0 @@ - .syntax unified - push {r4, r5, r6, lr} - mov ip, r0 - adds r5, r1, #0 - ldrb r1, [r0, #0xb] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _0806650A - mov r1, ip - ldrh r0, [r1, #0x2e] - adds r1, #0x86 - strh r0, [r1] - mov r0, ip - adds r0, #0x7e - ldrh r2, [r0] - adds r0, #4 - ldrh r0, [r0] - adds r3, r2, r0 - subs r4, r2, r0 - movs r6, #0x2e - ldrsh r0, [r5, r6] - cmp r0, r3 - bge _080664C6 - cmp r0, r4 - ble _080664C6 - adds r2, r0, #0 - b _080664D2 -_080664C6: - movs r2, #0x2e - ldrsh r0, [r5, r2] - adds r2, r4, #0 - cmp r0, r3 - blt _080664D2 - adds r2, r3, #0 -_080664D2: - ldrh r0, [r1] - cmp r0, r2 - bne _080664F0 - mov r1, ip - adds r1, #0x84 - ldrh r0, [r1] - cmp r0, #1 - bne _0806650A - movs r0, #0 - strh r0, [r1] - mov r0, ip - movs r1, #2 - bl InitializeAnimation - b _0806650A -_080664F0: - mov r6, ip - strh r2, [r6, #0x2e] - mov r1, ip - adds r1, #0x84 - ldrh r0, [r1] - cmp r0, #0 - bne _0806650A - movs r0, #1 - strh r0, [r1] - mov r0, ip - movs r1, #6 - bl InitializeAnimation -_0806650A: - pop {r4, r5, r6, pc} - .syntax divided diff --git a/asm/non_matching/objectB9/sub_080A1270.inc b/asm/non_matching/objectB9/sub_080A1270.inc deleted file mode 100644 index 5079781b..00000000 --- a/asm/non_matching/objectB9/sub_080A1270.inc +++ /dev/null @@ -1,144 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #8 - mov sb, r0 - movs r6, #0 - ldr r0, [r0, #0x64] - str r0, [sp, #4] - mov r4, sb - adds r4, #0x70 - ldr r0, _080A12F8 @ =gRoomControls - movs r2, #0xd8 - lsls r2, r2, #2 - adds r1, r2, #0 - ldrh r3, [r0, #6] - adds r1, r1, r3 - movs r7, #0xd4 - lsls r7, r7, #2 - adds r2, r7, #0 - ldrh r0, [r0, #8] - adds r2, r2, r0 - lsls r1, r1, #0x10 - asrs r1, r1, #0x10 - mov r8, r1 - lsls r2, r2, #0x10 - asrs r3, r2, #0x10 - movs r0, #9 - mov sl, r0 - movs r1, #1 - rsbs r1, r1, #0 - adds r5, r1, #0 -_080A12B2: - ldr r7, [sp, #4] - ldr r2, [r7] - movs r0, #0 - ldrsb r0, [r4, r0] - cmp r0, #0 - bne _080A1300 - ldr r0, [r2, #4] - cmp r0, #0 - beq _080A132C - cmp r2, #0 - beq _080A132C - movs r1, #0x2e - ldrsh r0, [r2, r1] - cmp r8, r0 - bgt _080A132E - movs r7, #0x32 - ldrsh r0, [r2, r7] - cmp r3, r0 - bgt _080A132E - ldrb r0, [r2, #0xa] - adds r0, #1 - strb r0, [r4] - movs r0, #1 - strb r0, [r2, #0xb] - adds r6, #1 - ldr r1, _080A12FC @ =CuccoMinigame_Sounds - ldrb r0, [r2, #0xa] - lsls r0, r0, #1 - adds r0, r0, r1 - ldrh r0, [r0] - str r3, [sp] - bl SoundReq - ldr r3, [sp] - b _080A132E - .align 2, 0 -_080A12F8: .4byte gRoomControls -_080A12FC: .4byte CuccoMinigame_Sounds -_080A1300: - cmp r0, #0 - ble _080A132E - adds r6, #1 - ldr r0, [r2, #4] - cmp r0, #0 - beq _080A132C - cmp r2, #0 - beq _080A132C - mov r1, r8 - adds r1, #4 - movs r7, #0x2e - ldrsh r0, [r2, r7] - cmp r1, r0 - ble _080A131E - strh r1, [r2, #0x2e] -_080A131E: - adds r1, r3, #4 - movs r7, #0x32 - ldrsh r0, [r2, r7] - cmp r1, r0 - ble _080A132E - strh r1, [r2, #0x32] - b _080A132E -_080A132C: - strb r5, [r4] -_080A132E: - movs r0, #1 - rsbs r0, r0, #0 - add sl, r0 - adds r4, #1 - ldr r1, [sp, #4] - adds r1, #4 - str r1, [sp, #4] - mov r2, sl - cmp r2, #0 - bge _080A12B2 - mov r0, sb - adds r0, #0x6a - strh r6, [r0] - ldr r0, _080A136C @ =gPlayerState - adds r0, #0x27 - movs r1, #0xff - strb r1, [r0] - mov r1, sb - adds r1, #0x68 - ldrh r0, [r1] - subs r0, #1 - strh r0, [r1] - lsls r0, r0, #0x10 - cmp r0, #0 - bgt _080A1370 - movs r0, #0xe2 - bl SoundReq - bl sub_08050384 - b _080A1376 - .align 2, 0 -_080A136C: .4byte gPlayerState -_080A1370: - ldr r1, _080A1384 @ =gActiveScriptInfo - movs r0, #0 - strb r0, [r1, #6] -_080A1376: - add sp, #8 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 - _080A1384: .4byte gActiveScriptInfo - .syntax divided diff --git a/asm/non_matching/playerUtils/sub_080784E4.inc b/asm/non_matching/playerUtils/sub_080784E4.inc deleted file mode 100644 index 14b6afbb..00000000 --- a/asm/non_matching/playerUtils/sub_080784E4.inc +++ /dev/null @@ -1,315 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - ldr r0, _080784FC @ =gPossibleInteraction - ldrb r1, [r0] - mov r8, r0 - cmp r1, #0 - beq _08078500 - ldr r0, [r0, #4] - b _0807876A - .align 2, 0 -_080784FC: .4byte gPossibleInteraction -_08078500: - ldr r2, _08078528 @ =gPlayerState - adds r0, r2, #0 - adds r0, #0x27 - adds r3, r2, #0 - adds r3, #0x26 - ldrb r1, [r0] - ldrb r0, [r3] - orrs r0, r1 - cmp r0, #0 - bne _08078598 - adds r1, r2, #0 - adds r1, #0xa8 - ldrb r0, [r1] - cmp r0, #0 - bne _0807852C - adds r0, r2, #0 - adds r0, #0xa9 - ldrb r0, [r0] - b _0807852E - .align 2, 0 -_08078528: .4byte gPlayerState -_0807852C: - ldrb r0, [r1] -_0807852E: - subs r0, #2 - cmp r0, #0x14 - bhi _080785B0 - lsls r0, r0, #2 - ldr r1, _08078540 @ =_08078544 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08078540: .4byte _08078544 -_08078544: @ jump table - .4byte _08078598 @ case 0 - .4byte _08078598 @ case 1 - .4byte _080785B0 @ case 2 - .4byte _080785B0 @ case 3 - .4byte _080785B0 @ case 4 - .4byte _080785B0 @ case 5 - .4byte _080785B0 @ case 6 - .4byte _080785B0 @ case 7 - .4byte _080785B0 @ case 8 - .4byte _080785B0 @ case 9 - .4byte _080785B0 @ case 10 - .4byte _080785B0 @ case 11 - .4byte _080785B0 @ case 12 - .4byte _080785B0 @ case 13 - .4byte _080785B0 @ case 14 - .4byte _080785B0 @ case 15 - .4byte _08078598 @ case 16 - .4byte _080785B0 @ case 17 - .4byte _080785B0 @ case 18 - .4byte _08078598 @ case 19 - .4byte _08078598 @ case 20 -_08078598: - movs r0, #0xff - mov r1, r8 - strb r0, [r1, #3] - ldr r0, _080785AC @ =gNoInteraction - str r0, [r1, #4] - movs r1, #1 - mov r2, r8 - strb r1, [r2] - b _0807876A - .align 2, 0 -_080785AC: .4byte gNoInteraction -_080785B0: - ldr r0, [r2, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - bne _080785F0 - bl HasDungeonSmallKey - cmp r0, #0 - beq _080785C4 - movs r0, #1 -_080785C4: - adds r7, r0, #0 - bl HasDungeonBigKey - cmp r0, #0 - beq _080785D2 - movs r0, #2 - orrs r7, r0 -_080785D2: - ldr r3, _080785E4 @ =gPlayerEntity - ldrb r0, [r3, #0x14] - movs r1, #6 - ands r1, r0 - ldr r0, _080785E8 @ =gPlayerInteractHitboxOffsetNormal - adds r2, r1, r0 - ldr r5, _080785EC @ =gPossibleInteraction - mov r8, r5 - b _080785FE - .align 2, 0 -_080785E4: .4byte gPlayerEntity -_080785E8: .4byte gPlayerInteractHitboxOffsetNormal -_080785EC: .4byte gPossibleInteraction -_080785F0: - ldr r3, _08078624 @ =gPlayerEntity - ldrb r0, [r3, #0x14] - movs r1, #6 - ands r1, r0 - ldr r0, _08078628 @ =gPlayerInteractHitboxOffsetMinish - adds r2, r1, r0 - movs r7, #0 -_080785FE: - mov ip, r3 - mov r0, ip - movs r3, #0x2e - ldrsh r1, [r0, r3] - movs r0, #0 - ldrsb r0, [r2, r0] - adds r1, r1, r0 - mov sl, r1 - mov r5, ip - movs r0, #0x32 - ldrsh r1, [r5, r0] - movs r0, #1 - ldrsb r0, [r2, r0] - adds r1, r1, r0 - mov sb, r1 - movs r6, #0 - ldr r5, _0807862C @ =gInteractableObjects - b _08078724 - .align 2, 0 -_08078624: .4byte gPlayerEntity -_08078628: .4byte gPlayerInteractHitboxOffsetMinish -_0807862C: .4byte gInteractableObjects -_08078630: - ldrb r1, [r5] - movs r3, #1 - adds r0, r3, #0 - ands r0, r1 - cmp r0, #0 - bne _0807864E - mov r0, ip - adds r0, #0x38 - adds r1, r2, #0 - adds r1, #0x38 - ldrb r2, [r0] - ldrb r0, [r1] - ands r0, r2 - cmp r0, #0 - beq _08078714 -_0807864E: - ldrb r1, [r5, #2] - mov r2, ip - ldrb r0, [r2, #0x14] - lsrs r0, r0, #1 - asrs r1, r0 - ands r1, r3 - cmp r1, #0 - bne _08078714 - ldrb r0, [r5, #1] - cmp r0, #0xa - bhi _080786D4 - lsls r0, r0, #2 - ldr r1, _08078670 @ =_08078674 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08078670: .4byte _08078674 -_08078674: @ jump table - .4byte _08078714 @ case 0 - .4byte _080786A0 @ case 1 - .4byte _080786C4 @ case 2 - .4byte _080786A0 @ case 3 - .4byte _080786A0 @ case 4 - .4byte _080786C8 @ case 5 - .4byte _080786CC @ case 6 - .4byte _080786B4 @ case 7 - .4byte _080786A0 @ case 8 - .4byte _080786A0 @ case 9 - .4byte _080786D4 @ case 10 -_080786A0: - ldr r0, _080786B0 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08078714 - b _080786D4 - .align 2, 0 -_080786B0: .4byte gPlayerState -_080786B4: - ldr r0, _080786C0 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - b _080786D0 - .align 2, 0 -_080786C0: .4byte gPlayerState -_080786C4: - ldrb r0, [r5, #3] - b _080786D0 -_080786C8: - movs r0, #1 - b _080786CE -_080786CC: - movs r0, #2 -_080786CE: - ands r0, r7 -_080786D0: - cmp r0, #0 - beq _08078714 -_080786D4: - ldr r0, [r5, #8] - movs r1, #0x2e - ldrsh r3, [r0, r1] - movs r2, #0x32 - ldrsh r4, [r0, r2] - ldr r1, [r5, #4] - cmp r1, #0 - beq _080786F4 - movs r0, #0 - ldrsb r0, [r1, r0] - adds r3, r3, r0 - movs r0, #1 - ldrsb r0, [r1, r0] - adds r4, r4, r0 - adds r2, r1, #2 - b _080786F8 -_080786F4: - ldr r0, [r0, #0x48] - adds r2, r0, #6 -_080786F8: - ldrb r1, [r2] - mov r5, sl - adds r0, r1, r5 - subs r0, r0, r3 - lsls r1, r1, #1 - cmp r0, r1 - bhs _08078714 - ldrb r1, [r2, #1] - mov r2, sb - adds r0, r1, r2 - subs r0, r0, r4 - lsls r1, r1, #1 - cmp r0, r1 - blo _0807873A -_08078714: - adds r6, #1 - cmp r6, #0x1f - bhi _08078758 - lsls r0, r6, #1 - adds r0, r0, r6 - lsls r0, r0, #2 - ldr r3, _08078754 @ =gInteractableObjects - adds r5, r0, r3 -_08078724: - ldr r2, [r5, #8] - cmp r2, #0 - beq _08078714 - adds r0, r2, #0 - adds r0, #0x39 - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #0 - blt _0807873A - b _08078630 -_0807873A: - cmp r6, #0x1f - bhi _08078758 - mov r5, r8 - strb r6, [r5, #3] - lsls r0, r6, #1 - adds r0, r0, r6 - lsls r0, r0, #2 - mov r1, r8 - adds r1, #8 - adds r0, r0, r1 - str r0, [r5, #4] - b _08078762 - .align 2, 0 -_08078754: .4byte gInteractableObjects -_08078758: - movs r0, #0xff - mov r1, r8 - strb r0, [r1, #3] - ldr r0, _08078774 @ =gNoInteraction - str r0, [r1, #4] -_08078762: - movs r0, #1 - mov r2, r8 - strb r0, [r2] - ldr r0, [r2, #4] -_0807876A: - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08078774: .4byte gNoInteraction - .syntax divided diff --git a/asm/non_matching/playerUtils/sub_080789A8.inc b/asm/non_matching/playerUtils/sub_080789A8.inc deleted file mode 100644 index 3b2185e2..00000000 --- a/asm/non_matching/playerUtils/sub_080789A8.inc +++ /dev/null @@ -1,116 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - ldr r1, _080789BC @ =gCarriedEntity - ldrb r0, [r1] - cmp r0, #0 - beq _080789C0 - ldrb r0, [r1, #1] - b _08078A88 - .align 2, 0 -_080789BC: .4byte gCarriedEntity -_080789C0: - ldr r0, _08078A5C @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08078A56 - ldr r0, _08078A60 @ =gPlayerEntity - bl GetCollisionDataAtEntity - adds r4, r0, #0 - cmp r4, #0xf - bls _080789E6 - ldr r0, _08078A64 @ =gUnk_080084BC - adds r1, r4, #0 - subs r1, #0x10 - adds r1, r1, r0 - ldrb r0, [r1] - cmp r0, #0xf - beq _08078A56 -_080789E6: - ldr r0, _08078A5C @ =gPlayerState - ldrb r0, [r0, #0x12] - cmp r0, #0x12 - beq _08078A56 - ldr r3, _08078A68 @ =gCarriedEntity - movs r0, #1 - strb r0, [r3] - ldrb r4, [r3, #2] - cmp r4, #0 - beq _08078A2E - ldr r2, _08078A60 @ =gPlayerEntity - ldrb r1, [r2, #0x14] - movs r0, #6 - ands r0, r1 - ldr r1, _08078A6C @ =gUnk_0811BFE0 - adds r6, r0, r1 - adds r7, r2, #0 - adds r3, #8 - mov r8, r3 -_08078A0C: - lsls r0, r4, #2 - mov r1, r8 - adds r5, r0, r1 - ldr r1, [r5] - cmp r1, #0 - beq _08078A26 - ldrb r2, [r6] - ldrb r3, [r6, #1] - adds r0, r7, #0 - bl sub_0807A180 - cmp r0, #0 - bne _08078A74 -_08078A26: - subs r4, #1 - ldr r7, _08078A60 @ =gPlayerEntity - cmp r4, #0 - bne _08078A0C -_08078A2E: - ldr r0, _08078A60 @ =gPlayerEntity - ldrb r1, [r0, #0x14] - movs r2, #6 - ands r2, r1 - ldr r1, _08078A70 @ =gUnk_08007DF4 - adds r2, r2, r1 - movs r1, #0 - ldrsb r1, [r2, r1] - ldrb r2, [r2, #1] - lsls r2, r2, #0x18 - asrs r2, r2, #0x18 - bl sub_080B1A0C - ldr r4, _08078A68 @ =gCarriedEntity - strh r0, [r4, #4] - movs r1, #6 - bl sub_0806FC24 - cmp r0, #0 - bne _08078A84 -_08078A56: - movs r0, #0 - b _08078A88 - .align 2, 0 -_08078A5C: .4byte gPlayerState -_08078A60: .4byte gPlayerEntity -_08078A64: .4byte gUnk_080084BC -_08078A68: .4byte gCarriedEntity -_08078A6C: .4byte gUnk_0811BFE0 -_08078A70: .4byte gUnk_08007DF4 -_08078A74: - mov r0, r8 - subs r0, #8 - ldr r1, [r5] - str r1, [r0, #8] - movs r1, #2 - strb r1, [r0, #1] - movs r0, #2 - b _08078A88 -_08078A84: - movs r0, #1 - strb r0, [r4, #1] -_08078A88: - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7, pc} - .align 2, 0 - .syntax divided diff --git a/asm/non_matching/playerUtils/sub_080792D8.inc b/asm/non_matching/playerUtils/sub_080792D8.inc deleted file mode 100644 index e14695a1..00000000 --- a/asm/non_matching/playerUtils/sub_080792D8.inc +++ /dev/null @@ -1,139 +0,0 @@ - .syntax unified - push {r4, r5, r6, lr} - ldr r5, _08079344 @ =gPlayerEntity - adds r3, r5, #0 - adds r3, #0x42 - ldrb r0, [r3] - cmp r0, #0 - beq _080793E0 - ldrb r2, [r5, #0xc] - cmp r2, #0xb - beq _08079338 - ldr r0, _08079348 @ =gPlayerState - ldrb r1, [r0, #0x1e] - adds r6, r0, #0 - cmp r1, #0 - bne _08079338 - ldrb r0, [r6, #5] - subs r0, #1 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #3 - bls _08079338 - ldrb r0, [r6, #2] - cmp r0, #0 - bne _08079338 - ldrb r0, [r6, #0x12] - cmp r0, #0xff - beq _08079338 - ldrb r1, [r6, #7] - movs r0, #0x80 - ands r0, r1 - cmp r0, #0 - bne _08079338 - adds r0, r6, #0 - adds r0, #0x26 - ldrb r1, [r0] - movs r0, #0xf - ands r0, r1 - subs r0, #1 - cmp r0, #0 - bgt _08079338 - cmp r2, #3 - beq _08079338 - ldr r1, [r6, #0x30] - movs r0, #0x80 - lsls r0, r0, #0xb - ands r1, r0 - cmp r1, #0 - beq _0807934C -_08079338: - adds r1, r5, #0 - adds r1, #0x42 - movs r0, #0 - strb r0, [r1] - b _080793E0 - .align 2, 0 -_08079344: .4byte gPlayerEntity -_08079348: .4byte gPlayerState -_0807934C: - cmp r2, #0x1d - bne _0807935E - adds r0, r5, #0 - adds r0, #0x3e - ldrb r0, [r0] - cmp r0, #0x10 - beq _0807935E - strb r1, [r3] - b _080793E0 -_0807935E: - adds r0, r5, #0 - adds r0, #0x42 - ldrb r3, [r0] - movs r1, #0 - ldrsb r1, [r0, r1] - adds r2, r0, #0 - cmp r1, #0 - ble _08079372 - subs r0, r3, #1 - b _08079374 -_08079372: - adds r0, r3, #1 -_08079374: - strb r0, [r2] - ldrb r0, [r2] - cmp r0, #0 - beq _080793E0 - adds r4, r6, #0 - ldrb r0, [r4, #7] - movs r1, #0xdf - ands r1, r0 - strb r1, [r4, #7] - adds r0, r5, #0 - adds r0, #0x3d - ldrb r0, [r0] - lsls r0, r0, #0x18 - asrs r0, r0, #0x18 - cmp r0, #0 - ble _080793CA - adds r0, r4, #0 - adds r0, #0x26 - ldrb r0, [r0] - cmp r0, #0 - bne _080793CA - ldr r0, [r4, #0x30] - movs r1, #0x80 - ands r0, r1 - cmp r0, #0 - bne _080793CA - ldrb r0, [r4, #2] - cmp r0, #0 - bne _080793CA - bl ResetActiveItems - ldr r0, [r4, #0x30] - movs r1, #8 - ands r0, r1 - cmp r0, #0 - bne _080793C4 - movs r0, #0x8a - lsls r0, r0, #1 - strh r0, [r4, #8] - b _080793CA -_080793C4: - movs r0, #0x83 - lsls r0, r0, #3 - strh r0, [r6, #8] -_080793CA: - movs r1, #0xa0 - lsls r1, r1, #2 - adds r4, r5, #0 - adds r4, #0x3e - ldrb r2, [r4] - adds r0, r5, #0 - bl sub_080027EA - ldrb r0, [r4] - bl sub_0807A5B8 -_080793E0: - pop {r4, r5, r6, pc} - .align 2, 0 - .syntax divided diff --git a/asm/non_matching/playerUtils/sub_0807A2F8.inc b/asm/non_matching/playerUtils/sub_0807A2F8.inc deleted file mode 100644 index 5d903c0d..00000000 --- a/asm/non_matching/playerUtils/sub_0807A2F8.inc +++ /dev/null @@ -1,257 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #4 - adds r4, r0, #0 - ldr r0, _0807A364 @ =gRoomControls - mov r8, r0 - ldrb r0, [r0, #4] - cmp r0, #8 - bne _0807A312 - b _0807A4F2 -_0807A312: - bl sub_08079778 - orrs r0, r4 - cmp r0, #0 - bne _0807A31E - b _0807A4F2 -_0807A31E: - ldr r7, _0807A368 @ =gPlayerEntity - ldrb r1, [r7, #0x14] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - beq _0807A36C - movs r1, #0x2e - ldrsh r2, [r7, r1] - mov r6, r8 - ldrh r0, [r6, #6] - subs r2, r2, r0 - asrs r2, r2, #4 - movs r3, #0x3f - ands r2, r3 - movs r0, #0x32 - ldrsh r1, [r7, r0] - ldr r0, [r7, #0x48] - ldrb r5, [r0, #5] - adds r0, r1, r5 - ldrh r4, [r6, #8] - subs r0, r0, r4 - asrs r0, r0, #4 - ands r0, r3 - lsls r0, r0, #6 - orrs r0, r2 - lsls r7, r0, #1 - subs r1, r1, r5 - subs r1, r1, r4 - asrs r1, r1, #4 - ands r1, r3 - lsls r1, r1, #6 - orrs r2, r1 - lsls r6, r2, #1 - b _0807A3A2 - .align 2, 0 -_0807A364: .4byte gRoomControls -_0807A368: .4byte gPlayerEntity -_0807A36C: - movs r1, #0x2e - ldrsh r3, [r7, r1] - ldr r0, [r7, #0x48] - ldrb r6, [r0, #2] - adds r1, r3, r6 - mov r2, r8 - ldrh r5, [r2, #6] - subs r1, r1, r5 - asrs r1, r1, #4 - movs r4, #0x3f - ands r1, r4 - movs r2, #0x32 - ldrsh r0, [r7, r2] - mov r7, r8 - ldrh r2, [r7, #8] - subs r0, r0, r2 - asrs r0, r0, #4 - ands r0, r4 - lsls r0, r0, #6 - orrs r1, r0 - lsls r7, r1, #1 - subs r3, r3, r6 - subs r3, r3, r5 - asrs r3, r3, #4 - ands r3, r4 - orrs r3, r0 - lsls r6, r3, #1 -_0807A3A2: - movs r0, #0 - mov sb, r0 - ldr r1, _0807A3F4 @ =gPlayerEntity - mov sl, r1 -_0807A3AA: - movs r2, #0 - mov r8, r2 - mov r0, sl - mov r1, sp - adds r2, r7, #0 - bl sub_08004202 - adds r7, r0, #0 - lsrs r4, r7, #1 - adds r0, r4, #0 - movs r1, #1 - bl GetCollisionDataAtMetaTilePos - cmp r0, #0 - beq _0807A3FC - lsls r0, r4, #0x10 - lsrs r0, r0, #0x10 - mov r1, sl - adds r1, #0x38 - ldrb r1, [r1] - bl GetVvvAtMetaTilePos - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - mov r2, sl - ldrb r1, [r2, #0x14] - lsrs r1, r1, #1 - lsls r1, r1, #2 - ldr r2, _0807A3F8 @ =gUnk_0811C1D8 - adds r1, r1, r2 - ldr r1, [r1] - bl FindValueForKey - cmp r0, #0 - beq _0807A468 - b _0807A400 - .align 2, 0 -_0807A3F4: .4byte gPlayerEntity -_0807A3F8: .4byte gUnk_0811C1D8 -_0807A3FC: - movs r0, #1 - mov r8, r0 -_0807A400: - ldr r5, _0807A444 @ =gPlayerEntity - adds r0, r5, #0 - mov r1, sp - adds r2, r6, #0 - bl sub_08004202 - adds r6, r0, #0 - lsrs r4, r6, #1 - adds r0, r4, #0 - movs r1, #1 - bl GetCollisionDataAtMetaTilePos - cmp r0, #0 - beq _0807A44C - lsls r0, r4, #0x10 - lsrs r0, r0, #0x10 - adds r1, r5, #0 - adds r1, #0x38 - ldrb r1, [r1] - bl GetVvvAtMetaTilePos - lsls r0, r0, #0x10 - lsrs r0, r0, #0x10 - ldrb r1, [r5, #0x14] - lsrs r1, r1, #1 - lsls r1, r1, #2 - ldr r2, _0807A448 @ =gUnk_0811C1D8 - adds r1, r1, r2 - ldr r1, [r1] - bl FindValueForKey - cmp r0, #0 - beq _0807A468 - b _0807A450 - .align 2, 0 -_0807A444: .4byte gPlayerEntity -_0807A448: .4byte gUnk_0811C1D8 -_0807A44C: - movs r0, #1 - add r8, r0 -_0807A450: - mov r1, r8 - cmp r1, #2 - bne _0807A45E - mov r2, sb - cmp r2, #0 - bne _0807A46E - b _0807A4F2 -_0807A45E: - movs r0, #1 - add sb, r0 - mov r1, sb - cmp r1, #1 - bls _0807A3AA -_0807A468: - mov r2, sb - cmp r2, #0 - beq _0807A4F2 -_0807A46E: - bl AreaIsDungeon - cmp r0, #0 - beq _0807A4B0 - ldr r4, _0807A4AC @ =gPlayerEntity - adds r0, r4, #0 - mov r1, sp - adds r2, r7, #0 - bl sub_08004202 - adds r7, r0, #0 - lsrs r0, r7, #1 - movs r1, #2 - bl GetCollisionDataAtMetaTilePos - cmp r0, #0 - bne _0807A4F2 - adds r0, r4, #0 - mov r1, sp - adds r2, r6, #0 - bl sub_08004202 - adds r6, r0, #0 - lsrs r0, r6, #1 - movs r1, #2 -_0807A4A0: - bl GetCollisionDataAtMetaTilePos - cmp r0, #0 - beq _0807A4EC - b _0807A4F2 - .align 2, 0 -_0807A4AC: .4byte gPlayerEntity -_0807A4B0: - mov r0, sb - cmp r0, #2 - bne _0807A4C2 - ldr r0, _0807A4E8 @ =gPlayerEntity - mov r1, sp - adds r2, r7, #0 - bl sub_08004202 - adds r7, r0, #0 -_0807A4C2: - lsrs r0, r7, #1 - movs r1, #1 - bl GetCollisionDataAtMetaTilePos - cmp r0, #0 - bne _0807A4F2 - mov r1, sb - cmp r1, #2 - bne _0807A4E0 - ldr r0, _0807A4E8 @ =gPlayerEntity - mov r1, sp - adds r2, r6, #0 - bl sub_08004202 - adds r6, r0, #0 -_0807A4E0: - lsrs r0, r6, #1 - movs r1, #1 - b _0807A4A0 - .align 2, 0 -_0807A4E8: .4byte gPlayerEntity -_0807A4EC: - mov r0, sb - adds r0, #1 - b _0807A4F4 -_0807A4F2: - movs r0, #0 -_0807A4F4: - add sp, #4 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .syntax divided diff --git a/asm/non_matching/playerUtils/sub_0807BFD0.inc b/asm/non_matching/playerUtils/sub_0807BFD0.inc deleted file mode 100644 index 055bcd55..00000000 --- a/asm/non_matching/playerUtils/sub_0807BFD0.inc +++ /dev/null @@ -1,123 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - bl ClearBgAnimations - bl sub_0807BFA8 - ldr r7, _0807C0B8 @ =0x0000FFFF - ldr r6, _0807C0BC @ =gMapBottom+0x5004 - movs r0, #0x80 - lsls r0, r0, #5 - mov r8, r0 - adds r0, r7, #0 - adds r1, r6, #0 - mov r2, r8 - bl MemFill16 - movs r5, #0 - strh r5, [r6] - ldr r4, _0807C0C0 @ =gMapTop+0x5004 - adds r0, r7, #0 - adds r1, r4, #0 - mov r2, r8 - bl MemFill16 - strh r5, [r4] - ldr r2, _0807C0C4 @ =gRoomControls - ldr r0, _0807C0C8 @ =gArea - ldr r1, _0807C0CC @ =0x0000085C - adds r4, r0, r1 - ldr r0, [r4] - ldr r1, [r2, #0x34] - ldr r0, [r0, #8] - cmp r1, r0 - beq _0807C01C - str r0, [r2, #0x34] - bl LoadMapData -_0807C01C: - ldr r0, [r4] - ldr r0, [r0, #0x10] - bl LoadMapData - ldr r1, _0807C0D0 @ =gPaletteBuffer - adds r0, r1, #0 - adds r0, #0x60 - movs r2, #0xa8 - lsls r2, r2, #2 - adds r1, r1, r2 - movs r2, #0x20 - bl MemCopy - ldr r2, _0807C0D4 @ =gUsedPalettes - ldr r0, [r2] - movs r1, #0x80 - lsls r1, r1, #0xe - orrs r0, r1 - str r0, [r2] - ldr r0, [r4] - ldr r0, [r0, #0x14] - cmp r0, #0 - beq _0807C04E - bl LoadBgAnimations -_0807C04E: - adds r5, r6, #0 - movs r0, #0x80 - lsls r0, r0, #5 - adds r6, r5, r0 - adds r0, r7, #0 - adds r1, r6, #0 - mov r2, r8 - bl MemFill16 - movs r2, #0 - ldr r3, _0807C0D8 @ =0x000007FF - adds r4, r7, #0 -_0807C066: - ldrh r0, [r5] - cmp r0, r3 - bhi _0807C078 - lsls r0, r0, #1 - adds r1, r0, r6 - ldrh r0, [r1] - cmp r0, r4 - bne _0807C078 - strh r2, [r1] -_0807C078: - adds r2, #1 - adds r5, #2 - cmp r2, r3 - ble _0807C066 - movs r2, #0x80 - lsls r2, r2, #5 - ldr r5, _0807C0C0 @ =gMapTop+0x5004 - adds r6, r5, r2 - ldr r4, _0807C0B8 @ =0x0000FFFF - adds r0, r4, #0 - adds r1, r6, #0 - bl MemFill16 - movs r2, #0 - ldr r3, _0807C0D8 @ =0x000007FF -_0807C096: - ldrh r0, [r5] - cmp r0, r3 - bhi _0807C0A8 - lsls r0, r0, #1 - adds r1, r0, r6 - ldrh r0, [r1] - cmp r0, r4 - bne _0807C0A8 - strh r2, [r1] -_0807C0A8: - adds r2, #1 - adds r5, #2 - cmp r2, r3 - ble _0807C096 - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_0807C0B8: .4byte 0x0000FFFF -_0807C0BC: .4byte gMapBottom+0x5004 -_0807C0C0: .4byte gMapTop+0x5004 -_0807C0C4: .4byte gRoomControls -_0807C0C8: .4byte gArea -_0807C0CC: .4byte 0x0000085C -_0807C0D0: .4byte gPaletteBuffer -_0807C0D4: .4byte gUsedPalettes -_0807C0D8: .4byte 0x000007FF - .syntax divided diff --git a/asm/non_matching/playerUtils/sub_0807C8B0.inc b/asm/non_matching/playerUtils/sub_0807C8B0.inc deleted file mode 100644 index 90f1d5db..00000000 --- a/asm/non_matching/playerUtils/sub_0807C8B0.inc +++ /dev/null @@ -1,98 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - mov r8, r0 - adds r4, r1, #0 - mov ip, r2 - mov r0, ip - muls r0, r4, r0 - lsls r0, r0, #1 - add r0, r8 - subs r7, r0, #2 - mov r0, ip - subs r0, #1 - lsls r0, r0, #7 - add r0, r8 - lsls r3, r4, #1 - subs r1, r3, #2 - adds r0, r0, r1 - movs r5, #0 - cmp r5, ip - bhs _0807C906 - mov sb, r3 -_0807C8DE: - movs r2, #0 - adds r6, r0, #0 - subs r6, #0x80 - cmp r2, r4 - bhs _0807C8FA - adds r1, r7, #0 - adds r3, r0, #0 -_0807C8EC: - ldrh r0, [r1] - strh r0, [r3] - subs r1, #2 - subs r3, #2 - adds r2, #1 - cmp r2, r4 - blo _0807C8EC -_0807C8FA: - adds r0, r6, #0 - mov r1, sb - subs r7, r7, r1 - adds r5, #1 - cmp r5, ip - blo _0807C8DE -_0807C906: - movs r0, #0x40 - subs r6, r0, r4 - movs r5, #0 - lsls r0, r4, #1 - mov r2, ip - lsls r7, r2, #7 - mov r2, r8 - adds r1, r2, r0 -_0807C916: - lsls r0, r5, #7 - adds r0, r1, r0 - movs r2, #0 - adds r3, r5, #1 - cmp r2, r6 - bhs _0807C92E - movs r4, #0 -_0807C924: - strh r4, [r0] - adds r0, #2 - adds r2, #1 - cmp r2, r6 - blo _0807C924 -_0807C92E: - adds r5, r3, #0 - cmp r5, #0x3f - bls _0807C916 - movs r0, #0x40 - mov r1, ip - subs r6, r0, r1 - mov r2, r8 - adds r0, r2, r7 - movs r5, #0 - cmp r5, r6 - bhs _0807C956 - adds r4, r0, #0 -_0807C946: - adds r0, r4, #0 - movs r1, #0x80 - bl MemClear - adds r4, #0x80 - adds r5, #1 - cmp r5, r6 - blo _0807C946 -_0807C956: - pop {r3, r4} - mov r8, r3 - mov sb, r4 - pop {r4, r5, r6, r7, pc} - .align 2, 0 - .syntax divided diff --git a/asm/non_matching/scroll/sub_080803D0.inc b/asm/non_matching/scroll/sub_080803D0.inc deleted file mode 100644 index f95374f7..00000000 --- a/asm/non_matching/scroll/sub_080803D0.inc +++ /dev/null @@ -1,290 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - sub sp, #0x38 - ldr r1, _080804F0 @ =gRoomControls - movs r2, #0xa - ldrsh r0, [r1, r2] - ldrh r2, [r1, #6] - subs r0, r0, r2 - str r0, [sp, #0x18] - ldr r3, [r1, #0x30] - movs r4, #0x2e - ldrsh r0, [r3, r4] - subs r0, r0, r2 - str r0, [sp, #0x10] - movs r2, #0xc - ldrsh r0, [r1, r2] - ldrh r1, [r1, #8] - subs r0, r0, r1 - str r0, [sp, #0x1c] - movs r4, #0x32 - ldrsh r0, [r3, r4] - subs r0, r0, r1 - str r0, [sp, #0x14] - movs r0, #0x3c - str r0, [sp, #8] -_08080408: - movs r7, #0 - ldr r1, [sp, #8] - adds r1, #6 - str r1, [sp, #8] - adds r2, r1, #0 - muls r2, r1, r2 - mov sl, r2 - lsls r4, r1, #1 - adds r0, r4, #0 - movs r1, #3 - bl __divsi3 - str r0, [sp, #0xc] - adds r1, r0, #0 - muls r1, r0, r1 - mov sb, r1 - movs r2, #0 - str r2, [sp, #4] - rsbs r4, r4, #0 - adds r4, #1 - mov r0, sb - muls r0, r4, r0 - mov r4, sl - lsls r5, r4, #1 - adds r4, r0, r5 - ldr r0, [sp, #8] - mov r6, sb - muls r6, r0, r6 - adds r0, r6, #0 - mov r1, sl - bl __divsi3 - adds r2, r0, #0 - cmp r7, r2 - bgt _08080506 - ldr r1, [sp, #0x18] - adds r1, #0xf8 - str r1, [sp, #0x20] - mov r1, sl - adds r0, r5, r1 - lsls r3, r0, #1 - str r6, [sp, #0x2c] - ldr r0, [sp, #8] - lsls r1, r0, #2 - rsbs r1, r1, #0 - adds r1, #4 - mov r8, r1 - rsbs r0, r0, #0 - adds r0, #8 - ldr r1, [sp, #0x10] - adds r6, r0, r1 - ldr r0, [sp, #8] - adds r5, r0, r1 - mov r0, r8 - mov r1, sb - muls r1, r0, r1 - mov r8, r1 -_0808047A: - ldr r1, [sp, #0x1c] - adds r1, #0xa8 - mov ip, r1 - ldr r0, [sp, #0x14] - ldr r1, [sp, #4] - adds r0, r0, r1 - str r0, [sp, #0x34] - cmp ip, r0 - ble _080804A0 - ldr r0, [sp, #0x20] - cmp r0, r5 - ble _08080496 - movs r0, #1 - orrs r7, r0 -_08080496: - ldr r1, [sp, #0x18] - cmp r1, r6 - bge _080804A0 - movs r0, #2 - orrs r7, r0 -_080804A0: - ldr r0, [sp, #0x14] - ldr r1, [sp, #4] - subs r0, r0, r1 - mov ip, r0 - adds r0, #8 - ldr r1, [sp, #0x1c] - cmp r1, r0 - bge _080804C4 - ldr r0, [sp, #0x20] - cmp r0, r5 - ble _080804BA - movs r0, #4 - orrs r7, r0 -_080804BA: - ldr r1, [sp, #0x18] - cmp r1, r6 - bge _080804C4 - movs r0, #8 - orrs r7, r0 -_080804C4: - cmp r4, #0 - ble _080804F4 - mov r2, r8 - adds r0, r2, r3 - adds r4, r4, r0 - ldr r0, [sp, #0x2c] - mov r1, sb - subs r0, r0, r1 - str r0, [sp, #0x2c] - lsls r0, r1, #2 - add r8, r0 - adds r6, #1 - subs r5, #1 - ldr r0, [sp, #0x2c] - mov r1, sl - str r3, [sp, #0x30] - bl __divsi3 - adds r2, r0, #0 - ldr r3, [sp, #0x30] - b _080804F6 - .align 2, 0 -_080804F0: .4byte gRoomControls -_080804F4: - adds r4, r4, r3 -_080804F6: - mov r1, sl - lsls r0, r1, #2 - adds r3, r3, r0 - ldr r0, [sp, #4] - adds r0, #1 - str r0, [sp, #4] - cmp r0, r2 - ble _0808047A -_08080506: - movs r1, #0 - str r1, [sp] - ldr r2, [sp, #0xc] - str r2, [sp, #4] - mov r4, sb - lsls r6, r4, #1 - lsls r0, r2, #1 - rsbs r0, r0, #0 - adds r0, #1 - mov r1, sl - muls r1, r0, r1 - adds r0, r1, #0 - adds r4, r6, r0 - mov r5, sl - muls r5, r2, r5 - adds r0, r5, #0 - mov r1, sb - bl __divsi3 - adds r2, r0, #0 - ldr r0, [sp] - cmp r0, r2 - bgt _080805E4 - ldr r1, [sp, #0x18] - adds r1, #0xf8 - str r1, [sp, #0x24] - mov r1, sb - adds r0, r6, r1 - lsls r0, r0, #1 - mov r8, r0 - ldr r3, [sp, #0x10] - adds r3, #8 - ldr r6, [sp, #0x10] - str r5, [sp, #0x28] - ldr r1, [sp, #4] - lsls r0, r1, #2 - rsbs r0, r0, #0 - adds r0, #4 - mov r5, sl - muls r5, r0, r5 -_08080556: - ldr r0, [sp, #0x1c] - adds r0, #0xa8 - mov ip, r0 - ldr r1, [sp, #0x14] - ldr r0, [sp, #4] - adds r1, r1, r0 - str r1, [sp, #0x34] - cmp ip, r1 - ble _0808057C - ldr r1, [sp, #0x24] - cmp r1, r6 - ble _08080572 - movs r0, #0x10 - orrs r7, r0 -_08080572: - ldr r0, [sp, #0x18] - cmp r0, r3 - bge _0808057C - movs r0, #0x20 - orrs r7, r0 -_0808057C: - ldr r1, [sp, #0x14] - ldr r0, [sp, #4] - subs r1, r1, r0 - mov ip, r1 - mov r0, ip - adds r0, #8 - ldr r1, [sp, #0x1c] - cmp r1, r0 - bge _080805A2 - ldr r0, [sp, #0x24] - cmp r0, r6 - ble _08080598 - movs r0, #0x40 - orrs r7, r0 -_08080598: - ldr r1, [sp, #0x18] - cmp r1, r3 - bge _080805A2 - movs r0, #0x80 - orrs r7, r0 -_080805A2: - cmp r4, #0 - ble _080805CE - mov r2, r8 - adds r0, r2, r5 - adds r4, r4, r0 - ldr r0, [sp, #0x28] - mov r1, sl - subs r0, r0, r1 - str r0, [sp, #0x28] - lsls r0, r1, #2 - adds r5, r5, r0 - ldr r2, [sp, #4] - subs r2, #1 - str r2, [sp, #4] - ldr r0, [sp, #0x28] - mov r1, sb - str r3, [sp, #0x30] - bl __divsi3 - adds r2, r0, #0 - ldr r3, [sp, #0x30] - b _080805D0 -_080805CE: - add r4, r8 -_080805D0: - mov r1, sb - lsls r0, r1, #2 - add r8, r0 - subs r3, #1 - adds r6, #1 - ldr r0, [sp] - adds r0, #1 - str r0, [sp] - cmp r0, r2 - ble _08080556 -_080805E4: - cmp r7, #0 - beq _080805EA - b _08080408 -_080805EA: - ldr r0, [sp, #8] - add sp, #0x38 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .syntax divided diff --git a/asm/non_matching/vram/sub_080AE218.inc b/asm/non_matching/vram/sub_080AE218.inc deleted file mode 100644 index 04329b49..00000000 --- a/asm/non_matching/vram/sub_080AE218.inc +++ /dev/null @@ -1,138 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - mov r7, sl - mov r6, sb - mov r5, r8 - push {r5, r6, r7} - mov sl, r0 - mov r8, r1 - lsls r0, r1, #4 - movs r1, #0xa0 - lsls r1, r1, #1 - adds r0, r0, r1 - mov ip, r0 - mov r2, sl - lsls r0, r2, #4 - adds r3, r0, r1 - ldr r1, _080AE30C @ =gGFXSlots - lsls r0, r2, #1 - add r0, sl - lsls r0, r0, #2 - adds r0, r0, r1 - ldrb r0, [r0, #5] - lsls r0, r0, #4 - adds r7, r3, r0 - movs r4, #0 - ldr r6, _080AE310 @ =gUnk_020000C0 - mov sb, r6 - ldr r0, _080AE314 @ =gPlayerEntity - adds r2, r0, #0 - adds r2, #0x26 - adds r5, r0, #0 -_080AE254: - ldr r0, [r5, #4] - cmp r0, #0 - beq _080AE276 - ldrb r0, [r2] - cmp sl, r0 - bne _080AE264 - mov r1, r8 - strb r1, [r2] -_080AE264: - ldrh r0, [r2, #0x3a] - cmp r3, r0 - bhi _080AE276 - cmp r7, r0 - bls _080AE276 - subs r0, r0, r3 - mov r6, ip - adds r1, r0, r6 - strh r1, [r2, #0x3a] -_080AE276: - adds r2, #0x88 - adds r5, #0x88 - adds r4, #1 - cmp r4, #0x4f - bls _080AE254 - movs r0, #0 -_080AE282: - movs r4, #0 - adds r1, r0, #1 - mov r8, r1 - lsls r5, r0, #6 -_080AE28A: - lsls r0, r4, #4 - add r0, sb - adds r2, r5, r0 - ldrb r1, [r2] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _080AE2B4 - movs r0, #2 - ands r0, r1 - cmp r0, #0 - bne _080AE2B4 - ldrh r1, [r2, #0xa] - cmp r3, r1 - bhi _080AE2B4 - cmp r7, r1 - bls _080AE2B4 - subs r0, r1, r3 - mov r6, ip - adds r1, r0, r6 - strh r1, [r2, #0xa] -_080AE2B4: - adds r4, #1 - cmp r4, #3 - bls _080AE28A - mov r0, r8 - cmp r0, #0x2f - bls _080AE282 - movs r4, #0 - ldr r0, _080AE318 @ =0xFFFFFC00 - mov sl, r0 - ldr r5, _080AE31C @ =gOAMControls - adds r5, #0x24 - ldr r1, _080AE320 @ =0x000003FF - mov sb, r1 - movs r2, #1 - mov r8, r2 -_080AE2D2: - ldrh r2, [r5] - lsls r0, r2, #0x16 - lsrs r1, r0, #0x16 - cmp r3, r1 - bhi _080AE2F8 - cmp r7, r1 - bls _080AE2F8 - subs r0, r1, r3 - mov r6, ip - adds r1, r0, r6 - mov r0, sb - ands r1, r0 - mov r0, sl - ands r0, r2 - orrs r0, r1 - strh r0, [r5] - mov r2, r8 - ldr r1, _080AE31C @ =gOAMControls - strb r2, [r1] -_080AE2F8: - adds r5, #8 - adds r4, #1 - cmp r4, #0x7f - bls _080AE2D2 - pop {r3, r4, r5} - mov r8, r3 - mov sb, r4 - mov sl, r5 - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_080AE30C: .4byte gGFXSlots -_080AE310: .4byte gUnk_020000C0 -_080AE314: .4byte gPlayerEntity -_080AE318: .4byte 0xFFFFFC00 -_080AE31C: .4byte gOAMControls -_080AE320: .4byte 0x000003FF - .syntax divided diff --git a/asm/object/evilSpirit.s b/asm/object/evilSpirit.s deleted file mode 100644 index 8b0dfec6..00000000 --- a/asm/object/evilSpirit.s +++ /dev/null @@ -1,570 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -@ -@ Please leave this file as a tutorial. -@ -@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - - thumb_func_start EvilSpirit -EvilSpirit: @ 0x08086284 - push {r4, lr} - adds r4, r0, #0 - ldr r1, _080862B4 @ =gUnk_08120668 - ldrb r0, [r4, #0xc] - lsls r0, r0, #2 - adds r0, r0, r1 - ldr r1, [r0] - adds r0, r4, #0 - bl _call_via_r1 - adds r1, r4, #0 - adds r1, #0x41 - movs r0, #0 - strb r0, [r1] - adds r0, r4, #0 - adds r0, #0x76 - ldrh r1, [r0] - adds r0, #4 - ldrh r2, [r0] - adds r0, r4, #0 - movs r3, #0 - bl SetAffineInfo - pop {r4, pc} - .align 2, 0 -_080862B4: .4byte gUnk_08120668 - - thumb_func_start sub_080862B8 -sub_080862B8: @ 0x080862B8 - push {r4, r5, lr} - adds r4, r0, #0 - movs r0, #0x63 - bl CheckLocalFlag - cmp r0, #0 - beq _080862CA - bl DeleteThisEntity -_080862CA: - movs r3, #1 - strb r3, [r4, #0xc] - ldr r1, _08086350 @ =gUnk_08120678 - ldrb r0, [r4, #0xa] - lsls r0, r0, #1 - adds r0, r0, r1 - ldrh r0, [r0] - adds r1, r4, #0 - adds r1, #0x7c - strh r0, [r1] - adds r2, r4, #0 - adds r2, #0x76 - strh r0, [r2] - ldrh r0, [r1] - subs r1, #2 - strh r0, [r1] - ldrb r0, [r4, #0xa] - cmp r0, #0 - bne _08086354 - adds r1, #6 - ldr r0, [r4, #0x2c] - str r0, [r1] - adds r1, #4 - ldr r0, [r4, #0x30] - str r0, [r1] - ldrb r1, [r4, #0x19] - movs r0, #0x3f - ands r0, r1 - strb r0, [r4, #0x19] - str r4, [r4, #0x50] - ldrb r0, [r4, #0x10] - movs r1, #0x80 - orrs r0, r1 - strb r0, [r4, #0x10] - adds r1, r4, #0 - adds r1, #0x3c - movs r0, #7 - strb r0, [r1] - adds r0, r4, #0 - adds r0, #0x3f - strb r3, [r0] - subs r1, #1 - movs r0, #4 - strb r0, [r1] - movs r2, #0 -_08086324: - adds r5, r2, #1 - adds r0, r4, #0 - movs r1, #0x18 - adds r2, r5, #0 - movs r3, #0 - bl CreateObjectWithParent - adds r1, r0, #0 - str r1, [r4, #0x54] - cmp r1, #0 - beq _08086346 - ldr r0, [r4, #0x50] - str r0, [r1, #0x50] - ldr r0, [r4, #0x54] - str r4, [r0, #0x54] - ldr r0, [r4, #0x54] - str r0, [r4, #0x50] -_08086346: - adds r2, r5, #0 - cmp r2, #3 - bls _08086324 - b _08086360 - .align 2, 0 -_08086350: .4byte gUnk_08120678 -_08086354: - ldrb r0, [r4, #0x19] - movs r1, #0x3f - ands r1, r0 - movs r0, #0x40 - orrs r1, r0 - strb r1, [r4, #0x19] -_08086360: - ldrb r1, [r4, #0xa] - adds r0, r4, #0 - bl InitializeAnimation - adds r0, r4, #0 - bl sub_08086370 - pop {r4, r5, pc} - - thumb_func_start sub_08086370 -sub_08086370: @ 0x08086370 - push {r4, r5, r6, lr} - adds r6, r0, #0 - ldrb r2, [r6, #0xa] - cmp r2, #0 - beq _08086440 - ldr r0, [r6, #0x54] - adds r0, #0x7f - ldrb r0, [r0] - cmp r0, #0 - bne _080863B6 - adds r1, r6, #0 - adds r1, #0x7c - ldrh r0, [r1] - adds r2, r6, #0 - adds r2, #0x76 - strh r0, [r2] - ldrh r0, [r1] - subs r1, #2 - strh r0, [r1] - movs r0, #0xc0 - lsls r0, r0, #2 - strh r0, [r6, #0x24] - ldr r2, [r6, #0x50] - ldr r0, [r2, #0x2c] - ldr r1, [r6, #0x2c] - subs r0, r0, r1 - ldr r1, [r2, #0x30] - ldr r2, [r6, #0x30] - subs r1, r1, r2 - bl CalculateDirectionFromOffsets - movs r1, #0x80 - eors r0, r1 - strb r0, [r6, #0x15] - b _08086428 -_080863B6: - movs r0, #0xc0 - lsls r0, r0, #3 - strh r0, [r6, #0x24] - ldr r2, _080863E8 @ =gPlayerEntity - ldr r0, [r2, #0x2c] - ldr r1, [r6, #0x2c] - subs r0, r0, r1 - ldr r1, [r2, #0x30] - ldr r2, [r6, #0x30] - subs r1, r1, r2 - bl CalculateDirectionFromOffsets - adds r1, r0, #0 - movs r0, #0x80 - eors r1, r0 - ldrb r2, [r6, #0x15] - cmp r1, r2 - beq _080863F0 - subs r0, r1, r2 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0x80 - bls _080863EC - adds r0, r2, #3 - b _080863EE - .align 2, 0 -_080863E8: .4byte gPlayerEntity -_080863EC: - subs r0, r2, #3 -_080863EE: - strb r0, [r6, #0x15] -_080863F0: - ldr r0, _0808640C @ =gPlayerEntity - ldrb r1, [r0, #0x14] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - bne _08086410 - adds r0, r6, #0 - adds r0, #0x7c - ldrh r0, [r0] - adds r0, #0x40 - adds r1, r6, #0 - adds r1, #0x76 - b _08086426 - .align 2, 0 -_0808640C: .4byte gPlayerEntity -_08086410: - adds r0, r6, #0 - adds r0, #0x7c - ldrh r1, [r0] - subs r1, #0x20 - adds r2, r6, #0 - adds r2, #0x76 - strh r1, [r2] - ldrh r0, [r0] - adds r0, #0x50 - adds r1, r6, #0 - adds r1, #0x7a -_08086426: - strh r0, [r1] -_08086428: - ldr r1, [r6, #0x50] - ldr r0, [r1, #0x2c] - str r0, [r6, #0x2c] - ldr r0, [r1, #0x30] - str r0, [r6, #0x30] - movs r0, #0x24 - ldrsh r1, [r6, r0] - ldrb r2, [r6, #0x15] - adds r0, r6, #0 - bl LinearMoveAngle - b _0808654A -_08086440: - adds r0, r6, #0 - adds r0, #0x41 - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - cmp r0, #0x13 - bne _08086498 - ldrb r0, [r6, #0x15] - adds r0, #1 - strb r0, [r6, #0x15] - ldrb r0, [r6, #0x1d] - subs r0, #1 - strb r0, [r6, #0x1d] - adds r2, r6, #0 - adds r2, #0x7f - movs r0, #1 - strb r0, [r2] - ldr r0, _08086480 @ =gPlayerEntity - ldrb r1, [r0, #0x14] - movs r0, #2 - ands r0, r1 - adds r3, r2, #0 - cmp r0, #0 - bne _08086484 - adds r0, r6, #0 - adds r0, #0x7c - ldrh r0, [r0] - adds r0, #0x10 - adds r1, r6, #0 - adds r1, #0x76 - strh r0, [r1] - b _080864BC - .align 2, 0 -_08086480: .4byte gPlayerEntity -_08086484: - adds r1, r6, #0 - adds r1, #0x7c - ldrh r0, [r1] - subs r0, #0x20 - adds r2, r6, #0 - adds r2, #0x76 - strh r0, [r2] - ldrh r0, [r1] - adds r0, #0x30 - b _080864B6 -_08086498: - ldrb r0, [r6, #0x15] - adds r0, #2 - strb r0, [r6, #0x15] - movs r0, #0xf0 - strb r0, [r6, #0x1d] - adds r3, r6, #0 - adds r3, #0x7f - strb r2, [r3] - adds r1, r6, #0 - adds r1, #0x7c - ldrh r0, [r1] - adds r2, r6, #0 - adds r2, #0x76 - strh r0, [r2] - ldrh r0, [r1] -_080864B6: - subs r1, #2 - strh r0, [r1] - adds r1, r2, #0 -_080864BC: - ldrb r2, [r6, #0x1d] - cmp r2, #0 - bne _080864CA - movs r0, #2 - strb r0, [r6, #0xc] - strb r2, [r3] - b _0808654A -_080864CA: - ldrb r0, [r6, #0x15] - adds r0, #0x40 - lsls r0, r0, #0x18 - cmp r0, #0 - blt _080864E0 - ldrh r2, [r1] - movs r3, #0 - ldrsh r0, [r1, r3] - cmp r0, #0 - ble _080864EE - b _080864EA -_080864E0: - ldrh r2, [r1] - movs r3, #0 - ldrsh r0, [r1, r3] - cmp r0, #0 - bge _080864EE -_080864EA: - rsbs r0, r2, #0 - strh r0, [r1] -_080864EE: - ldr r5, _0808654C @ =gSineTable - ldrb r0, [r6, #0x15] - lsls r0, r0, #1 - adds r0, r0, r5 - movs r1, #0 - ldrsh r0, [r0, r1] - movs r1, #0x80 - lsls r1, r1, #6 - bl FixedMul - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - movs r4, #0x80 - lsls r4, r4, #1 - adds r1, r4, #0 - bl FixedDiv - adds r1, r6, #0 - adds r1, #0x80 - lsls r0, r0, #0x10 - asrs r0, r0, #8 - ldr r1, [r1] - adds r1, r1, r0 - str r1, [r6, #0x2c] - ldrb r0, [r6, #0x15] - adds r0, #0x40 - lsls r0, r0, #1 - adds r0, r0, r5 - movs r3, #0 - ldrsh r0, [r0, r3] - movs r1, #0x80 - lsls r1, r1, #5 - bl FixedMul - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - adds r1, r4, #0 - bl FixedDiv - adds r1, r6, #0 - adds r1, #0x84 - lsls r0, r0, #0x10 - asrs r0, r0, #8 - ldr r1, [r1] - subs r1, r1, r0 - str r1, [r6, #0x30] -_0808654A: - pop {r4, r5, r6, pc} - .align 2, 0 -_0808654C: .4byte gSineTable - - thumb_func_start sub_08086550 -sub_08086550: @ 0x08086550 - push {r4, r5, lr} - adds r4, r0, #0 - adds r0, #0x41 - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - cmp r0, #0x13 - beq _08086566 - movs r0, #3 - strb r0, [r4, #0xc] - b _08086592 -_08086566: - adds r0, r4, #0 - bl sub_0806F3E4 - cmp r0, #0 - beq _08086592 - movs r0, #0x63 - bl SetLocalFlag - movs r0, #0 - bl SetRoomFlag - movs r5, #0 -_0808657E: - ldr r0, [r4, #0x54] - ldr r1, [r0, #0x50] - str r1, [r4, #0x54] - bl DeleteEntity - adds r5, #1 - cmp r5, #3 - bls _0808657E - bl DeleteThisEntity -_08086592: - pop {r4, r5, pc} - - thumb_func_start sub_08086594 -sub_08086594: @ 0x08086594 - push {r4, r5, r6, r7, lr} - adds r7, r0, #0 - adds r0, #0x80 - ldr r0, [r0] - ldr r1, [r7, #0x2c] - subs r0, r0, r1 - adds r1, r7, #0 - adds r1, #0x84 - ldr r1, [r1] - ldr r2, [r7, #0x30] - subs r1, r1, r2 - bl CalculateDirectionFromOffsets - strb r0, [r7, #0x15] - adds r0, r7, #0 - adds r0, #0x41 - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - cmp r0, #0x13 - bne _08086608 - movs r0, #0x80 - lsls r0, r0, #1 - strh r0, [r7, #0x24] - ldrb r0, [r7, #0x1d] - subs r0, #1 - strb r0, [r7, #0x1d] - adds r2, r7, #0 - adds r2, #0x7f - movs r0, #1 - strb r0, [r2] - ldr r0, _080865EC @ =gPlayerEntity - ldrb r1, [r0, #0x14] - movs r0, #2 - ands r0, r1 - cmp r0, #0 - bne _080865F0 - adds r0, r7, #0 - adds r0, #0x7c - ldrh r0, [r0] - adds r0, #0x10 - adds r1, r7, #0 - adds r1, #0x76 - b _0808662A - .align 2, 0 -_080865EC: .4byte gPlayerEntity -_080865F0: - adds r0, r7, #0 - adds r0, #0x7c - ldrh r1, [r0] - subs r1, #0x20 - adds r3, r7, #0 - adds r3, #0x76 - strh r1, [r3] - ldrh r0, [r0] - adds r0, #0x30 - adds r1, r7, #0 - adds r1, #0x7a - b _0808662A -_08086608: - movs r1, #0 - movs r0, #0x80 - lsls r0, r0, #2 - strh r0, [r7, #0x24] - movs r0, #0xf0 - strb r0, [r7, #0x1d] - adds r2, r7, #0 - adds r2, #0x7f - strb r1, [r2] - adds r1, r7, #0 - adds r1, #0x7c - ldrh r0, [r1] - adds r3, r7, #0 - adds r3, #0x76 - strh r0, [r3] - ldrh r0, [r1] - subs r1, #2 -_0808662A: - strh r0, [r1] - ldrb r1, [r7, #0x1d] - cmp r1, #0 - bne _0808663A - movs r0, #2 - strb r0, [r7, #0xc] - strb r1, [r2] - b _080866B8 -_0808663A: - movs r0, #0x24 - ldrsh r1, [r7, r0] - ldrb r2, [r7, #0x15] - adds r0, r7, #0 - bl LinearMoveAngle - ldrb r0, [r7, #0x15] - movs r1, #0x80 - eors r0, r1 - strb r0, [r7, #0x15] - ldr r6, _080866BC @ =gSineTable - ldrb r0, [r7, #0x15] - lsls r0, r0, #1 - adds r0, r0, r6 - movs r1, #0 - ldrsh r0, [r0, r1] - movs r1, #0x80 - lsls r1, r1, #6 - bl FixedMul - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - movs r5, #0x80 - lsls r5, r5, #1 - adds r1, r5, #0 - bl FixedDiv - adds r1, r7, #0 - adds r1, #0x80 - lsls r0, r0, #0x10 - asrs r0, r0, #8 - ldr r4, [r1] - adds r4, r4, r0 - ldrb r0, [r7, #0x15] - adds r0, #0x40 - lsls r0, r0, #1 - adds r0, r0, r6 - movs r1, #0 - ldrsh r0, [r0, r1] - movs r1, #0x80 - lsls r1, r1, #5 - bl FixedMul - lsls r0, r0, #0x10 - asrs r0, r0, #0x10 - adds r1, r5, #0 - bl FixedDiv - adds r1, r7, #0 - adds r1, #0x84 - lsls r0, r0, #0x10 - asrs r0, r0, #8 - ldr r2, [r1] - subs r2, r2, r0 - adds r0, r7, #0 - adds r1, r4, #0 - movs r3, #2 - bl EntityWithinDistance - cmp r0, #0 - beq _080866B8 - movs r0, #1 - strb r0, [r7, #0xc] -_080866B8: - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_080866BC: .4byte gSineTable diff --git a/assets/assets.json b/assets/assets.json index 56e7228f..159dcb76 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -19730,11 +19730,6 @@ "size": 4, "type": "animation" }, - { - "path": "evilSpirit/gUnk_08120678.bin", - "start": 1181304, - "size": 10 - }, { "path": "animations/gSpriteAnimations_EvilSpirit_0.bin", "start": 1181314, @@ -20784,19 +20779,19 @@ "type": "animation" }, { - "path": "animations/gSpriteAnimations_Thunderbold_0.bin", + "path": "animations/gSpriteAnimations_Thunderbolt_0.bin", "start": 1190252, "size": 16, "type": "animation" }, { - "path": "animations/gSpriteAnimations_Thunderbold_1.bin", + "path": "animations/gSpriteAnimations_Thunderbolt_1.bin", "start": 1190268, "size": 12, "type": "animation" }, { - "path": "animations/gSpriteAnimations_Thunderbold_2.bin", + "path": "animations/gSpriteAnimations_Thunderbolt_2.bin", "start": 1190280, "size": 28, "type": "animation" @@ -23908,4 +23903,4 @@ }, "size": 129 } -] \ No newline at end of file +] diff --git a/data/animations/object/thunderbold.s b/data/animations/object/thunderbold.s deleted file mode 100644 index e221b379..00000000 --- a/data/animations/object/thunderbold.s +++ /dev/null @@ -1,20 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gSpriteAnimations_Thunderbold_0:: @ 0812296C - .include "animations/gSpriteAnimations_Thunderbold_0.s" - -gSpriteAnimations_Thunderbold_1:: @ 0812297C - .include "animations/gSpriteAnimations_Thunderbold_1.s" - -gSpriteAnimations_Thunderbold_2:: @ 08122988 - .include "animations/gSpriteAnimations_Thunderbold_2.s" - -gSpriteAnimations_Thunderbold:: @ 081229A4 - .4byte gSpriteAnimations_Thunderbold_0 - .4byte gSpriteAnimations_Thunderbold_1 - .4byte gSpriteAnimations_Thunderbold_2 - .4byte 00000000 diff --git a/data/animations/object/thunderbolt.s b/data/animations/object/thunderbolt.s new file mode 100644 index 00000000..3b84b360 --- /dev/null +++ b/data/animations/object/thunderbolt.s @@ -0,0 +1,20 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + .align 2 + +gSpriteAnimations_Thunderbolt_0:: @ 0812296C + .include "animations/gSpriteAnimations_Thunderbolt_0.s" + +gSpriteAnimations_Thunderbolt_1:: @ 0812297C + .include "animations/gSpriteAnimations_Thunderbolt_1.s" + +gSpriteAnimations_Thunderbolt_2:: @ 08122988 + .include "animations/gSpriteAnimations_Thunderbolt_2.s" + +gSpriteAnimations_Thunderbolt:: @ 081229A4 + .4byte gSpriteAnimations_Thunderbolt_0 + .4byte gSpriteAnimations_Thunderbolt_1 + .4byte gSpriteAnimations_Thunderbolt_2 + .4byte 00000000 diff --git a/data/const/object/evilSpirit.s b/data/const/object/evilSpirit.s deleted file mode 100644 index 81dbaa64..00000000 --- a/data/const/object/evilSpirit.s +++ /dev/null @@ -1,15 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2 - -gUnk_08120668:: @ 08120668 - .4byte sub_080862B8 - .4byte sub_08086370 - .4byte sub_08086550 - .4byte sub_08086594 - -gUnk_08120678:: @ 08120678 - .incbin "evilSpirit/gUnk_08120678.bin" - diff --git a/data/gfx/sprite_ptrs.s b/data/gfx/sprite_ptrs.s index d2ebeb6f..364bf75e 100644 --- a/data/gfx/sprite_ptrs.s +++ b/data/gfx/sprite_ptrs.s @@ -825,7 +825,7 @@ gSpritePtrs:: @ 080029B4 .4byte 00000000 .4byte 00000000 - .4byte gSpriteAnimations_Thunderbold + .4byte gSpriteAnimations_Thunderbolt .4byte 00000000 .4byte 00000000 .4byte 00000000 diff --git a/data/scripts/castorWilds/script_CastorWildsStatueLeft.inc b/data/scripts/castorWilds/script_CastorWildsStatueLeft.inc index 874dff2a..1439e7fe 100644 --- a/data/scripts/castorWilds/script_CastorWildsStatueLeft.inc +++ b/data/scripts/castorWilds/script_CastorWildsStatueLeft.inc @@ -8,7 +8,7 @@ SCRIPT_START script_CastorWildsStatueLeft EndBlock script_0800B268: _0807EA4C - _0807E9F0 + UpdateFusion SetPlayerIdle CheckKinstoneFused KINSTONE_CASTOR_WILDS_STATUE_LEFT JumpIf script_0800B2E2 diff --git a/data/scripts/castorWilds/script_CastorWildsStatueMiddle.inc b/data/scripts/castorWilds/script_CastorWildsStatueMiddle.inc index 7abd69e1..4541edf9 100644 --- a/data/scripts/castorWilds/script_CastorWildsStatueMiddle.inc +++ b/data/scripts/castorWilds/script_CastorWildsStatueMiddle.inc @@ -8,7 +8,7 @@ SCRIPT_START script_CastorWildsStatueMiddle EndBlock script_0800B298: _0807EA4C - _0807E9F0 + UpdateFusion SetPlayerIdle CheckKinstoneFused KINSTONE_CASTOR_WILDS_STATUE_MIDDLE JumpIf script_0800B2E2 diff --git a/data/scripts/castorWilds/script_CastorWildsStatueRight.inc b/data/scripts/castorWilds/script_CastorWildsStatueRight.inc index c4549d85..8beacfa7 100644 --- a/data/scripts/castorWilds/script_CastorWildsStatueRight.inc +++ b/data/scripts/castorWilds/script_CastorWildsStatueRight.inc @@ -8,7 +8,7 @@ SCRIPT_START script_CastorWildsStatueRight EndBlock script_0800B2C8: _0807EA4C - _0807E9F0 + UpdateFusion SetPlayerIdle CheckKinstoneFused KINSTONE_CASTOR_WILDS_STATUE_RIGHT JumpIf script_0800B2E2 diff --git a/data/scripts/castorWilds/script_GreatFairyRupees.inc b/data/scripts/castorWilds/script_GreatFairyRupees.inc index b9374fa2..908c2fcd 100644 --- a/data/scripts/castorWilds/script_GreatFairyRupees.inc +++ b/data/scripts/castorWilds/script_GreatFairyRupees.inc @@ -15,6 +15,7 @@ script_0800B6D4: WaitForSyncFlagAndClear 0x00000004 SetRoomFlag 0x0000 WaitForSyncFlagAndClear 0x00000004 + //30 CheckLocalFlag 0x009f JumpIf script_0800B7A2 MessageNoOverlap TEXT_ITEM_GET, 0x7b @@ -22,7 +23,7 @@ script_0800B6D4: CallWithArg CheckMessageEqual, TEXT_ITEM_GET << 8 | 0x7d JumpIf script_0800B6A6 WaitUntilTextboxCloses - SetLocalFlag 0x009f + SetLocalFlag IZUMI_01_FAIRY GivePlayerItem ITEM_WALLET Jump script_0800B698 .2byte 0x0000 diff --git a/data/scripts/cloudTops/script_GregalHealthy.inc b/data/scripts/cloudTops/script_GregalHealthy.inc index 10e0f160..e82f4888 100644 --- a/data/scripts/cloudTops/script_GregalHealthy.inc +++ b/data/scripts/cloudTops/script_GregalHealthy.inc @@ -17,9 +17,9 @@ script_08014C4C: script_08014C56: Call sub_0806CCB4 JumpIfNot script_08014C56 - CheckLocalFlag 0x0066 + CheckLocalFlag SORA_ELDER_TALK2ND JumpIf script_08014C7C - SetLocalFlag 0x0066 + SetLocalFlag SORA_ELDER_TALK2ND MessageNoOverlap TEXT_WIND_TRIBE, 0x0d WaitUntilTextboxCloses GivePlayerItem ITEM_LIGHT_ARROW diff --git a/data/scripts/cloudTops/script_GregalSick.inc b/data/scripts/cloudTops/script_GregalSick.inc index 1466280d..2d0a85d1 100644 --- a/data/scripts/cloudTops/script_GregalSick.inc +++ b/data/scripts/cloudTops/script_GregalSick.inc @@ -4,7 +4,7 @@ SCRIPT_START script_GregalSick DoPostScriptAction 0x000a SetAnimation 0x0000 EndBlock - CheckLocalFlag 0x0063 + CheckLocalFlag SORA_ELDER_RECOVER JumpIf script_08014BE8 script_08014B48: EndBlock @@ -54,9 +54,9 @@ script_08014BF2: CheckEntityInteractType JumpIfNot script_08014BF2 SetPlayerIdle - CheckLocalFlag 0x0065 + CheckLocalFlag SORA_ELDER_TALK1ST JumpIf script_08014C1C - SetLocalFlag 0x0065 + SetLocalFlag SORA_ELDER_TALK1ST MessageNoOverlap TEXT_WIND_TRIBE, 0x07 WaitUntilTextboxCloses SetIntVariable 100 diff --git a/data/scripts/cloudTops/script_Npc4EFirstCloud.inc b/data/scripts/cloudTops/script_Npc4EFirstCloud.inc index 6cc75af2..dd31993b 100644 --- a/data/scripts/cloudTops/script_Npc4EFirstCloud.inc +++ b/data/scripts/cloudTops/script_Npc4EFirstCloud.inc @@ -12,7 +12,7 @@ SCRIPT_START script_Npc4EFirstCloud EndBlock script_0800D636: _0807EA4C - _0807E9F0 + UpdateFusion Call NPC4E_IsKinstoneFused JumpIf script_0800D650 Call EnablePauseMenu diff --git a/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc b/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc index ebabde5d..812f5e39 100644 --- a/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc +++ b/data/scripts/cutscene/introAssembly/script_PlayerGetSword.inc @@ -3,7 +3,7 @@ SCRIPT_START script_PlayerGetSword SetInventoryValue ITEM_SMITH_SWORD, 0x0001 CallWithArg PutItemAnySlot, ITEM_SMITH_SWORD PlaySound SFX_ITEM_GET - CallWithArg SetPlayerAnimation2, 0x0000045f + CallWithArg SetPlayerAnimation2, ANIM_GET_ITEM_SWORD Call WaitForPlayerAnim MessageFromTargetPos TEXT_ITEM_GET, 0x01, 0x000e WaitUntilTextboxCloses diff --git a/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc b/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc index 85ba5972..a1249100 100644 --- a/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc +++ b/data/scripts/cutscene/outro/script_PlayerGetGreenCap.inc @@ -2,7 +2,7 @@ SCRIPT_START script_PlayerGetGreenCap BeginBlock Call sub_08094BE0 - CallWithArg SetPlayerAnimation2, 0x0000045b + CallWithArg SetPlayerAnimation2, ANIM_GET_ITEM_BIG_NOCAP PlaySound SFX_ITEM_GET EndBlock Call WaitForPlayerAnim @@ -10,7 +10,7 @@ SCRIPT_START script_PlayerGetGreenCap SetSyncFlag 0x00000008 BeginBlock CallWithArg ResetPlayerFlag, PL_NO_CAP - CallWithArg SetPlayerAnimation2, 0x000008e4 + CallWithArg SetPlayerAnimation2, ANIM_GET_NEWCAP EndBlock Call WaitForPlayerAnim SetAnimationState 0x0004 diff --git a/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc b/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc index 2249aaad..2a585822 100644 --- a/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc +++ b/data/scripts/cutscene/takeover/script_PlayerAtTakeover.inc @@ -7,11 +7,11 @@ SCRIPT_START script_PlayerAtTakeover MoveTo 0x0168, 0x0058 SetAnimationState 0x0004 DoPostScriptAction 0x0000 - CallWithArg SetPlayerAnimation2, 0x000003c5 + CallWithArg SetPlayerAnimation2, ANIM_EZLO_SEARCH Call WaitForPlayerAnim MessageFromTargetPos TEXT_VAATI, 0x18, 0x000c WaitUntilTextboxCloses - CallWithArg SetPlayerAnimation2, 0x000003c9 + CallWithArg SetPlayerAnimation2, ANIM_EZLO_LEAVE_LEFT Call WaitForPlayerAnim SetAnimationState 0x0004 DoPostScriptAction 0x0000 diff --git a/data/scripts/dhc/script_KingDaltusStone.inc b/data/scripts/dhc/script_KingDaltusStone.inc index 0cc87638..bc7550b9 100644 --- a/data/scripts/dhc/script_KingDaltusStone.inc +++ b/data/scripts/dhc/script_KingDaltusStone.inc @@ -3,9 +3,9 @@ SCRIPT_START script_KingDaltusStone BeginBlock SetAnimationState 0x0004 DoPostScriptAction 0x000a - CheckLocalFlag 0x0071 + CheckLocalFlag LV6_1d_KEYGET JumpIf script_0800E3E8 - CheckLocalFlag 0x0096 + CheckLocalFlag LV6_39_KING JumpIf script_0800E3BE SetAnimation 0x000c CallWithArg sub_0807F8E8, 0x00000000 @@ -28,7 +28,7 @@ script_0800E37A: Wait 0x001e DoPostScriptAction 0x0000 FacePlayer - SetLocalFlag 0x0096 + SetLocalFlag LV6_39_KING script_0800E3BE: DoPostScriptAction 0x0000 _0807E9D4 @@ -44,7 +44,7 @@ script_0800E3C8: Wait 0x000f GivePlayerItem ITEM_SMALL_KEY WaitPlayerGetItem - SetLocalFlag 0x0071 + SetLocalFlag LV6_1d_KEYGET EnablePlayerControl script_0800E3E8: _0807E9D4 diff --git a/data/scripts/dhc/script_PlayerStonesFall.inc b/data/scripts/dhc/script_PlayerStonesFall.inc index b2a41dd6..adafc6cd 100644 --- a/data/scripts/dhc/script_PlayerStonesFall.inc +++ b/data/scripts/dhc/script_PlayerStonesFall.inc @@ -3,7 +3,7 @@ SCRIPT_START script_PlayerStonesFall EndBlock SetAnimationState 0x0004 DoPostScriptAction 0x0000 - CallWithArg SetPlayerAnimation2, 0x000003c5 + CallWithArg SetPlayerAnimation2, ANIM_EZLO_SEARCH Call WaitForPlayerAnim SetSyncFlag 0x00000004 Call SetPlayerActionNormal diff --git a/data/scripts/graveyard/script_GreatFairyArrows.inc b/data/scripts/graveyard/script_GreatFairyArrows.inc index 1e95b4fd..f08ea598 100644 --- a/data/scripts/graveyard/script_GreatFairyArrows.inc +++ b/data/scripts/graveyard/script_GreatFairyArrows.inc @@ -31,7 +31,7 @@ script_0800B684: Jump script_0800B6A6 script_0800B68E: WaitUntilTextboxCloses - SetLocalFlag 0x009e + SetLocalFlag IZUMI_00_FAIRY GivePlayerItem ITEM_LARGE_QUIVER script_0800B698: WaitPlayerGetItem diff --git a/data/scripts/hyruleTown/script_Carlov.inc b/data/scripts/hyruleTown/script_Carlov.inc index d30f346f..d0bbe0bc 100644 --- a/data/scripts/hyruleTown/script_Carlov.inc +++ b/data/scripts/hyruleTown/script_Carlov.inc @@ -1,4 +1,4 @@ -@ Hyrule Town Carlov +@ Hyrule Town ~~Carlov~~ Burlov SCRIPT_START script_Carlov BeginBlock _0807E9D4 diff --git a/data/scripts/hyruleTown/script_Carlov2.inc b/data/scripts/hyruleTown/script_Carlov2.inc index de16ca9f..d1b49cc9 100644 --- a/data/scripts/hyruleTown/script_Carlov2.inc +++ b/data/scripts/hyruleTown/script_Carlov2.inc @@ -47,7 +47,7 @@ script_080146E2: JumpIf script_0801472E CheckLocalFlag 0x005f JumpIf script_08014720 - Call sub_08088574 + Call FigurineDevice_TryAgainMessage SetRoomFlag 0x000a Jump script_0801473C script_0801472E_2: @@ -104,7 +104,7 @@ script_080146C6: JumpIf script_0801472E CheckLocalFlag 0x005f JumpIf script_08014720 - Call sub_08088574 + Call FigurineDevice_TryAgainMessage SetRoomFlag 0x0009 Jump script_0801473C .endif @@ -135,7 +135,7 @@ script_08014720: .else SetRoomFlag 0x0009 .endif - Call sub_08088504 + Call FigurineDevice_NothingNewToDrawMessage Jump script_0801473C script_0801472E: .ifdef EU @@ -144,7 +144,7 @@ script_0801472E: SetRoomFlag 0x0009 .endif ClearRoomFlag 0x0006 - Call sub_08088544 + Call FigurineDevice_NewFigurinesMessage script_0801473C: CheckTextboxResult JumpIfNot script_08014770 @@ -179,9 +179,9 @@ script_0801477A: CheckRoomFlag 0x0007 JumpIf script_080147A4 script_0801478A: - Call sub_08088478 + Call FigurineDevice_NoFigurinesLeftMessage WaitUntilTextboxCloses - Call sub_080885B0 + Call FigurineDevice_LostOrFinishedMessage WaitPlayerGetItem SetSyncFlag 0x00000008 Jump script_080147CE diff --git a/data/scripts/hyruleTown/script_Librari.inc b/data/scripts/hyruleTown/script_Librari.inc index 2dedaf31..5bd9c952 100644 --- a/data/scripts/hyruleTown/script_Librari.inc +++ b/data/scripts/hyruleTown/script_Librari.inc @@ -28,12 +28,12 @@ script_0800E974: SetAnimation 0x0000 StartPlayerScript script_PlayerActivatedTrapCard WaitForSyncFlagAndClear 0x00000001 - SetLocalFlag 0x0074 + SetLocalFlag MIZUKAKI_STAIR PlaySound SFX_SECRET Wait 0x00f0 MessageFromTarget TEXT_TOWN_MINISH1, 0x26 WaitUntilTextboxCloses - SetLocalFlag 0x0075 + SetLocalFlag MIZUKAKI_STAIR_WARP_OK script_0800E9E4: WaitUntilTextboxCloses Wait 0x000f diff --git a/data/scripts/hyruleTown/script_LibrariLater.inc b/data/scripts/hyruleTown/script_LibrariLater.inc index 1363035f..11a781b9 100644 --- a/data/scripts/hyruleTown/script_LibrariLater.inc +++ b/data/scripts/hyruleTown/script_LibrariLater.inc @@ -1,4 +1,4 @@ -@ Library if you talk to him later? +@ Librari at the lake SCRIPT_START script_LibrariLater BeginBlock DoPostScriptAction 0x000a @@ -14,9 +14,9 @@ script_08012440: SetAnimation 0x0009 Call sub_0806B2B4 WaitUntilTextboxCloses - CheckLocalFlag 0x00b3 + CheckLocalFlag KHOUSE23_TALK1ST JumpIf script_08012474 - SetLocalFlag 0x00b3 + SetLocalFlag KHOUSE23_TALK1ST GivePlayerItem ITEM_HEART_CONTAINER WaitPlayerGetItem .ifdef USA diff --git a/data/scripts/hyruleTown/script_Rem.inc b/data/scripts/hyruleTown/script_Rem.inc index a7384e2a..56f3d368 100644 --- a/data/scripts/hyruleTown/script_Rem.inc +++ b/data/scripts/hyruleTown/script_Rem.inc @@ -6,7 +6,7 @@ SCRIPT_START script_Rem SetAnimation 0x0002 CheckInventory1 ITEM_PEGASUS_BOOTS JumpIf script_080130B6 - CheckLocalFlag 0x0060 + CheckLocalFlag SHOP02_KUTSU_00 JumpIf script_08012FD2 CheckGlobalFlag DASHBOOTS JumpIf script_RemFallingAsleep diff --git a/data/scripts/hyruleTown/script_RemFallingAsleep.inc b/data/scripts/hyruleTown/script_RemFallingAsleep.inc index 08b5211f..26816dbc 100644 --- a/data/scripts/hyruleTown/script_RemFallingAsleep.inc +++ b/data/scripts/hyruleTown/script_RemFallingAsleep.inc @@ -84,7 +84,7 @@ script_0801309E: SetAction 0x0001 Jump script_0801308A script_080130B6: - CheckLocalFlag 0x0062 + CheckLocalFlag NPC37_REM_SLEEP JumpIfNot script_080130C4 Call sub_0806A9B0 script_080130C4: diff --git a/data/scripts/lonLonRanch/script_GoronPunching.inc b/data/scripts/lonLonRanch/script_GoronPunching.inc index 992ee9eb..d38d47cd 100644 --- a/data/scripts/lonLonRanch/script_GoronPunching.inc +++ b/data/scripts/lonLonRanch/script_GoronPunching.inc @@ -23,7 +23,7 @@ script_0800B9F4: FacePlayer DoPostScriptAction 0x0000 Call sub_0807F650 - _0807E9F0 + UpdateFusion SetPlayerIdle Call sub_0806948C JumpIf script_0800BA24 diff --git a/data/scripts/minishWoods/script_BombMinish.inc b/data/scripts/minishWoods/script_BombMinish.inc index 5f2b461a..8375de4a 100644 --- a/data/scripts/minishWoods/script_BombMinish.inc +++ b/data/scripts/minishWoods/script_BombMinish.inc @@ -55,7 +55,7 @@ script_08009FB6: Jump script_08009F86 script_08009FD2: EndBlock - CheckLocalFlag 0x00b0 + CheckLocalFlag KHOUSE26_REMOCON JumpIf script_0800A024 script_08009FDC: EndBlock diff --git a/data/scripts/mtCrenel/script_CutsceneMiscObjectBrokenSword.inc b/data/scripts/mtCrenel/script_CutsceneMiscObjectBrokenSword.inc index 89efa304..de8d6243 100644 --- a/data/scripts/mtCrenel/script_CutsceneMiscObjectBrokenSword.inc +++ b/data/scripts/mtCrenel/script_CutsceneMiscObjectBrokenSword.inc @@ -3,7 +3,7 @@ SCRIPT_START script_CutsceneMiscObjectBrokenSword BeginBlock CheckInventory1 ITEM_FIRE_ELEMENT JumpIf script_0800D24C - CheckLocalFlag 0x007e + CheckLocalFlag OYAKATA_DEMO JumpIf script_0800D242 DoPostScriptAction 0x0008 EndBlock diff --git a/data/scripts/mtCrenel/script_GreatFairyBombs.inc b/data/scripts/mtCrenel/script_GreatFairyBombs.inc index 311d82d7..9f44c339 100644 --- a/data/scripts/mtCrenel/script_GreatFairyBombs.inc +++ b/data/scripts/mtCrenel/script_GreatFairyBombs.inc @@ -24,7 +24,7 @@ script_0800B734: Jump script_0800B6A6 script_0800B794: WaitUntilTextboxCloses - SetLocalFlag 0x00a0 + SetLocalFlag IZUMI_02_FAIRY GivePlayerItem ITEM_BOMBBAG Jump script_0800B698 script_0800B7A2: diff --git a/data/scripts/mtCrenel/script_Melari.inc b/data/scripts/mtCrenel/script_Melari.inc index 74632ed9..5cd27f46 100644 --- a/data/scripts/mtCrenel/script_Melari.inc +++ b/data/scripts/mtCrenel/script_Melari.inc @@ -8,7 +8,7 @@ SCRIPT_START script_Melari EndBlock CheckInventory1 ITEM_FIRE_ELEMENT JumpIf script_0800CFD2 - CheckLocalFlag 0x007e + CheckLocalFlag OYAKATA_DEMO JumpIfNot script_0800CFD2 SetAnimation 0x0008 script_0800CFD2: @@ -19,7 +19,7 @@ script_0800CFD2: SetSyncFlag 0x00000020 Jump script_0800CFFA script_0800CFEC: - CheckLocalFlag 0x007e + CheckLocalFlag OYAKATA_DEMO JumpIfNot script_0800CFFA SetSyncFlag 0x00000010 script_0800CFFA: @@ -60,7 +60,7 @@ script_0800D032: MessageFromTargetPos TEXT_MINISH2, 0x5d, 0x0002 Jump script_0800D17C script_0800D098: - CheckLocalFlag 0x007e + CheckLocalFlag OYAKATA_DEMO JumpIfNot script_0800D0A8 MessageFromTarget TEXT_MINISH2, 0x3e Jump script_0800D17C @@ -88,7 +88,7 @@ script_0800D108: JumpIf script_0800D108 PlaySound SFX_F8 SetSyncFlag 0x00000010 - SetLocalFlag 0x007e + SetLocalFlag OYAKATA_DEMO MessageFromTargetPos TEXT_MINISH2, 0x3e, 0x0002 WaitUntilTextboxCloses Wait 0x000f diff --git a/data/scripts/mtCrenel/script_MountainMinish3.inc b/data/scripts/mtCrenel/script_MountainMinish3.inc index a1d0f57c..08d59543 100644 --- a/data/scripts/mtCrenel/script_MountainMinish3.inc +++ b/data/scripts/mtCrenel/script_MountainMinish3.inc @@ -7,7 +7,7 @@ SCRIPT_START script_MountainMinish3 script_0800D282: CheckInventory1 ITEM_FIRE_ELEMENT JumpIf script_0800D292 - CheckLocalFlag 0x007e + CheckLocalFlag OYAKATA_DEMO JumpIf script_0800D2EA script_0800D292: BeginBlock diff --git a/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc b/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc index 2989fde6..3054711b 100644 --- a/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc +++ b/data/scripts/mtCrenel/script_PlayerGetWhiteSword.inc @@ -3,7 +3,7 @@ SCRIPT_START script_PlayerGetWhiteSword SetInventoryValue ITEM_GREEN_SWORD, 0x0001 CallWithArg PutItemAnySlot, ITEM_GREEN_SWORD PlaySound SFX_ITEM_GET - CallWithArg SetPlayerAnimation2, 0x000001e2 + CallWithArg SetPlayerAnimation2, ANIM_GET_WHITE_SWORD Call WaitForPlayerAnim MessageNoOverlap TEXT_ITEM_GET, 0x02 WaitUntilTextboxCloses diff --git a/data/scripts/npc/script_Farmer.inc b/data/scripts/npc/script_Farmer.inc index 11f0566f..d59dad99 100644 --- a/data/scripts/npc/script_Farmer.inc +++ b/data/scripts/npc/script_Farmer.inc @@ -28,7 +28,7 @@ script_0800B134: FacePlayer CallWithArg sub_0806BC94, 0x00000004 Call sub_0807F650 - _0807E9F0 + UpdateFusion .ifndef EU @! @bug: In EU, Eenie is marked as done fusing if kinstone menu is closed without fusing JumpIfNot script_0800B160 diff --git a/data/scripts/npc/script_MysteriousWall.inc b/data/scripts/npc/script_MysteriousWall.inc index 28ab2c5e..8d10f21d 100644 --- a/data/scripts/npc/script_MysteriousWall.inc +++ b/data/scripts/npc/script_MysteriousWall.inc @@ -10,7 +10,7 @@ SCRIPT_START script_MysteriousWall EndBlock script_0800B98A: _0807EA4C - _0807E9F0 + UpdateFusion JumpIf script_0800B99E Call EnablePauseMenu EnablePlayerControl diff --git a/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc b/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc index 7ef157da..43f188e8 100644 --- a/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc +++ b/data/scripts/sanctuary/script_PlayerPickUpFinalSword.inc @@ -2,7 +2,7 @@ SCRIPT_START script_PlayerPickUpFinalSword CallWithArg sub_08095E7C, script_CutsceneMiscObjectSwordCharge11 PlaySound SFX_1D3 - CallWithArg SetPlayerAnimation2, 0x000008e3 + CallWithArg SetPlayerAnimation2, ANIM_GET_LAST_SWORD Call sub_08096028 Wait 0x0078 SetSyncFlag 0x00020000 diff --git a/data/scripts/sanctuary/script_PlayerPickUpSword.inc b/data/scripts/sanctuary/script_PlayerPickUpSword.inc index c873fa4e..fff8a063 100644 --- a/data/scripts/sanctuary/script_PlayerPickUpSword.inc +++ b/data/scripts/sanctuary/script_PlayerPickUpSword.inc @@ -1,7 +1,7 @@ @ Player at Sanctuary pick up sword SCRIPT_START script_PlayerPickUpSword PlaySound SFX_1D3 - CallWithArg SetPlayerAnimation2, 0x000008bf + CallWithArg SetPlayerAnimation2, ANIM_GET_NEW_SWORD Call sub_08096028 Wait 0x003c SetSyncFlag 0x00020000 diff --git a/data/scripts/unused/script_08016482.inc b/data/scripts/unused/script_08016482.inc index 8692711c..e315c61a 100644 --- a/data/scripts/unused/script_08016482.inc +++ b/data/scripts/unused/script_08016482.inc @@ -14,7 +14,7 @@ SCRIPT_START script_08016482 DisablePlayerControl SetPlayerAction 0x00005408 StartPlayerScript script_08016384 - SetPlayerAnimation 0x03a0 + SetPlayerAnimation ANIM_FALL_ON_BACK _0807E8E4_0 _0807E8E4_1 _0807E8E4_2 diff --git a/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc b/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc index 0c4a11a3..b176121d 100644 --- a/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc +++ b/data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc @@ -10,7 +10,7 @@ SCRIPT_START script_NPC4ESourceOfTheFlow EndBlock script_08015FE4: _0807EA4C - _0807E9F0 + UpdateFusion SetPlayerIdle CheckKinstoneFused KINSTONE_SOURCE_FLOW JumpIf script_08015FFE diff --git a/data/scripts/westernWood/script_MoblinLady.inc b/data/scripts/westernWood/script_MoblinLady.inc index 14b466f9..551be084 100644 --- a/data/scripts/westernWood/script_MoblinLady.inc +++ b/data/scripts/westernWood/script_MoblinLady.inc @@ -12,9 +12,9 @@ script_08012338: SetPlayerIdle MessageFromTarget TEXT_PERCY, 0x04 WaitUntilTextboxCloses - CheckLocalFlag 0x0042 + CheckLocalFlag MHOUSE08_03 JumpIf script_0801235A - SetLocalFlag 0x0042 + SetLocalFlag MHOUSE08_03 GivePlayerItem ITEM_RUPEE50 WaitPlayerGetItem script_0801235A: diff --git a/include/area.h b/include/area.h index 96b08ed3..a79949bc 100644 --- a/include/area.h +++ b/include/area.h @@ -7,6 +7,16 @@ #define MAX_ROOMS 64 +typedef enum { + PT_TREESTUMP, + PT_ROCK, + PT_2, + PT_DUNGEON, + PT_JAR, + PT_5, + PT_TOD, +} PortalTypes; + typedef struct { u16 pixel_width; u16 pixel_height; diff --git a/include/asm.h b/include/asm.h index 7208b375..5c9ce19b 100644 --- a/include/asm.h +++ b/include/asm.h @@ -20,7 +20,7 @@ extern void sub_08001290(struct Entity_*, u32); extern void GenericKnockback(struct Entity_*); extern u32 GetFuserId(struct Entity_*); extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); -extern u32 GravityUpdate(struct Entity_*, u32); +extern u32 GravityUpdate(struct Entity_* entity, u32 gravity); extern u32 CheckOnScreen(struct Entity_*); extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32); extern void UpdateAnimationVariableFrames(struct Entity_*, u32); diff --git a/include/common.h b/include/common.h index ea3a1e39..80b83839 100644 --- a/include/common.h +++ b/include/common.h @@ -120,8 +120,8 @@ void sub_0801E1EC(u32, u32, u32); void sub_0801DD58(u32, u32); void sub_0801E1B8(u32, u32); void AddKinstoneToBag(u32); -void sub_0801DFB4(struct Entity_*, u32, u32, u32); -u32 sub_0801E00C(void); +void InitializeFuseInfo(struct Entity_* entity, u32 textIndex, u32 cancelledTextIndex, u32 fusingTextIndex); +u32 PerformFuseAction(void); bool32 CheckFusionMapMarkerDisabled(u32); u32 sub_0801DB94(void); u32 GetRandomSharedFusion(u8*); diff --git a/include/enemy.h b/include/enemy.h index 8142c344..ba1b828b 100644 --- a/include/enemy.h +++ b/include/enemy.h @@ -13,6 +13,14 @@ #include "projectile.h" bool32 EnemyInit(Entity* this); +/** + * 0: _OnTick + * 1: _OnCollision + * 2: _OnKnockback + * 3: _OnDeath + * 4: _OnConfused + * 5: _OnGrabbed + */ u32 GetNextFunction(Entity*); void EnemyFunctionHandler(Entity*, EntityActionArray); void EnemyFunctionHandlerAfterCollision(Entity*, void (*const[])()); diff --git a/include/enemy/octorokBoss.h b/include/enemy/octorokBoss.h index d57c8665..afa140e2 100644 --- a/include/enemy/octorokBoss.h +++ b/include/enemy/octorokBoss.h @@ -20,7 +20,7 @@ typedef struct { static_assert(sizeof(OctorokBossHeap) == 0x30); struct OctorokBossEntity { - Entity base; + /*0x00*/ Entity base; /*0x68*/ union SplitHWord field_0x68; /*0x6a*/ union SplitHWord field_0x6a; /*0x6c*/ union SplitHWord field_0x6c; diff --git a/include/functions.h b/include/functions.h index e9647997..6553a8f8 100644 --- a/include/functions.h +++ b/include/functions.h @@ -91,7 +91,6 @@ extern void sub_0805EC60(Entity*); extern void InitPlayerMacro(PlayerMacroEntry*); extern u32* sub_0805F25C(u32); extern void sub_0805F8E4(u32 r0, WStruct* r1); -extern void sub_08060158(Entity*); extern void sub_0806D0B0(Entity*); extern bool32 sub_080806BC(u32, u32, u32, u32); extern void sub_0808091C(const ScreenTransitionData* screenTransition, u32 transitionType); diff --git a/include/global.h b/include/global.h index fbed1b4f..72df6769 100644 --- a/include/global.h +++ b/include/global.h @@ -143,4 +143,11 @@ union SplitHWord { /* forward decls */ struct Entity_; +/** + * bitset macros + */ + +#define BIT(bit) (1 << (bit)) +#define IS_BIT_SET(value, bit) ((value)&BIT(bit)) + #endif // GLOBAL_H diff --git a/include/item.h b/include/item.h index 20087141..ec20160d 100644 --- a/include/item.h +++ b/include/item.h @@ -6,7 +6,6 @@ #include "player.h" void CreateItemEntity(u32, u32, u32); -void sub_08081404(Entity*, u32); extern void ExecuteItemFunction(ItemBehavior* this, u32 index); extern void ItemDebug(ItemBehavior*, u32); diff --git a/include/kinstone.h b/include/kinstone.h index d99950d7..1159aedc 100644 --- a/include/kinstone.h +++ b/include/kinstone.h @@ -6,17 +6,27 @@ extern void sub_08018C58(u32); +typedef enum { + FUSION_STATE_0, // fusion was not yet started + FUSION_STATE_1, // failed? + FUSION_STATE_2, // successful? + FUSION_STATE_3, // fusion is being performed + FUSION_STATE_4, // player has closed the first messagebox + FUSION_STATE_5, // fusion declined by the player + FUSION_STATE_6, // Successful, but not yet finished? +} FusionState; + typedef struct { - u8 _0; + u8 fusionState; /** @see FusionState */ u8 action; u8 _2; u8 kinstoneId; u8 prevUpdatePriority; u8 _5; u16 textIndex; - u16 _8; - u16 _a; - Entity* ent; + u16 cancelledTextIndex; + u16 fusingTextIndex; + Entity* entity; } FuseInfo; static_assert(sizeof(FuseInfo) == 0x10); extern FuseInfo gFuseInfo; diff --git a/include/npc.h b/include/npc.h index 6b9e5cb5..525cc5d1 100644 --- a/include/npc.h +++ b/include/npc.h @@ -73,7 +73,7 @@ s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y); void sub_0806EE04(Entity* ent, void* a2, u32 a3); u32 sub_0806EE20(Entity* ent); s32 sub_0806F078(Entity* ent, s32 a2); -void sub_0806F118(Entity* ent); +void InitializeNPCFusion(Entity* ent); void MarkFuserDone(Entity* ent); void ShowNPCDialogue(Entity* ent, const Dialog* dia); @@ -85,7 +85,6 @@ void CollideFollowers(void); // TODO move? void AddInteractableWhenBigFuser(Entity* ent, u32 kinstoneId); -u32 sub_0806F5A4(u32); u32 GetFusionToOffer(Entity*); void AddInteractableWhenBigObject(Entity*); void sub_0807000C(Entity*); @@ -222,23 +221,23 @@ enum NPC { /*0x7f*/ NPC_NONE_39, }; -void Gentari(Entity*); +void Gentari(); void Gentari_Fusion(Entity*); -void Festari(Entity*); -void Festari_Fusion(Entity*); -void ForestMinish(Entity*); +void Festari(); +void Festari_Fusion(); +void ForestMinish(); void ForestMinish_Head(Entity*); void ForestMinish_Fusion(Entity*); -void Postman(Entity*); +void Postman(); void Postman_Fusion(Entity*); -void NPC5(Entity*); +void NPC5(); void Townsperson(Entity*); void Townsperson_Head(Entity*); void Townsperson_Fusion(Entity*); -void Kid(Entity*); +void Kid(); void Kid_Head(Entity*); void Kid_Fusion(Entity*); -void Guard(Entity*); +void Guard(); void Guard_Head(Entity*); void NPC9(Entity*); void Stamp(Entity*); @@ -246,90 +245,90 @@ void Maid(Entity*); void Maid_Head(Entity*); void Marcy(Entity*); void Wheaton(Entity*); -void Pita(Entity*); +void Pita(); void MinishEzlo(Entity*); void MinishEzlo_Head(Entity*); void Mailbox(Entity*); void Beedle(Entity*); void Beedle_Head(Entity*); -void Brocco(Entity*); +void Brocco(); void Brocco_Fusion(Entity*); -void SittingPerson(Entity*); +void SittingPerson(); void SittingPerson_Head(Entity*); void SittingPerson_Fusion(Entity*); -void Pina(Entity*); +void Pina(); void Pina_Fusion(Entity*); -void Din(Entity*); +void Din(); void Din_Fusion(Entity*); -void Nayru(Entity*); +void Nayru(); void Nayru_Fusion(Entity*); -void Farore(Entity*); +void Farore(); void Farore_Fusion(Entity*); -void Sturgeon(Entity*); +void Sturgeon(); void Sturgeon_Head(Entity*); void Sturgeon_Fusion(Entity*); void TingleSiblings(Entity*); void TingleSiblings_Fusion(Entity*); -void Stockwell(Entity*); -void Talon(Entity*); +void Stockwell(); +void Talon(); void Talon_Head(Entity*); void Talon_Fusion(Entity*); -void Malon(Entity*); +void Malon(); void Malon_Fusion(Entity*); -void Epona(Entity*); -void Epona_Fusion(Entity*); +void Epona(); +void Epona_Fusion(); void MilkCart(Entity*); -void GhostBrothers(Entity*); +void GhostBrothers(); void GhostBrothers_Fusion(Entity*); -void Smith(Entity*); +void Smith(); void Smith_Head(Entity*); void Smith_Fusion(Entity*); -void NPC23(Entity*); -void KingDaltus(Entity*); +void NPC23(); +void KingDaltus(); void KingDaltus_Fusion(Entity*); -void MinisterPotho(Entity*); +void MinisterPotho(); void MinisterPotho_Fusion(Entity*); void NPC26(Entity*); void Vaati(Entity*); void Zelda(Entity*); -void Mutoh(Entity*); +void Mutoh(); void Mutoh_Head(Entity*); void Mutoh_Fusion(Entity*); -void Carpenter(Entity*); +void Carpenter(); void Carpenter_Head(Entity*); void Carpenter_Fusion(Entity*); -void CastorWildsStatue(Entity*); +void CastorWildsStatue(); void CastorWildsStatue_Fusion(Entity*); -void Cat(Entity*); +void Cat(); void Cat_Fusion(Entity*); -void MountainMinish(Entity*); +void MountainMinish(); void MountainMinish_Head(Entity*); void MountainMinish_Fusion(Entity*); void ZeldaFollower(Entity*); void Melari(Entity*); void Melari_Head(Entity*); void Melari_Fusion(Entity*); -void BladeBrothers(Entity*); +void BladeBrothers(); void BladeBrothers_Fusion(Entity*); -void Cow(Entity*); -void Cow_Fusion(Entity*); -void Goron(Entity*); +void Cow(); +void Cow_Fusion(); +void Goron(); void Goron_Fusion(Entity*); void GoronMerchant(Entity*); -void Gorman(Entity*); +void Gorman(); void Gorman_Head(Entity*); -void Dog(Entity*); -void Dog_Head(Entity*); -void Dog_Fusion(Entity*); -void Syrup(Entity*); +void Dog(); +void Dog_Head(); +void Dog_Fusion(); +void Syrup(); void Syrup_Head(Entity*); -void Rem(Entity*); -void TownMinish(Entity*); -void TownMinish_Head(Entity*); +void Rem(); +void TownMinish(); +void TownMinish_Head(); void TownMinish_Fusion(Entity*); -void Librari(Entity*); +void Librari(); void Librari_Fusion(Entity*); -void Percy(Entity*); +void Percy(); void Percy_Head(Entity*); void Percy_Fusion(Entity*); void VaatiReborn(Entity*); @@ -343,26 +342,26 @@ void Dampe(Entity*); void Dampe_Fusion(Entity*); void DrLeft(Entity*); void KingGustaf(Entity*); -void Gina(Entity*); +void Gina(); void Gina_Fusion(Entity*); void Simon(Entity*); -void Anju(Entity*); -void Anju_Fusion(Entity*); -void Mama(Entity*); +void Anju(); +void Anju_Fusion(); +void Mama(); void Mama_Head(Entity*); void Mama_Fusion(Entity*); void Emma(Entity*); -void Teachers(Entity*); +void Teachers(); void Teachers_Head(Entity*); void Teachers_Fusion(Entity*); void WindTribespeople(Entity*); void WindTribespeople_Head(Entity*); void WindTribespeople_Fusion(Entity*); -void Gregal(Entity*); +void Gregal(); void Gregal_Fusion(Entity*); -void MayorHagen(Entity*); +void MayorHagen(); void MayorHagen_Fusion(Entity*); -void BigGoron(Entity*); +void BigGoron(); void Ezlo(Entity*); void NPC4E(Entity*); void NPC4E_Fusion(Entity*); @@ -370,18 +369,18 @@ void NPC4F(Entity*); void ClothesRack(Entity*); void PicolyteBottle(Entity*); void SmallTownMinish(Entity*); -void HurdyGurdyMan(Entity*); +void HurdyGurdyMan(); void HurdyGurdyMan_Head(Entity*); void HurdyGurdyMan_Fusion(Entity*); -void Cucco(Entity*); +void Cucco(); void Cucco_Fusion(Entity*); -void CuccoChick(Entity*); -void CuccoChick_Fusion(Entity*); +void CuccoChick(); +void CuccoChick_Fusion(); void FusionMenuNPC(Entity*); void FusionMenuNPC_Head(Entity*); void Phonograph(Entity*); -void NPC58(Entity*); -void NPC58_Head(Entity*); +void NPC58(); +void NPC58_Head(); extern void (*const gNPCFunctions[128][3])(Entity*); diff --git a/include/npc/zelda.h b/include/npc/zelda.h new file mode 100644 index 00000000..71579586 --- /dev/null +++ b/include/npc/zelda.h @@ -0,0 +1,20 @@ +#ifndef ZELDA_H +#define ZELDA_H + +#include "entity.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[24]; + /*0x80*/ u16 unk_80; +} ZeldaEntity; + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ s8 unk_68; + /*0x69*/ s8 unk_69; + /*0x6a*/ u8 unused[10]; + /*0x74*/ u16 unk_74; +} ZeldaFollowerEntity; + +#endif // ZELDA_H diff --git a/include/object.h b/include/object.h index 34160b18..67c000cf 100644 --- a/include/object.h +++ b/include/object.h @@ -134,7 +134,7 @@ typedef enum { EZLO_CAP_FLYING, GIANT_TWIG, OBJECT_63, - THUNDERBOLD, + THUNDERBOLT, LADDER_HOLE, WATER_DROP_OBJECT, GLEEROK_PARTICLE, @@ -330,7 +330,7 @@ void SwordsmanNewsletter(); void EzloCapFlying(); void GiantTwig(); void Object63(); -void Thunderbold(); +void Thunderbolt(); void LadderHoleInBookshelf(); void WaterDropObject(); void GleerokParticle(); diff --git a/include/object/cutsceneOrchestrator.h b/include/object/cutsceneOrchestrator.h new file mode 100644 index 00000000..d5ee110e --- /dev/null +++ b/include/object/cutsceneOrchestrator.h @@ -0,0 +1,12 @@ +#ifndef CUTSCENEORCHESTRATOR_H +#define CUTSCENEORCHESTRATOR_H + +#include "script.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ ScriptExecutionContext* context; +} CutsceneOrchestratorEntity; + +#endif // CUTSCENEORCHESTRATOR_H diff --git a/include/object/itemOnGround.h b/include/object/itemOnGround.h new file mode 100644 index 00000000..47ab89a8 --- /dev/null +++ b/include/object/itemOnGround.h @@ -0,0 +1,18 @@ +#ifndef ITEMONGROUND_H +#define ITEMONGROUND_H + +#include "entity.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69; + /*0x6a*/ u8 unk_6a; + /*0x6b*/ u8 unused1[1]; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u16 unk_6e; + /*0x70*/ u8 unused2[22]; + /*0x86*/ u16 unk_86; +} ItemOnGroundEntity; + +#endif // ITEMONGROUND_H diff --git a/include/object/lilypadLarge.h b/include/object/lilypadLarge.h new file mode 100644 index 00000000..b3cb6192 --- /dev/null +++ b/include/object/lilypadLarge.h @@ -0,0 +1,21 @@ +#ifndef LILYPADLARGE_H +#define LILYPADLARGE_H + +#include "entity.h" + +typedef struct { + Entity base; + u8 unk_68[4]; + s32 unk_6c; + s32 unk_70; + s16 unk_74; + s16 unk_76; + union SplitWord unk_78; + union SplitWord unk_7c; + u8 unk_80[2]; + u16 unk_82; + u8 unk_84; + u8 unk_85; +} LilypadLargeEntity; + +#endif // LILYPADLARGE_H diff --git a/include/physics.h b/include/physics.h index 74cefa41..dc6460cc 100644 --- a/include/physics.h +++ b/include/physics.h @@ -25,7 +25,6 @@ bool32 EntityWithinDistance(Entity* entity, s32 x, s32 y, s32 distance); u32 sub_0806FCA0(Entity*, Entity*); u32 sub_0806F58C(Entity*, Entity*); u32 PointInsideRadius(s32 x, s32 y, s32 radius); -u32 sub_0806F5A4(u32 idx); bool32 sub_0806F3E4(Entity*); void LinearMoveUpdate(Entity*); bool32 sub_0806FD54(Entity*); @@ -35,7 +34,10 @@ u32 sub_0806F730(Entity*); bool32 sub_0806F520(Entity*); void sub_0806F4E8(Entity*); bool32 sub_0806FC80(Entity*, Entity*, s32); -u32 sub_0806F5B0(u32); +/** Maps the direction to an animation state 0 to 3. */ +u32 GetAnimationStateForDirection4(u32 direction); +/** Maps the direction to an animation state 0 to 8. */ +u32 GetAnimationStateForDirection8(u32 direction); u32 sub_0806F824(Entity*, Entity*, s32, s32); u32 sub_0806F948(Entity*); void sub_0806FBB4(Entity*); diff --git a/include/player.h b/include/player.h index eabc6cac..e0fd182c 100644 --- a/include/player.h +++ b/include/player.h @@ -95,6 +95,12 @@ typedef enum { CONTROL_DISABLED, } PlayerControlMode; +typedef enum { + DIR_DIAGONAL = 0x4, + DIR_NOT_MOVING_CHECK = 0x80, + DIR_NONE = 0xff, +} PlayerDirections; + typedef enum { PL_BUSY = 0x1, PL_FLAGS2 = 0x2, @@ -125,6 +131,8 @@ typedef enum { PL_SWORD_THRUST = 0x8000000, PL_USE_OCARINA = 0x10000000, PL_CLIMBING = 0x20000000, + PL_FLAGS40000000 = 0x40000000, + PL_FLAGS80000000 = 0x80000000, } PlayerFlags; enum PlayerItemId { @@ -201,7 +209,8 @@ typedef enum { SURFACE_AUTO_LADDER, SURFACE_CLIMB_WALL, SURFACE_2C, - SURFACE_2D // reuses SurfaceAction_Dust + SURFACE_2D, // reuses SurfaceAction_Dust + SURFACE_FF = 0xff, } SurfaceType; typedef enum { @@ -275,6 +284,174 @@ typedef enum { SWORD_MOVE_LOW_BEAM, } SwordMove; +typedef enum { + ANIM_DEFAULT = 0x100, + ANIM_WALK = 0x104, + ANIM_SWORD = 0x108, + ANIM_BOUNCE = 0x114, + ANIM_SPINATTACK = 0x124, + ANIM_GREATSPIN = 0x128, + ANIM_ROLLATTACK_SPIN = 0x12c, + ANIM_ROLLATTACK_SLIDE = 0x130, + ANIM_ROLLATTACK_END = 0x134, + ANIM_SHIELD_PULLOUT = 0x158, + ANIM_SHIELD_WALK = 0x160, + ANIM_SHIELD = 0x164, + ANIM_SWORD_CHARGE = 0x168, + ANIM_SWORD_CHARGE_WALK = 0x16c, + ANIM_SWORD_CHARGE_BUMP = 0x170, + ANIM_DOWN_THRUST = 0x174, + ANIM_FALL = 0x1b8, + ANIM_GET_ITEM_BIG = 0x1b9, + ANIM_FALL_MINISH = 0x1ba, + ANIM_DIE1 = 0x1bc, + ANIM_GET_WHITE_SWORD = 0x1e2, + ANIM_BOW_PULLOUT = 0x21c, + ANIM_TRAPPED = 0x25c, + ANIM_BOW_SHOOT = 0x27c, + ANIM_BOW_CHARGE = 0x280, + ANIM_BOW_WALK = 0x284, + ANIM_ROCS_CAPE = 0x288, + ANIM_SWIM_STILL = 0x28c, + ANIM_SWIM_MOVE = 0x290, + ANIM_FROZEN = 0x294, + ANIM_DASH = 0x298, + ANIM_ELECTROCUTED = 0x29c, + ANIM_ROLL = 0x2ac, + ANIM_DIE2 = 0x2bd, + ANIM_DIVE = 0x2be, + ANIM_IN_LAVA = 0x2c1, + ANIM_PORTAL = 0x2c2, + ANIM_PORTAL_SHRINK = 0x2c3, + ANIM_DROWN_RESPAWN = 0x2ce, + ANIM_CLIMB1_UP = 0x2cf, + ANIM_CLIMB2_UP = 0x2d0, + ANIM_CLIMB1_DOWN = 0x2d1, + ANIM_CLIMB2_DOWN = 0x2d2, + ANIM_CLIMB_FROM_TOP = 0x2d3, + ANIM_CLIMB_LEFT = 0x2d4, + ANIM_CLIMB_RIGHT = 0x2d5, + ANIM_CLIMB_TO_TOP = 0x2d6, + ANIM_BOTTLE_DRINK = 0x2df, + ANIM_GET_ITEM_SMALL = 0x2e0, + ANIM_PICKUP = 0x338, + ANIM_PUSH = 0x33c, + ANIM_PULL = 0x340, + ANIM_THROW = 0x344, + ANIM_CARRY = 0x348, + ANIM_PULL2 = 0x34c, + ANIM_CARRY_STAND = 0x350, + ANIM_GRAB = 0x378, + ANIM_FALL_ON_BACK = 0x3a0, + ANIM_LAUNCHED = 0x3c0, + ANIM_EZLO_SEARCH = 0x3c5, + ANIM_EZLO_APPEAR_LEFT = 0x3c6, + ANIM_EZLO_EYES_UP = 0x3c7, + ANIM_EZLO_HEAD_DOWN = 0x3c8, + ANIM_EZLO_LEAVE_LEFT = 0x3c9, + ANIM_EZLO_APPEAR_RIGHT = 0x3ca, + ANIM_EZLO_EYES_MIDDLE = 0x3cc, + ANIM_EZLO_LEAVE_RIGHT = 0x3cd, + ANIM_DEFAULT_NOCAP = 0x400, + ANIM_WALK_NOCAP = 0x404, + ANIM_SWORD_NOCAP = 0x408, + ANIM_SHIELD_PULLOUT_NOCAP = 0x40c, + ANIM_SHIELD_WALK_NOCAP = 0x410, + ANIM_SHIELD_NOCAP = 0x414, + ANIM_BOUNCE_NOCAP = 0x418, + ANIM_HOP_NOCAP = 0x41c, + ANIM_JUMP_NOCAP = 0x420, + ANIM_LAND_NOCAP = 0x424, + ANIM_ROLL_NOCAP = 0x438, + ANIM_DROWN_NOCAP = 0x44c, + ANIM_FALL_NOCAP = 0x458, + ANIM_DIE1_NOCAP = 0x459, + ANIM_DIE2_NOCAP = 0x45a, + ANIM_GET_ITEM_BIG_NOCAP = 0x45b, + ANIM_GET_ITEM_SMALL_NOCAP = 0x45e, + ANIM_GET_ITEM_SWORD = 0x45f, + ANIM_GUSTJAR_PULLOUT = 0x500, + ANIM_GUSTJAR_SUCK = 0x504, + ANIM_MOLEMITTS_FLOOR = 0x508, + ANIM_MOLEMITTS_DIG = 0x50c, + ANIM_GUSTJAR_END = 0x510, + ANIM_GUSTJAR_BLOW = 0x514, + ANIM_GUSTJAR_WALK = 0x518, + ANIM_MOLEMITTS_CLANG = 0x51c, + ANIM_MOLEMITTS_MISS = 0x520, + ANIM_GUSTJAR_524 = 0x524, + ANIM_ENTER_POT = 0x52c, + ANIM_IN_POT = 0x530, + ANIM_LANTERN_LIGHT = 0x600, + ANIM_LANTERN_ON = 0x604, + ANIM_LANTERN = 0x608, + ANIM_LANTERN_BURN = 0x60c, + ANIM_BOTTLE_POUR = 0x610, + ANIM_BOTTLE_SWING = 0x614, + ANIM_BOTTLE_SWING_END = 0x618, + ANIM_FALL_IN_HOLE = 0x61c, + ANIM_IN_HOLE = 0x620, + ANIM_SPRING_JUMP = 0x624, + ANIM_CANE = 0x628, + ANIM_PARACHUTE_ACTIVATE = 0x700, + ANIM_BOOMERANG_MAGIC = 0x704, + ANIM_PARACHUTE = 0x708, + ANIM_MINECART_PAUSE = 0x70c, + ANIM_MINECART = 0x710, + ANIM_PARACHUTE_TURN_RIGHT = 0x714, + ANIM_PARACHUTE_TURN_OPPOSITE = 0x718, + ANIM_PARACHUTE_TURN_LEFT = 0x71c, + ANIM_PARACHUTE_TURN2_RIGHT = 0x720, + ANIM_PARACHUTE_TURN2_OPPOSITE = 0x724, + ANIM_PARACHUTE_TURN2_LEFT = 0x728, + ANIM_DROWN = 0x72c, + ANIM_PARACHUTE_FALL = 0x730, + ANIM_PUT_ON_EZLO = 0x734, + ANIM_SLEEP = 0x736, + ANIM_WAKEUP = 0x737, + ANIM_PORTAL_ACTIVATE = 0x738, + ANIM_SLEEP_NOCAP = 0x73a, + ANIM_WAKEUP_NOCAP = 0x73b, + ANIM_GROW = 0x73c, + ANIM_HOP = 0x80c, + ANIM_JUMP = 0x810, + ANIM_BOOMERANG = 0x818, + ANIM_LAND = 0x820, + ANIM_MOLDWORM_CAPTURED = 0x8b0, + ANIM_GET_NEW_SWORD = 0x8bf, + ANIM_OCARINA = 0x8e1, + ANIM_GET_LAST_SWORD = 0x8e3, + ANIM_GET_NEWCAP = 0x8e4, + ANIM_PICKUP_NOCAP = 0x928, + ANIM_CARRY_STAND_NOCAP = 0x92c, + ANIM_THROW_NOCAP = 0x930, + ANIM_CARRY_NOCAP = 0x934, + ANIM_PUSH_NOCAP = 0x93c, + ANIM_PULL_START_NOCAP = 0x940, + ANIM_PULL_NOCAP = 0x944, + ANIM_GRAB_NOCAP = 0x948, + ANIM_FALL_IN_HOLE_NOCAP = 0x950, + ANIM_IN_HOLE_NOCAP = 0x954, + ANIM_SWORD_MINISH = 0xc00, + ANIM_WALK_MINISH = 0xc04, + ANIM_ROLL_MINISH = 0xc08, + ANIM_SWIM_MINISH = 0xc0c, + ANIM_DASH_MINISH = 0xc10, + ANIM_DASH_CHARGE_MINISH = 0xc14, + ANIM_BOUNCE_MINISH = 0xc18, + ANIM_DROWN_MINISH = 0xc19, + ANIM_DIE1_MINISH = 0xc1a, + ANIM_DIE2_MINISH = 0xc1b, + ANIM_DIVE_MINISH = 0xc1c, +} PlayerAnimation; + +typedef enum { + PAS_NORTH, + PAS_EAST, + PAS_SOUTH, + PAS_WEST, +} PlayerAnimationState; + typedef struct { /*0x00*/ u8 prevAnim; /*0x01*/ u8 grab_status; @@ -304,7 +481,8 @@ typedef struct { /*0x1c*/ u8 field_0x1c; /*0x1d*/ u8 gustJarSpeed; /*0x1e*/ u8 dash_state; - /*0x1f*/ u8 field_0x1f[3]; + /*0x1f*/ u8 field_0x1f[2]; + /*0x21*/ u8 bow_state; /*0x22*/ u16 tilePosition; /*0x24*/ u16 tileType; /*0x26*/ u8 swim_state; /**< Is the player swimming? 0x80 for diving */ @@ -354,20 +532,21 @@ typedef struct { /*0x05*/ u8 arrowCount; /*0x06*/ u8 bombBagType; /*0x07*/ u8 quiverType; - /*0x08*/ u8 filler[2]; + /*0x08*/ u8 figurineCount; + /*0x09*/ u8 _hasAllFigurines; /*0x0a*/ u8 charm; /*0x0b*/ u8 picolyteType; /*0x0c*/ u8 itemButtons[2]; /*0x0e*/ u8 bottles[4]; /*0x12*/ u8 effect; /*0x13*/ u8 hasAllFigurines; - /*0x14*/ u8 filler3[4]; + /*0x14*/ u8 filler14[4]; /*0x18*/ u16 rupees; /*0x1a*/ u16 shells; /*0x1c*/ u16 charmTimer; /*0x1e*/ u16 picolyteTimer; /*0x20*/ u16 effectTimer; - /*0x22*/ u8 filler4[6]; + /*0x22*/ u8 filler22[2]; } Stats; #define SLOT_A 0 diff --git a/include/projectile.h b/include/projectile.h index c8186e2b..529ff47c 100644 --- a/include/projectile.h +++ b/include/projectile.h @@ -16,31 +16,31 @@ void DirtBallProjectile(Entity*); void WindProjectile(Entity*); void FireProjectile(Entity*); void IceProjectile(Entity*); -void GleerokProjectile(Entity*); +void GleerokProjectile(); void KeatonDagger(Entity*); void GuardLineOfSight(Entity*); void ArrowProjectile(Entity*); void MazaalEnergyBeam(Entity*); -void OctorokBossProjectile(Entity*); +void OctorokBossProjectile(); void StalfosProjectile(Entity*); void LakituCloudProjectile(Entity*); void LakituLightning(Entity*); -void MandiblesProjectile(Entity*); -void RemovableDust(Entity*); -void SpiderWeb(Entity*); +void MandiblesProjectile(); +void RemovableDust(); +void SpiderWeb(); void TorchTrapProjectile(Entity*); void GuruguruBarProjectile(Entity*); -void V1DarkMagicProjectile(Entity*); -void BallAndChain(Entity*); -void V1FireProjectile(Entity*); +void V1DarkMagicProjectile(); +void BallAndChain(); +void V1FireProjectile(); void CannonballProjectile(Entity*); -void V1EyeLaser(Entity*); +void V1EyeLaser(); void Winder(Entity*); void SpikedRollers(Entity*); -void V2Projectile(Entity*); +void V2Projectile(); void V3HandProjectile(Entity*); -void V3ElectricProjectile(Entity*); -void GyorgTail(Entity*); +void V3ElectricProjectile(); +void GyorgTail(); void GyorgMaleEnergyProjectile(Entity*); void V3TennisBallProjectile(Entity*); diff --git a/include/projectile/winder.h b/include/projectile/winder.h index face0213..4f650feb 100644 --- a/include/projectile/winder.h +++ b/include/projectile/winder.h @@ -5,8 +5,8 @@ #define WINDER_NUM_SEGMENTS 8 typedef struct { - Entity base; - s16 positions[2 * WINDER_NUM_SEGMENTS]; + /*0x00*/ Entity base; + /*0x68*/ s16 positions[2 * WINDER_NUM_SEGMENTS]; } WinderEntity; #endif // WINDER_H diff --git a/include/room.h b/include/room.h index 388adeab..29e45967 100644 --- a/include/room.h +++ b/include/room.h @@ -135,7 +135,7 @@ typedef struct { /* 0x04 */ s16 start_pos_x; /* 0x06 */ s16 start_pos_y; /* 0x08 */ u8 layer; - /* 0x09 */ u8 field_0x15; + /* 0x09 */ u8 filler9; /* 0x0a */ u8 dungeon_area; /* 0x0b */ u8 dungeon_room; /* 0x0c */ s16 dungeon_x; @@ -144,7 +144,7 @@ typedef struct { /* 0x12 */ u16 dungeon_map_y; /* 0x14 */ u16 overworld_map_x; /* 0x16 */ u16 overworld_map_y; - /* 0x18 */ u8 field_0x24[8]; + /* 0x18 */ u8 filler18[8]; } PlayerRoomStatus; static_assert(sizeof(PlayerRoomStatus) == 0x20); @@ -157,8 +157,20 @@ typedef struct { /* 0x0a */ u16 stairs_idx; // seems to be a tile type @see MetaTileType, set in UpdateDoorTransition() /* 0x0c */ PlayerRoomStatus player_status; /* 0x2c */ u8 entity_update_type; // differentiates entity priority on kinstone menu? - /* 0x2d */ u8 field_0x2c[0x8]; + /* 0x2d */ u8 field2d; + /* 0x2e */ u8 location; + /* 0x2f */ u8 field2f; + /* 0x30 */ u8 field30; + /* 0x31 */ u8 field31; + /* 0x32 */ u8 field32; + /* 0x33 */ u8 field33; +#if defined(JP) || defined(EU) + /* 0x34 */ u8 hint_height; + /* 0x35 */ u8 field35; +#else + /* 0x34 */ u8 field35; /* 0x35 */ u8 hint_height; +#endif /* 0x36 */ u16 hint_idx; /* 0x38 */ u8 field_0x38; /* 0x39 */ u8 field_0x39; @@ -239,7 +251,7 @@ void* GetRoomProperty(u32 area, u32 room, u32 property); bool32 LoadFixedGFX(Entity*, u32); void UnloadGFXSlots(Entity*); -void sub_0804B3C4(TileEntity*); +void LoadSmallChestTile2(TileEntity*); void sub_0804B0B0(u32 arg0, u32 arg1); void DoExitTransition(const ScreenTransitionData* data); diff --git a/include/save.h b/include/save.h index 50c2dc3c..bc966efc 100644 --- a/include/save.h +++ b/include/save.h @@ -28,52 +28,69 @@ typedef enum { */ extern SaveResult HandleSave(u32 idx); +/** + * Contains save data regarding kinstones + */ +typedef struct { + u8 unused[2]; /**< unused */ + u8 didAllFusions; /**< completed all 100 kinstone fusions */ + u8 fusedCount; /**< number of kinstones fused */ + u8 types[19]; /**< item id for each kinstone type present in kinstone bag */ + u8 amounts[19]; /**< amount of each kinstone type above */ + u8 filler[3]; /**< unused filler */ + u8 fuserProgress[128]; /**< indexed by fuser id, incremented after fusion */ + u8 fuserOffers[128]; /**< available kinstone fusion for each fuser */ + u8 fusedKinstones[13]; /**< bitfield for fused kinstones + * @see CheckKinstoneFused */ + u8 fusionUnmarked[13]; /**< bitfield for disabled fusion map markers + * @see CheckFusionMapMarkerDisabled */ +} KinstoneSave; + /** * Contains all information about a save file. * The contents of this structure are read from and written to EEPROM. */ typedef struct { - /*0x000*/ u8 invalid; /**< File is invalid. */ - /*0x001*/ u8 initialized; /**< File is initialized. */ - /*0x002*/ u8 msg_speed; /**< Message speed. */ - /*0x003*/ u8 brightness; /**< Brightness. */ - /*0x004*/ u8 filler4[0x2]; - /*0x006*/ u8 saw_staffroll; - /*0x007*/ u8 unk7; // TODO rolling barrel state? - /*0x008*/ u8 global_progress; /**< @see UpdateGlobalProgress */ - /*0x009*/ u8 field_0x9[0x17]; - /*0x020*/ u16 field_0x20; - /*0x022*/ u8 field_0x22[0x1e]; - /*0x040*/ u32 windcrests; /**< Windcrest flags. bits 0 - 0x10: Visited area of the overworld. Above 0x18: windcrest - activated. */ - /*0x044*/ u8 filler44[0xC]; - /*0x050*/ u32 unk50; - /*0x054*/ u8 filler54[0x8]; - /*0x05C*/ u32 unk5C; - /*0x060*/ u32 areaVisitFlags[8]; /**< Area visit flags. */ - /*0x080*/ char name[FILENAME_LENGTH]; /**< Save file name. */ - /*0x086*/ u8 filler86[0x2]; + /*0x000*/ u8 invalid; /**< save file is invalid */ + /*0x001*/ u8 initialized; /**< save file is initialized */ + /*0x002*/ u8 msg_speed; /**< message speed setting */ + /*0x003*/ u8 brightness; /**< brightness setting */ + /*0x004*/ u8 filler4[2]; /**< unused filler */ + /*0x006*/ u8 saw_staffroll; /**< beat the game and watched the credits */ + /*0x007*/ u8 dws_barrel_state; /**< state of the big barrel in DWS, 0 or 2 */ + /*0x008*/ u8 global_progress; /**< @see UpdateGlobalProgress */ + /*0x009*/ u8 available_figurines; /**< figurines available to get */ + /*0x00A*/ u8 fillerA[22]; /**< unused filler */ + /*0x020*/ u16 map_hints; /**< bitmask, used by subtask MapHint */ + /*0x022*/ u8 filler22[30]; /**< unused filler */ + /*0x040*/ u32 windcrests; /**< upper 8 bit Windcrest flags @see WindcrestID + * lower bits used for other things */ + /*0x044*/ u8 filler44[12]; /**< unused filler */ + /*0x050*/ u32 enemies_killed; /**< number of enemies killed */ + /*0x054*/ u8 filler54[8]; /**< unused filler */ + /*0x05C*/ u32 items_bought; /**< number of items bought in stockwells shop */ + /*0x060*/ u32 areaVisitFlags[8]; /**< Area visit flags. */ + /*0x080*/ char name[FILENAME_LENGTH]; /**< Save file name. */ + /*0x086*/ u8 filler86[2]; /**< unused filler */ /*0x088*/ PlayerRoomStatus saved_status; /**< Player room status. */ /*0x0A8*/ Stats stats; /**< Player stats. */ - /*0x0D0*/ u8 fillerD0[34]; - /*0x0F2*/ u8 inventory[36]; - /*0x116*/ u8 didAllFusions; - /*0x117*/ u8 fusedKinstoneCount; - /*0x118*/ u8 kinstoneTypes[0x13]; // 0x65-0x75 for each kinstone type present in kinstone bag - /*0x12B*/ u8 kinstoneAmounts[0x13]; // amount of each kinstone type above - /*0x13E*/ u8 filler13E[3]; - /*0x141*/ u8 fuserProgress[128]; // indexed by fuser id, incremented after fusion - /*0x1C1*/ u8 fuserOffers[128]; // available kinstone fusion for each fuser - /*0x241*/ u8 fusedKinstones[13]; /**< Bitfield for fused kinstones. @see CheckKinstoneFused */ - /*0x24E*/ u8 fusionUnmarked[13]; /**< Bitfield for disabled fusion map markers. @see CheckFusionMapMarkerDisabled */ - /*0x25B*/ u8 filler25B; - /*0x25C*/ u8 flags[0x200]; /**< Flags. */ - /*0x45C*/ u8 dungeonKeys[0x10]; // TODO Indexed by dungeon id, keys per dungeon - /*0x46C*/ u8 dungeonItems[0x10]; // TODO items in the dungeon. 4: compass, 2: big key, 1: small key - /*0x47C*/ u8 dungeonWarps[0x10]; // TODO indexed by dungeon id, EnableDungeonWarp, IsDungeonWarpActive - /*0x48C*/ u32 timers[7]; - /*0x4A8*/ u32 demo_timer; /**< Demo timer. */ - /*0x4AC*/ u8 filler4ac[0x8]; + /*0x0CC*/ u8 fillerCC[2]; /**< unused filler */ + /*0x0D0*/ u8 figurines[36]; /**< figurine bitset */ + /*0x0F2*/ u8 inventory[34]; /**< 2 bit per item @see Item */ + /*0x114*/ KinstoneSave kinstones; /**< save data for kinstones @see KinstoneSave */ + /*0x25C*/ u8 flags[0x200]; /**< flags */ + /*0x45C*/ u8 dungeonKeys[0x10]; /**< indexed by dungeon id, keys per dungeon */ + /*0x46C*/ u8 dungeonItems[0x10]; /**< dungeon items 4: compass, 2: big key, 1: small key */ + /*0x47C*/ u8 dungeonWarps[0x10]; /**< indexed by dungeon id */ + /*0x48C*/ u32 darknut_timer; /**< timer for darknut fight before Vaati fight */ + /*0x490*/ u32 drug_kill_count; /**< "timer" enemy kill count when turning in the last drug quest item */ + /*0x494*/ u32 biggoron_timer; /**< timer for biggoron mirror shield */ + /*0x498*/ u32 vaati_timer; /**< timer for vaati wrath fight */ + /*0x49C*/ u32 timer4; /**< "timer4" unused */ + /*0x4A0*/ u32 timer5; /**< "timer5" unused */ + /*0x4A4*/ u32 timer6; /**< "timer6" unused */ + /*0x4A8*/ u32 demo_timer; /**< timer for US demo version playtime limit */ + /*0x4AC*/ u8 filler4ac[8]; /**< unused filler */ } SaveFile; /** diff --git a/include/script.h b/include/script.h index b708d945..6a0688d6 100644 --- a/include/script.h +++ b/include/script.h @@ -51,7 +51,7 @@ extern u32 GetNextScriptCommandHalfwordAfterCommandMetadata(u16*); void UnloadCutsceneData(Entity* entity); void StartPlayerScript(Script* script); -void sub_0807DD50(Entity* entity); +void InitScriptForNPC(Entity* entity); void sub_0807DD64(Entity* entity); void sub_0807DD80(Entity* entity, Script* script); void LookAt(Entity*, ScriptExecutionContext*, u32, u32); @@ -60,7 +60,7 @@ ScriptExecutionContext* StartCutscene(Entity* entity, Script* script); void ExecuteScriptForEntity(Entity* entity, void (*postScriptCallback)(Entity*, ScriptExecutionContext*)); void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context); void HandleEntity0x82Actions(Entity* entity); -void sub_0807DD94(Entity*, void (*function)(Entity*, ScriptExecutionContext*)); +void ExecuteScriptAndHandleAnimation(Entity* entity, void (*postScriptCallback)(Entity*, ScriptExecutionContext*)); ScriptExecutionContext* CreateScriptExecutionContext(void); void InitScriptForEntity(Entity* entity, ScriptExecutionContext* context, Script* script); diff --git a/include/sound.h b/include/sound.h index f62768ad..749a1268 100644 --- a/include/sound.h +++ b/include/sound.h @@ -168,7 +168,7 @@ typedef enum { SFX_FALL_HOLE, SFX_86, SFX_PLY_DIE, - SFX_88, + SFX_GRAB, SFX_BARREL_RELEASE, SFX_BARREL_ENTER, SFX_BARREL_ROLL, @@ -295,7 +295,7 @@ typedef enum { SFX_PLACE_OBJ, SFX_105, SFX_106, - SFX_107, + SFX_ITEM_GLOVES_AIR, SFX_108, SFX_ITEM_GET, SFX_10A, diff --git a/include/tiles.h b/include/tiles.h index 8898fe07..594ea8ce 100644 --- a/include/tiles.h +++ b/include/tiles.h @@ -118,14 +118,14 @@ typedef enum { META_TILE_TYPE_113, // 0x71 META_TILE_TYPE_114, // 0x72 META_TILE_TYPE_115, // 0x73 CHEST - META_TILE_TYPE_116, // 0x74 + META_TILE_TYPE_116, // 0x74 CHEST_OPEN META_TILE_TYPE_117, // 0x75 - META_TILE_TYPE_118, // 0x76 - META_TILE_TYPE_119, // 0x77 - META_TILE_TYPE_120, // 0x78 - META_TILE_TYPE_121, // 0x79 - META_TILE_TYPE_122, // 0x7a - META_TILE_TYPE_123, // 0x7b + META_TILE_TYPE_118, // 0x76 TORCH + META_TILE_TYPE_119, // 0x77 TORCH_LIT + META_TILE_TYPE_120, // 0x78 PRESSURE_BUTTON + META_TILE_TYPE_121, // 0x79 PRESSURE_BUTTON_PRESSED + META_TILE_TYPE_122, // 0x7a PRESSURE_SQUARE + META_TILE_TYPE_123, // 0x7b PRESSURE_SQUARE_PRESSED META_TILE_TYPE_124, // 0x7c META_TILE_TYPE_125, // 0x7d META_TILE_TYPE_126, // 0x7e @@ -148,8 +148,8 @@ typedef enum { META_TILE_TYPE_143, // 0x8f META_TILE_TYPE_144, // 0x90 META_TILE_TYPE_145, // 0x91 - META_TILE_TYPE_146, // 0x92 - META_TILE_TYPE_147, // 0x93 + META_TILE_TYPE_146, // 0x92 STAIRS_UP + META_TILE_TYPE_147, // 0x93 STAIRS_DOWN META_TILE_TYPE_148, // 0x94 META_TILE_TYPE_149, // 0x95 META_TILE_TYPE_150, // 0x96 diff --git a/include/windcrest.h b/include/windcrest.h new file mode 100644 index 00000000..2c81c1e4 --- /dev/null +++ b/include/windcrest.h @@ -0,0 +1,15 @@ +#ifndef SAVEFILE_WINDCREST_H +#define SAVEFILE_WINDCREST_H + +typedef enum WindcrestID { + WINDCREST_MT_CRENEL = 24, + WINDCREST_VEIL_FALLS, + WINDCREST_CLOUD_TOPS, + WINDCREST_HYRULE_TOWN, + WINDCREST_LAKE_HYLIA, + WINDCREST_CASTOR_WILDS, + WINDCREST_SOUTH_HYRULE_FIELD, + WINDCREST_MINISH_WOODS, +} WindcrestID; + +#endif // SAVEFILE_WINDCREST_H diff --git a/linker.ld b/linker.ld index f658c112..485fd251 100644 --- a/linker.ld +++ b/linker.ld @@ -628,7 +628,7 @@ SECTIONS { src/object/chuchuBossParticle.o(.text); src/object/floatingPlatform.o(.text); src/object/gustJarParticle.o(.text); - asm/object/evilSpirit.o(.text); + src/object/evilSpirit.o(.text); src/object/houseDoorExterior.o(.text); src/object/rupee.o(.text); src/object/greatFairy.o(.text); @@ -704,7 +704,7 @@ SECTIONS { src/object/ezloCapFlying.o(.text); src/object/giantTwig.o(.text); src/object/object63.o(.text); - src/object/thunderbold.o(.text); + src/object/thunderbolt.o(.text); src/object/ladderHoleInBookshelf.o(.text); src/object/waterDropObject.o(.text); src/object/gleerokParticle.o(.text); @@ -1386,7 +1386,7 @@ SECTIONS { src/object/chuchuBossParticle.o(.rodata); src/object/floatingPlatform.o(.rodata); src/object/gustJarParticle.o(.rodata); - data/const/object/evilSpirit.o(.rodata); + src/object/evilSpirit.o(.rodata); data/animations/object/evilSpirit.o(.rodata); src/object/houseDoorExterior.o(.rodata); src/object/rupee.o(.rodata); @@ -1483,8 +1483,8 @@ SECTIONS { src/object/ezloCapFlying.o(.rodata); src/object/giantTwig.o(.rodata); src/object/object63.o(.rodata); - src/object/thunderbold.o(.rodata); - data/animations/object/thunderbold.o(.rodata); + src/object/thunderbolt.o(.rodata); + data/animations/object/thunderbolt.o(.rodata); src/object/ladderHoleInBookshelf.o(.rodata); src/object/gleerokParticle.o(.rodata); src/object/linkEmptyingBottle.o(.rodata); diff --git a/src/affine.c b/src/affine.c index eb114665..04c0be86 100644 --- a/src/affine.c +++ b/src/affine.c @@ -53,7 +53,7 @@ void CopyOAM(void) { void DrawEntities(void) { void (*fn)(void); - gOAMControls._0[6] = gRoomTransition.field_0x2c[2] ? 15 : 0; + gOAMControls._0[6] = gRoomTransition.field2f ? 15 : 0; gOAMControls._4 = gRoomControls.aff_x + gRoomControls.scroll_x; gOAMControls._6 = gRoomControls.aff_y + gRoomControls.scroll_y; gOAMControls.field_0x1++; diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index 872ac7e6..6157a739 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -116,7 +116,7 @@ void sub_08019764(void) { UpdateEntities(); DrawEntities(); CopyOAM(); - if ((--gUnk_02018EB0.unk_4 == 0) || ((gInput.newKeys & 10) != 0)) { + if ((--gUnk_02018EB0.unk_4 == 0) || ((gInput.newKeys & (B_BUTTON | START_BUTTON)) != 0)) { gUnk_02018EB0.unk_0++; } } @@ -170,7 +170,7 @@ u32 UpdatePlayerCollision(void) { u32 index; const s16* ptr1; const s16* ptr2; - s32 tmp1; + s32 framestate; u32 tmp2; u32 tmp3; // There are some weird assignment necessary to access gPlayerEntity.animationState correctly. @@ -178,18 +178,18 @@ u32 UpdatePlayerCollision(void) { u32 animationState2; u32 animationState3; - if (gPlayerState.framestate == 0) { - tmp1 = gPlayerState.framestate_last; + if (gPlayerState.framestate == PL_STATE_IDLE) { + framestate = gPlayerState.framestate_last; } else { - tmp1 = gPlayerState.framestate; + framestate = gPlayerState.framestate; } - switch (tmp1) { - case 3: + switch (framestate) { + case PL_STATE_GUSTJAR: return 0; - case 0x12: + case PL_STATE_DIE: return 0; - case 0x16: + case PL_STATE_DROWN: return 0; } @@ -198,7 +198,7 @@ u32 UpdatePlayerCollision(void) { } else { direction = gPlayerState.direction; } - if (((direction & 0x83) == 0) && (gPlayerState.field_0xa == 0)) { + if (((direction & (DIR_NOT_MOVING_CHECK | 0x3)) == 0) && (gPlayerState.field_0xa == 0)) { index = sub_0807BDB8(&gPlayerEntity, direction >> 2); if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) { ptr1 = &gUnk_080B4490[index * 2]; @@ -254,10 +254,11 @@ u32 UpdatePlayerCollision(void) { if (gPlayerState.field_0xa != 0) { return 0; } - if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != 0) { + if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != + DirectionNorth) { return 0; } - if ((gPlayerEntity.direction & 0x80) != 0) { + if ((gPlayerEntity.direction & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if (GetCollisionDataAtMetaTilePos(position, gPlayerEntity.collisionLayer) != COLLISION_DATA_15) { @@ -306,10 +307,10 @@ u32 UpdatePlayerCollision(void) { case VVV_58: case VVV_91: case SPECIAL_META_TILE_81: - if ((gPlayerState.flags & PL_MINISH) != 0) { + if (gPlayerState.flags & PL_MINISH) { return 0; } - if (gPlayerEntity.animationState != 0) { + if (gPlayerEntity.animationState != IdleNorth) { return 0; } gHUD.rActionInteractTile = R_ACTION_READ; @@ -357,7 +358,8 @@ u32 UpdatePlayerCollision(void) { return 0; } #endif - if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != 0) { + if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != + DirectionNorth) { return 0; } if ((gPlayerEntity.direction & 0x80) != 0) { @@ -417,7 +419,7 @@ u32 UpdatePlayerCollision(void) { if ((animationState1 & 0xff) != 0) { return 0; } - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if ((gPlayerEntity.frame & 2) == 0) { @@ -557,7 +559,7 @@ u32 UpdatePlayerCollision(void) { if (animationState3 == 0) { return 0; } - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if ((gPlayerEntity.frame & 1) == 0) { @@ -576,7 +578,7 @@ u32 UpdatePlayerCollision(void) { if ((animationState2) != 4) { return 0; } - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } if ((gPlayerEntity.frame & 1) == 0) { @@ -597,7 +599,8 @@ bool32 sub_0801A2B0(MapLayer* mapLayer, u32 position, u32 collisionType) { u16 temp4; uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; - if ((((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) == 0) && ((gPlayerEntity.frame & 1) != 0)) { + if ((((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) == 0) && + ((gPlayerEntity.frame & 1) != 0)) { position = (u16)(position - (-uVar1)); // necessary for match temp4 = GetVvvForMetaTileType(GetMetaTileType(position, gPlayerEntity.collisionLayer)); switch (temp4) { @@ -714,18 +717,18 @@ bool32 sub_0801A4F8(void) { if (GetInventoryValue(ITEM_POWER_BRACELETS) != 1) { return FALSE; } - if ((gPlayerState.direction & 0x80) != 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { return FALSE; } if (gPlayerState.direction != gPlayerEntity.direction) { return FALSE; } - tmp = (((gPlayerEntity.direction + 4) & 0x18) >> 3); + tmp = (((gPlayerEntity.direction + 4) & DirectionWest) >> 3); if ((gUnk_080B44A0[tmp] & gPlayerEntity.collisions) == 0) { return FALSE; } } else { - if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) { + if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return FALSE; } if ((gPlayerEntity.frame & 1) == 0) { @@ -735,7 +738,165 @@ bool32 sub_0801A4F8(void) { return TRUE; } -ASM_FUNC("asm/non_matching/beanstalkSubtask/sub_0801A570.inc", u32 sub_0801A570(Entity* a, u32 b)) +u32 sub_0801A570(Entity* this, u32 param_2) { + MapLayer* layer; + u32 tileType; + u32 position; + u32 index1; + u32 index2; + u16* metatileTypes; + u8* collisionData; + + if (this == NULL) { + return 0xffff; + } + layer = GetLayerByIndex(this->collisionLayer); + metatileTypes = layer->metatileTypes; + index1 = 4; + index2 = 2; + switch (this->animationState >> 1) { + case 0: + default: + position = COORD_TO_TILE_OFFSET(this, 0, 10); + do { + if (metatileTypes[layer->mapData[position]] == 0x370) + break; + position--; + index1--; + } while (index1 != 0); + + position = position - 0x40; + do { + if (metatileTypes[layer->mapData[(position)]] != 0x374) + break; + index2++; + position -= 0x40; + } while (index2 < 4); + + if (param_2 == 0) { + return position; + } + + index1 = GetMetaTileType(position, this->collisionLayer); + if ((index1 - 0x369) > 1) { + position = 0xffff; + } else { + collisionData = layer->collisionData - 0x40 + position; + for (index1 = 0; index1 < index2; index1++) { + if (collisionData[index1] != 0) { + position = 0xffff; + break; + } + } + } + break; + case 1: + position = COORD_TO_TILE_OFFSET(this, -10, 0); + do { + if (layer->metatileTypes[layer->mapData[position]] == 0x370) + break; + position += 0x40; + index1--; + } while (index1 != 0); + + position = position - 0x40; + do { + if (metatileTypes[layer->mapData[(position)]] != 0x374) + break; + index2++; + position -= 0x40; + } while (index2 < 4); + + if (param_2 == 0) { + return position; + } + + index1 = GetMetaTileType(position, this->collisionLayer); + if (!(index1 == 0x369) && !(index1 == 0x36d)) + position = 0xffff; + else { + collisionData = layer->collisionData + (position + index2); + for (index1 = 0; index1 < index2; index1++) { + if (collisionData[index1 * 0x40] != 0) { + position = 0xffff; + break; + } + } + } + break; + case 2: + position = COORD_TO_TILE_OFFSET(this, 0, -10); + do { + if (layer->metatileTypes[layer->mapData[position]] == 0x36f) + break; + position++; + index1--; + } while (index1 != 0); + + position = position - 1; + do { + if (metatileTypes[layer->mapData[position]] != 0x372) + break; + index2++; + position--; + } while (index2 < 4); + + if (param_2 == 0) { + return position; + } + + index1 = GetMetaTileType(position, this->collisionLayer); + if (!(index1 == 0x369) && !(index1 == 0x36b)) + position = 0xffff; + else { + collisionData = layer->collisionData + (position + (index2 * 0x40)); + for (index1 = 0; index1 < index2; index1++) { + if (collisionData[index1] != 0) { + position = 0xffff; + break; + } + } + } + break; + case 3: + position = COORD_TO_TILE_OFFSET(this, 10, 0); + do { + if (layer->metatileTypes[layer->mapData[position]] == 0x36f) + break; + position -= 0x40; + index1--; + } while (index1 != 0); + + position = position - 1; + do { + if (metatileTypes[layer->mapData[position]] != 0x372) + break; + index2++; + position--; + } while (index2 < 4); + + if (param_2 == 0) { + return position; + } + + index1 = GetMetaTileType(position, this->collisionLayer); + if (!(index1 == 0x369) && !(index1 == 0x36c)) + position = 0xffff; + else { + collisionData = layer->collisionData - 1 + position; + for (index1 = 0; index1 < index2; index1++) { + if (collisionData[index1 * 0x40] != 0) { + position = 0xffff; + break; + } + } + } + } + if (param_2 != 0) { + position |= index2 << 0xc; + } + return position; +} u32 sub_0801A8D0(Entity* this, u32 param_2) { u16* mapData; @@ -1032,7 +1193,7 @@ void sub_0801AE44(bool32 loadGfx) { } sub_080809D4(); UpdateIsDiggingCave(); - if (gRoomTransition.field_0x2c[0] != 0) { + if (gRoomTransition.field2d != 0) { sub_0807C898(); } if (gArea.lightType != 0) { @@ -1069,7 +1230,7 @@ void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer) { // Add a new entry at the end of gMetaTilesForSpecialTiles void StoreMetaTileForSpecialTile(u32 metaTileIndex, u32 metaTilePos, u32 layer) { u32 index; - if ((metaTileIndex < 0x4000) && (gRoomTransition.field_0x2c[3] == 0)) { + if ((metaTileIndex < 0x4000) && (gRoomTransition.field30 == 0)) { index = gRoomVars.specialTileCount; if (index < 0x100) { gMetaTilesForSpecialTiles[index].metaTileIndex = metaTileIndex; diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c index 37c56cd2..7398dac8 100644 --- a/src/code_0805EC04.c +++ b/src/code_0805EC04.c @@ -77,44 +77,35 @@ void UpdatePlayerInput(void) { u32 prevState; PlayerInput* playerInput; PlayerMacroEntry* playerMacro; - u32 zero; if (gPlayerState.playerInput.playerMacro != NULL) { // Player is controlled by macro. playerInput = &gPlayerState.playerInput; playerMacro = playerInput->playerMacro; if (playerInput->playerMacroWaiting == 0) { // Execute next macro entry. - zero = 0; - goto code_2; - code_0: - if (flags != 2) { // !PLAYER_MACRO_IGNORE - playerInput->playerMacroWaiting = playerMacro->flags; - playerInput->playerMacroHeldKeys = playerMacro->keys; - } - playerMacro++; - playerInput->playerMacro = playerMacro; - goto code_4; - code_2: do { flags = playerMacro->flags >> 0xe; - if (flags != 1) { - break; + if (flags == 1) // PLAYER_MACRO_JUMPTO + (u8*)playerMacro += ((s16)playerMacro->keys); + else { + if (flags == 3) { // PLAYER_MACRO_END + playerInput->playerMacroWaiting = 0; + playerInput->playerMacroHeldKeys = 0; + playerMacro = NULL; + playerInput->playerMacro = playerMacro; + break; + } else { + if (flags != 2) { // !PLAYER_MACRO_IGNORE + playerInput->playerMacroWaiting = playerMacro->flags; + playerInput->playerMacroHeldKeys = playerMacro->keys; + } + playerMacro++; + playerInput->playerMacro = playerMacro; + break; + } } - // PLAYER_MACRO_JUMPTO - (u8*)playerMacro += ((s16)playerMacro->keys); } while (TRUE); - - if (flags == 3) { - // PLAYER_MACRO_END - playerInput->playerMacroWaiting = zero; - playerInput->playerMacroHeldKeys = zero; - playerMacro = NULL; - playerInput->playerMacro = playerMacro; - } else { - goto code_0; - } } - code_4: playerInput->playerMacroWaiting--; keys = playerInput->playerMacroHeldKeys; } else { @@ -185,7 +176,7 @@ u32 ConvInputToState(u32 keys) { } void sub_0805EE88(void) { - if ((gRoomTransition.field_0x2c[2] != 0) && ((gRoomTransition.frameCount & 3) == 0)) { + if ((gRoomTransition.field2f != 0) && ((gRoomTransition.frameCount & 3) == 0)) { LoadPaletteGroup((((u32)gRoomTransition.frameCount & 0xc) >> 2) + 0x2f); } } diff --git a/src/color.c b/src/color.c index 7acbdb50..d82e57de 100644 --- a/src/color.c +++ b/src/color.c @@ -54,7 +54,7 @@ void sub_0801D000(u32 a1) { tmp = 0; } - roomTransition->field_0x2c[2] = tmp; + roomTransition->field2f = tmp; if (a1) { CleanUpObjPalettes(); sub_0801CFD0(0xf); diff --git a/src/common.c b/src/common.c index 4f402382..437b211d 100644 --- a/src/common.c +++ b/src/common.c @@ -19,10 +19,11 @@ extern u8 gUnk_03003DE0; extern u8 gzHeap[0x1000]; +extern u8 gUnk_02035542[]; extern u32 gDungeonMap[0x800]; extern s16 gUnk_02018EE0[]; -extern void (*const gUnk_080C9CAC[])(void); +extern void (*const gFuseActions[])(void); static void StoreKeyInput(Input* input, u32 keyInput); void ClearOAM(void); @@ -78,6 +79,7 @@ bool32 IsRoomVisited(TileEntity* tileEntity, u32 bank); u32 sub_0801DF60(u32 a1, u8* p); u32 sub_0801DF78(u32 a1, u32 a2); void DrawMapPixel(u32 x, u32 y, s32 color); +void sub_0801E64C(s32 x1, s32 y1, s32 x2, s32 y2, s32 offset); extern void* GetRoomProperty(u32, u32, u32); @@ -341,20 +343,106 @@ void sub_0801D898(void* dest, void* src, u32 word, u32 size) { } while (--size); } -ASM_FUNC("asm/non_matching/common/zMalloc.inc", void* zMalloc(u32 size)); +void* zMalloc(u32 size) { + u16* heapStartOffset; + u32 slotFound; + u8* allocatedEntryStartOffset; + u8* allocatedEntryEndOffset; + u8* candidateSlotEndOffset; + u8* candidateSlotStartOffset; + u16 index1, index2; + u16 numEntries; + // align to 4 + size = (size + 3) & ~3; -typedef struct { - u16 start; // chunk start (offset from gzHeap) - u16 end; // chunk end (offset from gzHeap) -} HEAP_ENTRY; + heapStartOffset = (u16*)(gzHeap); + numEntries = heapStartOffset[0]; + slotFound = TRUE; -typedef struct { - u16 num_entries; // allocated HEAP_ENTRYs in entries + // Check for a candidate slot at the tail-end of the heap buffer + candidateSlotEndOffset = (u8*)heapStartOffset + sizeof(gzHeap); + candidateSlotStartOffset = candidateSlotEndOffset - size; + for (index2 = 0; index2 < numEntries; index2++) { - // maybe union, HEAP_ENTRY and heap space share the same space - HEAP_ENTRY entries[0]; - u8 buf[4096 - 4]; // pads to 0x1000 -} HEAP; + // Check if there is overlap with already allocated slots + allocatedEntryStartOffset = gzHeap + heapStartOffset[(index2 * 2) + 1]; + allocatedEntryEndOffset = gzHeap + heapStartOffset[(index2 * 2) + 2]; + + if ((allocatedEntryStartOffset <= candidateSlotStartOffset && + candidateSlotStartOffset <= allocatedEntryEndOffset)) { + slotFound = FALSE; + break; + } + + if ((allocatedEntryStartOffset <= candidateSlotEndOffset && + candidateSlotEndOffset <= allocatedEntryEndOffset)) { + slotFound = FALSE; + break; + } + + if ((allocatedEntryStartOffset <= candidateSlotStartOffset && + candidateSlotEndOffset <= allocatedEntryEndOffset) || + (candidateSlotStartOffset <= allocatedEntryStartOffset && + allocatedEntryEndOffset <= candidateSlotEndOffset)) { + slotFound = FALSE; + break; + } + } + + if (!slotFound) { + index1 = 0; + // Start searching for candidate slot from the left side of the heap buffer. + do { + candidateSlotEndOffset = gzHeap + heapStartOffset[(index1 * 2) + 1]; + candidateSlotStartOffset = candidateSlotEndOffset - size; + slotFound = FALSE; + + // Ensure that the candidate slot doesn't collide with heap offsets section + if (candidateSlotStartOffset >= (u8*)(2 + (u32)heapStartOffset + (numEntries << 2) + 4)) { + slotFound = TRUE; + + // Check if there is overlap with already allocated slots + for (index2 = 0; index2 < numEntries; index2++) { + + allocatedEntryStartOffset = gzHeap + heapStartOffset[(index2 * 2) + 1]; + allocatedEntryEndOffset = gzHeap + heapStartOffset[(index2 * 2) + 2]; + + if ((allocatedEntryStartOffset <= candidateSlotStartOffset && + candidateSlotStartOffset < allocatedEntryEndOffset)) { + slotFound = FALSE; + break; + } + + if ((allocatedEntryStartOffset < candidateSlotEndOffset && + candidateSlotEndOffset <= allocatedEntryEndOffset)) { + slotFound = FALSE; + break; + } + + if ((allocatedEntryStartOffset <= candidateSlotStartOffset && + candidateSlotEndOffset <= allocatedEntryEndOffset) || + (candidateSlotStartOffset <= allocatedEntryStartOffset && + allocatedEntryEndOffset <= candidateSlotEndOffset)) { + slotFound = FALSE; + break; + } + } + if (slotFound) { + break; + } + } + } while ((index1 = (u16)(index1 + 1)) < numEntries); + } + if (!slotFound) + return 0; + + // Register successful allocation + *(u16*)(gUnk_02035542 + (numEntries << 2)) = candidateSlotStartOffset - (gUnk_02035542 - 2); + *(u16*)(gUnk_02035542 + (numEntries << 2) + 2) = candidateSlotStartOffset - (gUnk_02035542 - 2) + size; + *(u16*)(gUnk_02035542 - 2) = numEntries + 1; + MemClear(candidateSlotStartOffset, size); + return candidateSlotStartOffset; +} void zFree(void* ptr) { u32 uVar1; @@ -627,69 +715,71 @@ bool32 IsRoomVisited(TileEntity* tileEntity, u32 bank) { return FALSE; } -void sub_0801DFB4(Entity* entity, u32 textIndex, u32 a3, u32 a4) { +void InitializeFuseInfo(Entity* entity, u32 textIndex, u32 cancelledTextIndex, u32 fusingTextIndex) { MemClear(&gFuseInfo, sizeof(gFuseInfo)); gFuseInfo.textIndex = textIndex; - gFuseInfo._8 = a3; - gFuseInfo._a = a4; - gFuseInfo.ent = entity; + gFuseInfo.cancelledTextIndex = cancelledTextIndex; + gFuseInfo.fusingTextIndex = fusingTextIndex; + gFuseInfo.entity = entity; gFuseInfo.kinstoneId = gPossibleInteraction.kinstoneId; if (entity != NULL) { gFuseInfo.prevUpdatePriority = entity->updatePriority; entity->updatePriority = 2; } - gFuseInfo._0 = 0; + gFuseInfo.fusionState = FUSION_STATE_0; } -u32 sub_0801E00C(void) { - gUnk_080C9CAC[gFuseInfo.action](); - return gFuseInfo._0; +// returns the fusion state +u32 PerformFuseAction(void) { + gFuseActions[gFuseInfo.action](); + return gFuseInfo.fusionState; } -void sub_0801E02C(void) { +void Fuse_Action0(void) { MessageFromFusionTarget(gFuseInfo.textIndex); - gFuseInfo._0 = 3; + gFuseInfo.fusionState = FUSION_STATE_3; gFuseInfo.action = 1; } -void sub_0801E044(void) { +void Fuse_Action1(void) { if ((gMessage.doTextBox & 0x7F) == 0) { MenuFadeIn(4, 0); - gFuseInfo._0 = 4; + gFuseInfo.fusionState = FUSION_STATE_4; gFuseInfo.action = 2; SoundReq(SFX_6B); } } -void sub_0801E074(void) { - u32 tmp; - switch (gFuseInfo._0) { - case 5: - tmp = gFuseInfo._8; +// Waits until FUSION_STATE_5 or FUSION_STATE_6 is reached and displays the corresponding message. +void Fuse_Action2(void) { + u32 textIndex; + switch (gFuseInfo.fusionState) { + case FUSION_STATE_5: + textIndex = gFuseInfo.cancelledTextIndex; break; - case 6: - tmp = gFuseInfo._a; + case FUSION_STATE_6: + textIndex = gFuseInfo.fusingTextIndex; break; default: return; } - MessageFromFusionTarget(tmp); + MessageFromFusionTarget(textIndex); gFuseInfo.action = 3; } -void sub_0801E0A0(void) { +void Fuse_Action3(void) { if ((gMessage.doTextBox & 0x7f) == 0) { - if (gFuseInfo.ent != NULL) { - gFuseInfo.ent->updatePriority = gFuseInfo.prevUpdatePriority; + if (gFuseInfo.entity != NULL) { + gFuseInfo.entity->updatePriority = gFuseInfo.prevUpdatePriority; } - gFuseInfo._0 = gFuseInfo._0 == 6 ? 2 : 1; + gFuseInfo.fusionState = gFuseInfo.fusionState == FUSION_STATE_6 ? FUSION_STATE_2 : FUSION_STATE_1; } } void MessageFromFusionTarget(u32 textIndex) { if (textIndex != 0) { - if (gFuseInfo.ent != NULL) { - MessageNoOverlap(textIndex, gFuseInfo.ent); + if (gFuseInfo.entity != NULL) { + MessageNoOverlap(textIndex, gFuseInfo.entity); } else { MessageFromTarget(textIndex); } @@ -798,46 +888,159 @@ void sub_0801E290(u32 param_1, u32 param_2, u32 count) { } } -ASM_FUNC("asm/non_matching/common/sub_0801E31C.inc", void sub_0801E31C(u32 a1, u32 a2, u32 a3, u32 a4)); +void sub_0801E31C(u32 sp00, u32 sp04, s32 r10, s32 r9) { + u16 sp1c, sp1c2; + u16 kk, kk2; + u16 uVar2; + s32 r5; + s32 r6; + s32 r7; + s32 r8; // the lower one of param3 and param4 -ASM_FUNC("asm/non_matching/common/sub_0801E49C.inc", void sub_0801E49C(u32 a1, u32 a2, u32 a3, u32 a4)); + MemClear(&gUnk_02017AA0[gUnk_03003DE4[0]], 0xa00); + if (r10 < r9) { + r6 = 0; + r7 = r8 = r10; + r5 = 3 - r8 * 2; -void sub_0801E64C(s32 param_1, s32 param_2, s32 param_3, s32 param_4, s32 param_5) { - s32 sVar1; - s32* ptr = (s32*)gUnk_02018EE0; - FORCE_REGISTER(s32 tmp, r1); - - if ((0 <= param_2 || 0 <= param_4) && (param_2 < 0xa0 || (param_4 < 0xa0))) { - if (param_2 > param_4) { - SWAP(param_2, param_4, tmp); - SWAP(param_1, param_3, tmp); + while (r6 <= r7) { + sp1c = Div(r9 * r6, r10); + kk = Div(r9 * r7, r10); + // TODO: Fix data type in declaration. There shouldn't be a need to cast this. + ((u32*)gUnk_02018EE0)[r6] = kk; + ((u32*)gUnk_02018EE0)[r7] = sp1c; + if (r5 < 0) { + r5 += 6 + r6 * 4; + r6++; + } else { + r5 += 10 + (r6 - r7) * 4; + r7--; + r6++; + } } - if (param_2 != param_4) { - sVar1 = Div((param_3 - param_1) * 0x10000, param_4 - param_2); - if (param_2 < 0) { - param_1 += (sVar1 * -param_2) >> 0x10; - param_2 = 0; + } else { + r6 = 0; + r7 = r8 = r9; + r5 = 3 - r8 * 2; + + while (r6 <= r7) { + sp1c2 = Div(r10 * r6, r9); + kk2 = Div(r10 * r7, r9); + // TODO: Fix data type in declaration. There shouldn't be a need to cast this. + ((u32*)gUnk_02018EE0)[r6] = kk2; + ((u32*)gUnk_02018EE0)[r7] = sp1c2; + if (r5 < 0) { + r5 += 6 + r6 * 4; + r6++; + } else { + r5 += 10 + (r6 - r7) * 4; + r7--; + r6++; } - if (0x9f < param_4) { - param_4 = 0x9f; - } - param_3 = param_1 << 0x10; - ptr += param_2 * 3 + param_5; - do { - if (param_1 < 0) { - param_1 = 0; - } - if (0xf0 < param_1) { - param_1 = 0xf0; - } - *ptr = param_1; - param_3 += sVar1; - param_1 = param_3 >> 0x10; - param_2++; - ptr += 3; - } while (param_2 <= param_4); } } + sub_0801E290(sp00, sp04, r8); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0]], (u16*)REG_ADDR_WIN0H, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); +} + +void sub_0801E49C(s32 baseX, s32 baseY, s32 radius, u32 baseAngle) { + u8* ptr2; + u32* ptr1; + u32 angle; + s32 x1, x2, x3, y1, y2, y3; + + MemFill16(0xffff, gUnk_02018EE0, 0x780); + angle = (baseAngle - 0x40) & 0xff; + x1 = baseX + (gSineTable[angle + 0x40] * radius >> 8); + y1 = baseY + (gSineTable[angle] * radius >> 8); + angle = (baseAngle + 0x68) & 0xff; + x2 = baseX + (gSineTable[angle + 0x40] * radius >> 8); + y2 = baseY + (gSineTable[angle] * radius >> 8); + angle = (baseAngle - 0xe8) & 0xff; + x3 = baseX + (gSineTable[angle + 0x40] * radius >> 8); + y3 = baseY + (gSineTable[angle] * radius >> 8); + sub_0801E64C(x1, y1, x2, y2, 0); + sub_0801E64C(x1, y1, x3, y3, 1); + sub_0801E64C(x2, y2, x3, y3, 2); + MemClear(gUnk_02017AA0[gUnk_03003DE4[0]].filler, 0xa00); + ptr1 = (u32*)gUnk_02018EE0; + ptr2 = gUnk_02017AA0[gUnk_03003DE4[0]].filler; + for (y1 = 0xa0; y1 > 0; y1--, ptr2 += 2) { + x1 = ptr1[0]; + x2 = ptr1[1]; + x3 = ptr1[2]; + ptr1 += 3; + if (x1 > x2) { + SWAP(x1, x2, y2); + } + if (x1 > x3) { + SWAP(x1, x3, y2); + } + if (x2 > x3) { + SWAP(x2, x3, y2); + } + if (x1 != 0xffffffff) { + ptr2[0] = x3; + ptr2[1] = x1; + } else { + if (x2 != x1) { + ptr2[0] = x3; + ptr2[1] = x2; + } else { + if (x3 != x1) { + ptr2[1] = x1; + ptr2[0] = x1; + } + } + } + } + SetVBlankDMA((u16*)(gUnk_02017AA0[gUnk_03003DE4[0]].filler), (u16*)REG_ADDR_WIN0H, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); +} + +void sub_0801E64C(s32 x1, s32 y1, s32 x2, s32 y2, s32 offset) { + // GBA Resolutions + const s32 MAX_X_COORD = 240; + const s32 MAX_Y_COORD = 160; + + s32 slope, preciseX, tmp; + s32* drawPtr = (s32*)gUnk_02018EE0; + + if ((y1 < 0 && y2 < 0) || (y1 >= MAX_Y_COORD && y2 >= MAX_Y_COORD)) + return; + + if (y1 > y2) { + SWAP(y1, y2, tmp); + SWAP(x1, x2, tmp); + } + + if (y1 == y2) + return; + + slope = Div((x2 - x1) * 0x10000, y2 - y1); + if (y1 < 0) { + x1 += (slope * -y1) >> 0x10; + y1 = 0; + } + if (y2 >= MAX_Y_COORD) { + y2 = MAX_Y_COORD - 1; + } + preciseX = x1 << 0x10; + drawPtr += y1 * 3 + offset; + do { + // Clamp x1 in range + x1 = x1 < 0 ? 0 : x1; + x1 = x1 < MAX_X_COORD ? x1 : MAX_X_COORD; + + *drawPtr = x1; + preciseX += slope; + x1 = preciseX >> 0x10; + y1++; + drawPtr += 3; + } while (y1 <= y2); } void NotifyFusersOnFusionDone(KinstoneId kinstoneId) { @@ -845,13 +1048,13 @@ void NotifyFusersOnFusionDone(KinstoneId kinstoneId) { u32 index; if (kinstoneId - 1 < 100) { for (index = 0; index < 0x80; index++) { - if (kinstoneId == gSave.fuserOffers[index]) { - gSave.fuserOffers[index] = KINSTONE_NEEDS_REPLACEMENT; + if (kinstoneId == gSave.kinstones.fuserOffers[index]) { + gSave.kinstones.fuserOffers[index] = KINSTONE_NEEDS_REPLACEMENT; } } - tmp = GetFuserId(gFuseInfo.ent); - if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == KINSTONE_NEEDS_REPLACEMENT)) { - gSave.fuserOffers[tmp] = KINSTONE_JUST_FUSED; + tmp = GetFuserId(gFuseInfo.entity); + if ((tmp - 1 < 0x7f) && (gSave.kinstones.fuserOffers[tmp] == KINSTONE_NEEDS_REPLACEMENT)) { + gSave.kinstones.fuserOffers[tmp] = KINSTONE_JUST_FUSED; } for (index = 0; index < 0x20; index++) { if (kinstoneId == gPossibleInteraction.candidates[index].kinstoneId) { @@ -870,17 +1073,17 @@ void AddKinstoneToBag(KinstoneId kinstoneId) { index = GetIndexInKinstoneBag(kinstoneId); if (index < 0) { index = 0; - while (gSave.kinstoneTypes[index] != KINSTONE_NONE) { + while (gSave.kinstones.types[index] != KINSTONE_NONE) { index++; } } if ((u32)index < 0x12) { - gSave.kinstoneTypes[index] = kinstoneId; - tmp = gSave.kinstoneAmounts[index] + 1; + gSave.kinstones.types[index] = kinstoneId; + tmp = gSave.kinstones.amounts[index] + 1; if (tmp > 99) { tmp = 99; } - gSave.kinstoneAmounts[index] = tmp; + gSave.kinstones.amounts[index] = tmp; } } } @@ -888,12 +1091,12 @@ void AddKinstoneToBag(KinstoneId kinstoneId) { void RemoveKinstoneFromBag(KinstoneId kinstoneId) { s32 idx = GetIndexInKinstoneBag(kinstoneId); if (idx >= 0) { - s32 next = gSave.kinstoneAmounts[idx] - 1; + s32 next = gSave.kinstones.amounts[idx] - 1; if (next <= 0) { - gSave.kinstoneTypes[idx] = KINSTONE_NONE; + gSave.kinstones.types[idx] = KINSTONE_NONE; next = 0; } - gSave.kinstoneAmounts[idx] = next; + gSave.kinstones.amounts[idx] = next; } } @@ -902,92 +1105,50 @@ u32 GetAmountInKinstoneBag(KinstoneId kinstoneId) { if (index < 0) { return 0; } - return gSave.kinstoneAmounts[index]; + return gSave.kinstones.amounts[index]; } u32 CheckKinstoneFused(KinstoneId kinstoneId) { if (kinstoneId - 1 >= 100) { return 0; } - return ReadBit(&gSave.fusedKinstones, kinstoneId); + return ReadBit(&gSave.kinstones.fusedKinstones, kinstoneId); } bool32 CheckFusionMapMarkerDisabled(KinstoneId kinstoneId) { if (kinstoneId - 1 >= 100) { return FALSE; } - return ReadBit(&gSave.fusionUnmarked, kinstoneId); + return ReadBit(&gSave.kinstones.fusionUnmarked, kinstoneId); } void SortKinstoneBag(void) { -#ifdef NON_MATCHING - u32 r5; + u32 i; - for (r5 = 0; r5 < 0x13; r5++) { - if (gSave.kinstoneAmounts[r5] == 0) { - gSave.kinstoneTypes[r5] = gSave.kinstoneAmounts[r5]; + KinstoneSave* ptr = &gSave.kinstones; + + for (i = 0; i < 19; i++) { + if (ptr->amounts[i] == 0) { + ptr->types[i] = 0; } } - gSave.kinstoneTypes[0x12] = 0; - gSave.kinstoneAmounts[0x12] = 0; + ptr->types[18] = 0; + ptr->amounts[18] = 0; - for (r5 = 0; r5 < 0x12; r5++) { - if ((gSave.kinstoneTypes[r5] - 0x65) > 0x10) { - MemCopy(&gSave.kinstoneTypes[r5 + 1], &gSave.kinstoneTypes[r5], 0x12 - r5); - MemCopy(&gSave.kinstoneAmounts[r5 + 1], &gSave.kinstoneAmounts[r5], 0x12 - r5); + for (i = 0; i < 18; i++) { + u32 t = ptr->types[i]; + if (t < 0x65 || t > 0x75) { + MemCopy(&ptr->types[i + 1], &ptr->types[i], 0x12 - i); + MemCopy(&ptr->amounts[i + 1], &ptr->amounts[i], 0x12 - i); } } -#else - u32 r0, r4, r5; - u32 new_var; - u8 *r1, *r2, *r3, *r6, *r7, *r8, *r9, *r10; - - new_var = 4; - r1 = &gSave.inventory[34]; - r5 = 0; - r2 = gSave.kinstoneTypes; -code0_0: - r0 = r2[0x13]; - r3 = &r1[4]; - r10 = r3; - if (r0 == 0) { - *r2 = r0; - } - r2++; - r5++; - if (r5 <= 0x12) - goto code0_0; - - r1[0x16] = 0; - r1[0x29] = 0; - r5 = 0; - r9 = &r1[0x17]; - r3 = &r1[0x18]; - r8 = r3; - r7 = &r1[new_var]; - r6 = &r1[5]; -code0_2: - r0 = r10[r5] - 0x65; - if (r0 > 0x10) { - MemCopy(r6, r7, 0x12 - r5); - MemCopy(r8, r9, 0x12 - r5); - } - r9++; - r8++; - r7++; - r6++; - r5++; - if (r5 <= 0x11) - goto code0_2; -#endif } - s32 GetIndexInKinstoneBag(KinstoneId kinstoneId) { u32 i; for (i = 0; i < 0x12; ++i) { - if (kinstoneId == gSave.kinstoneTypes[i]) + if (kinstoneId == gSave.kinstones.types[i]) return i; } return -1; @@ -1055,7 +1216,7 @@ void UpdateVisibleFusionMapMarkers(void) { #else if (sub_0807CB24(tmp, s->flag)) { #endif - WriteBit(&gSave.fusionUnmarked, kinstoneId); + WriteBit(&gSave.kinstones.fusionUnmarked, kinstoneId); } } } @@ -1076,8 +1237,8 @@ KinstoneId GetFusionToOffer(Entity* entity) { if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0 || fuserData[0] > gSave.global_progress) { return KINSTONE_NONE; } - offeredFusion = gSave.fuserOffers[fuserId]; - fuserProgress = gSave.fuserProgress[fuserId]; + offeredFusion = gSave.kinstones.fuserOffers[fuserId]; + fuserProgress = gSave.kinstones.fuserProgress[fuserId]; fuserFusionData = (u8*)(fuserProgress + (u32)fuserData); while (TRUE) { // loop through fusions for this fuser switch (offeredFusion) { @@ -1108,8 +1269,8 @@ KinstoneId GetFusionToOffer(Entity* entity) { } offeredFusion = KINSTONE_NEEDS_REPLACEMENT; // already completed, try next fusion in the list } - gSave.fuserOffers[fuserId] = offeredFusion; - gSave.fuserProgress[fuserId] = fuserProgress; + gSave.kinstones.fuserOffers[fuserId] = offeredFusion; + gSave.kinstones.fuserProgress[fuserId] = fuserProgress; randomMood = Random(); fuserStability = fuserData[1]; if (fuserStability <= randomMood % 100) { @@ -1619,11 +1780,11 @@ const DungeonFloorMetadata gDungeonFloorMetadatas[] = { { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, }; -void (*const gUnk_080C9CAC[])(void) = { - sub_0801E02C, - sub_0801E044, - sub_0801E074, - sub_0801E0A0, +void (*const gFuseActions[])(void) = { + Fuse_Action0, + Fuse_Action1, + Fuse_Action2, + Fuse_Action3, }; // TODO merge diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 072ca4e0..67e7ad64 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -445,7 +445,7 @@ void AcroBandit_Type1Action4(Entity* this) { } } - if (this->direction & 0xf) + if (this->direction & (0x3 | DirectionEast | DIR_DIAGONAL)) this->spriteSettings.flipX = (this->direction >> 4 ^ 1); ProcessMovement0(this); @@ -486,7 +486,7 @@ void AcroBandit_Type1Action6(Entity* this) { this->action = 7; dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2]; this->direction = dir; - if (dir >= 0x10) { + if (dir >= DirectionSouth) { this->spriteSettings.flipX = 1; } else { this->spriteSettings.flipX = 0; @@ -570,7 +570,7 @@ static void sub_080322E8(Entity* this) { } } else { u8 tmp = this->direction; - if (tmp & 0xF) { + if (tmp & (0x3 | DirectionEast | DIR_DIAGONAL)) { tmp >>= 4; tmp ^= 1; if (tmp != this->spriteSettings.flipX) { diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index ace73b7f..451d9aea 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -105,7 +105,8 @@ void sub_080218CC(Entity* this) { if (this->subAction == 0) { this->subAction = 1; this->spriteSettings.draw = 1; - this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; + this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); this->speed = 0x100; this->zVelocity = Q_16_16(1.125); } @@ -244,9 +245,9 @@ void sub_08021B64(Entity* this) { this->zVelocity = Q_16_16(1.0); ((u8*)&this->field_0x86)[1] = 0; if (gPlayerEntity.direction != 0xff) { - this->direction = 0x10 ^ gPlayerEntity.direction; + this->direction = DirectionSouth ^ gPlayerEntity.direction; } else { - this->direction = (gPlayerEntity.animationState << 2) ^ 0x10; + this->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth; } InitializeAnimation(this, 5); } else { diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 86fe70d0..5f8306bd 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -10,18 +10,20 @@ #include "room.h" #include "object.h" +#define DIR_NOT_MOVING_CHECK 0x80 + void BladeTrap(Entity* this) { if (this->action == 0) { this->action = 1; this->child = GetCurrentRoomProperty(this->type); UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); } - if (!(this->direction & 0x80)) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(this); } if (!(--this->field_0x74.HWORD)) { - if (!(this->direction & 0x80)) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { EnqueueSFX(SFX_METAL_CLINK); } UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index bfc8f092..ad7ceff0 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -62,7 +62,7 @@ void Bobomb_OnCollision(Entity* this) { this->zVelocity = Q_16_16(1.5); this->speed = 0; this->field_0x80.HALF.HI = 1; - InitializeAnimation(this, this->direction >> 4 | 6); + InitializeAnimation(this, this->direction >> 4 | IdleWest); break; } } @@ -123,7 +123,7 @@ void sub_0802C83C(Entity* this) { } else { this->field_0x82.HALF.LO = 2; this->timer = 120; - InitializeAnimation(this, (this->direction >> 4) | 6); + InitializeAnimation(this, (this->direction >> 4) | IdleWest); COLLISION_OFF(this); this->hitType = 0x6e; } @@ -147,7 +147,7 @@ void sub_0802C8D8(Entity* this) { this->action = 1; this->timer = 60; this->subtimer = 0; - this->direction = (Random() & 0x18) | 4; + this->direction = (Random() & 0x18) | DIR_DIAGONAL; this->carryFlags = 0; this->gustJarFlags = 0x12; this->field_0x82.HALF.LO = 0; @@ -163,7 +163,7 @@ void sub_0802C91C(Entity* this) { if (this->field_0x82.HALF.LO) { if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); - InitializeAnimation(this, (this->direction >> 4) | 2); + InitializeAnimation(this, (this->direction >> 4) | IdleEast); } if (--this->timer == 0) { sub_0802CBC4(this); @@ -180,7 +180,7 @@ void sub_0802C91C(Entity* this) { } if (--this->timer == 0) { this->timer = 60; - this->direction = (this->direction + 8) & 0x1c; + this->direction = (this->direction + 8) & (DirectionWest | DIR_DIAGONAL); InitializeAnimation(this, this->direction >> 4); } } @@ -196,7 +196,7 @@ void sub_0802C9D0(Entity* this) { this->spritePriority.b1 = 0; this->field_0x82.HALF.HI = 1; sub_0802CC18(this); - InitializeAnimation(this, (this->direction >> 4) | 6); + InitializeAnimation(this, (this->direction >> 4) | IdleWest); GetNextFrame(this); } @@ -210,7 +210,7 @@ void sub_0802CA10(Entity* this) { } } else { this->field_0x82.HALF.HI = 2; - this->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c; + this->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest); sub_0802CC18(this); GetNextFrame(this); } @@ -234,8 +234,8 @@ void sub_0802CA94(Entity* this) { this->speed = 0; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; - this->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c; - InitializeAnimation(this, (this->direction >> 4) | 6); + this->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL); + InitializeAnimation(this, (this->direction >> 4) | IdleWest); } void sub_0802CAF8(Entity* this) { @@ -264,7 +264,7 @@ void sub_0802CB68(Entity* this) { this->action = 1; this->subAction = 0; this->direction = Random() & 0x18; - this->direction |= 4; + this->direction |= IdleSouth; COLLISION_ON(this); if (this->field_0x82.HALF.LO) { this->timer = 200; diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index c8d4a14b..939fcf13 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -141,10 +141,10 @@ void sub_0802A9A8(Entity* this) { this->field_0x82.HWORD = 1; if (this->field_0x80.HALF.LO) { this->x.HALF.HI = gRoomControls.scroll_x - 0x10; - this->direction = 8; + this->direction = DirectionEast; } else { this->x.HALF.HI = gRoomControls.scroll_x + 0x100; - this->direction = 0x18; + this->direction = DirectionWest; } this->y.HALF.HI = gRoomControls.scroll_y + 0x40; this->timer = 128; @@ -221,7 +221,7 @@ void sub_0802AAC0(Entity* this) { #ifndef EU this->field_0x78.HALF.LO = 0; this->field_0x78.HALF.HI = 4; - this->direction = 0xff; + this->direction = DIR_NONE; #endif InitializeAnimation(this, 0); } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index cce55c43..e87d5588 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -25,14 +25,14 @@ void sub_08029078(Entity*); void sub_080290E0(Entity*, u32); void sub_080290FC(Entity*); bool32 sub_0802915C(Entity*); -bool32 sub_080291DC(Entity*); +bool32 BusinessScrub_CheckRefillFitsBag(Entity*); void sub_0802922C(Entity*); void sub_0802925C(Entity*); extern const struct SalesOffering gUnk_080CC954[]; extern const u8 kinstoneTypes[]; extern void (*const BusinessScrub_Functions[])(Entity*); -extern void (*const gUnk_080CC9E0[])(Entity*); +extern void (*const BusinessScrub_Actions[])(Entity*); extern const u8 gUnk_080CCA04[]; struct SalesOffering { @@ -42,8 +42,8 @@ struct SalesOffering { u16 field_0x4; u16 field_0x6; u8 offeredItem; /**< @see Item */ - u8 field_0x9; - u16 field_0xa; + u8 item_subtype; + u16 local_flag; }; void BusinessScrub(Entity* this) { @@ -51,7 +51,7 @@ void BusinessScrub(Entity* this) { } void BusinessScrub_OnTick(Entity* this) { - gUnk_080CC9E0[this->action](this); + BusinessScrub_Actions[this->action](this); } void BusinessScrub_OnCollision(Entity* this) { @@ -75,12 +75,12 @@ void BusinessScrub_OnGrabbed(Entity* this) { /* ... */ } -void sub_08028994(Entity* this) { +void BusinessScrub_Action0(Entity* this) { this->subtimer = 0; this->field_0x78.HWORD = this->x.HALF.HI; this->field_0x7a.HWORD = this->y.HALF.HI; this->animationState = 0; - this->direction = 0x10; + this->direction = DirectionSouth; sub_08028E9C(this); if ((*(u8*)this->field_0x7c.WORD & 1) || CheckFlags(this->field_0x86.HWORD)) { this->action = 4; @@ -97,7 +97,7 @@ void sub_08028994(Entity* this) { } } -void sub_08028A48(Entity* this) { +void BusinessScrub_Action1(Entity* this) { if (this->timer != 0) { this->timer--; } else if (sub_08028F98(this, 0)) { @@ -107,7 +107,7 @@ void sub_08028A48(Entity* this) { } } -void sub_08028A74(Entity* this) { +void BusinessScrub_Action2(Entity* this) { u32 unk; GetNextFrame(this); @@ -185,7 +185,7 @@ void sub_08028A74(Entity* this) { } } -void sub_08028BC4(Entity* this) { +void BusinessScrub_Action3(Entity* this) { Entity* iVar1; switch (this->subAction) { @@ -227,7 +227,7 @@ void sub_08028BC4(Entity* this) { extern void sub_0804AA1C(Entity*); void sub_08028F0C(Entity*); -void sub_08028C84(Entity* this) { +void BusinessScrub_Action4(Entity* this) { if (--this->timer == 0) { this->timer = 48; if (this->subtimer) { @@ -244,21 +244,21 @@ void sub_08028C84(Entity* this) { sub_08028F0C(this); } -void sub_08028CE8(Entity* this) { +void BusinessScrub_Action5(Entity* this) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; u32 subtype; if ((gMessage.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { if (offer->price <= gSave.stats.rupees) { - if (sub_080291DC(this)) { + if (BusinessScrub_CheckRefillFitsBag(this)) { /* Bag full. */ MessageFromTarget(TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x04)); SetPlayerControl(0); } else { ModRupees(-offer->price); switch (offer->field_0x0 >> 2) { - case 0: - subtype = offer->field_0x9; + case 0: // random kinstone + subtype = offer->item_subtype; if (subtype == KINSTONE_RANDOM) { subtype = kinstoneTypes[Random() & 7]; } @@ -273,13 +273,13 @@ void sub_08028CE8(Entity* this) { SetLocalFlag(KS_B06); #endif return; - case 1: - CreateItemEntity(offer->offeredItem, offer->field_0x9, 0); + case 1: // refill, bottle, specific kinstone + CreateItemEntity(offer->offeredItem, offer->item_subtype, 0); this->timer = 4; sub_0802922C(this); return; - case 2: - CreateItemEntity(offer->offeredItem, offer->field_0x9, 0); + case 2: // grip ring + CreateItemEntity(offer->offeredItem, offer->item_subtype, 0); this->timer = 8; sub_0802922C(this); return; @@ -298,7 +298,7 @@ void sub_08028CE8(Entity* this) { sub_080290E0(this, 0); } -void sub_08028DE8(Entity* this) { +void BusinessScrub_Action6(Entity* this) { if (gPlayerEntity.action == PLAYER_ITEMGET) { if (this->field_0x80.HALF.HI == 0) { SetPlayerControl(1); @@ -316,15 +316,15 @@ void sub_08028DE8(Entity* this) { } } -void sub_08028E40(Entity* this) { +void BusinessScrub_Action7(Entity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; this->action = 4; this->subAction = gMessage.doTextBox & 0x7f; this->timer = 1; - if (CheckLocalFlag(offer->field_0xa) == 0) { - SetLocalFlag(offer->field_0xa); + if (!CheckLocalFlag(offer->local_flag)) { + SetLocalFlag(offer->local_flag); } SetPlayerControl(0); } @@ -332,7 +332,7 @@ void sub_08028E40(Entity* this) { GetNextFrame(this); } -void sub_08028E84(Entity* this) { +void BusinessScrub_Action8(Entity* this) { if (UpdateFuseInteraction(this)) { this->action = 4; this->timer = 1; @@ -344,7 +344,7 @@ bool32 sub_08029198(const struct SalesOffering*); void sub_08028E9C(Entity* this) { const struct SalesOffering* offer = &gUnk_080CC954[this->type]; if (sub_08029198(offer) && (offer->field_0x0 & 2)) { - offer = &gUnk_080CC954[offer->field_0xa]; + offer = &gUnk_080CC954[offer->local_flag]; } this->field_0x7c.WORD = (u32)offer; this->field_0x80.HALF.LO = 0; @@ -353,21 +353,21 @@ void sub_08028E9C(Entity* this) { 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]; + offer = &gUnk_080CC954[offer->local_flag]; this->field_0x7c.WORD = (u32)offer; } } void sub_08028F0C(Entity* this) { - if (this->interactType == 2) { + if (this->interactType == INTERACTION_FUSE) { this->action = 8; - this->interactType = 0; - sub_0806F118(this); - } else if (this->interactType != 0) { + this->interactType = INTERACTION_NONE; + InitializeNPCFusion(this); + } else if (this->interactType != INTERACTION_NONE) { u16 dialog; const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; - this->interactType = 0; + this->interactType = INTERACTION_NONE; sub_0804AA1C(this); this->direction = (GetAnimationState(this) << 3); sub_080290E0(this, 3); @@ -456,8 +456,8 @@ void sub_080290FC(Entity* this) { if (this->timer != 0) { this->timer--; if ((this->timer < 16) && ((this->timer & 1) == 0)) { - s32 sVar3 = ((this->direction & 0x10) != 0) ? -1 : 1; - if ((this->direction & 8) != 0) { + s32 sVar3 = (this->direction & DirectionSouth) ? -1 : 1; + if (this->direction & DirectionEast) { this->x.HALF.HI += ((this->timer & 8) != 0) ? -sVar3 : sVar3; } else { this->y.HALF.HI += ((this->timer & 8) != 0) ? sVar3 : -sVar3; @@ -502,7 +502,7 @@ bool32 sub_08029198(const struct SalesOffering* offer) { return 0; } } else { - tmp = CheckLocalFlag(offer->field_0xa); + tmp = CheckLocalFlag(offer->local_flag); } if (tmp == 0) { @@ -512,7 +512,7 @@ bool32 sub_08029198(const struct SalesOffering* offer) { return TRUE; } -bool32 sub_080291DC(Entity* this) { +bool32 BusinessScrub_CheckRefillFitsBag(Entity* this) { const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; switch (offer->offeredItem) { @@ -540,7 +540,7 @@ void sub_0802922C(Entity* this) { SetGlobalFlag(AKINDO_BOTTLE_SELL); // It only matters here that ITEM_BOMBS10 is here and some item that is higher // Not sure about the original code - case ITEM_ARROWS10: + case ITEM_ARROWS30: case ITEM_BOMBS10: default: sub_080290E0(this, 3); @@ -564,18 +564,18 @@ void sub_08029270(Entity* this) { // clang-format off const struct SalesOffering gUnk_080CC954[] = { - {0x06, 0x00, 0xffff, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0f), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x09, 0xff, 0x0001}, - {0x04, 0x00, 0x001e, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0e), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x6f, 0xff, 0xffff}, - {0x04, 0x00, 0x001e, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0b), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x6c, 0xff, 0xffff}, - {0x08, 0x00, 0x0028, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0c), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x11), 0x44, 0xff, 0xffff}, - {0x00, 0x00, 0x0064, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0d), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x5c, 0xff, 0xffff}, - {0x04, 0x00, 0x0014, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x10), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x11), 0x1c, 0xff, 0xffff}, + {0x06, 0x00, 0xffff, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0f), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_BOW, 0xff, 0x0001}, + {0x04, 0x00, 30, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0e), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_ARROWS30, 0xff, 0xffff}, + {0x04, 0x00, 30, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0b), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_BOMBS10, 0xff, 0xffff}, + {0x08, 0x00, 40, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0c), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x11), ITEM_GRIP_RING, 0xff, 0xffff}, + {0x00, 0x00, 100, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0d), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_KINSTONE, 0xff, 0xffff}, + {0x04, 0x00, 20, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x10), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x11), ITEM_BOTTLE1, 0xff, 0xffff}, {0x0c, 0x00, 0xffff, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x12), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x13), 0xff, 0xff, 0x0046}, - {0x04, 0x00, 0x0064, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x13), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x5c, 0x75, 0xffff}, + {0x04, 0x00, 100, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x13), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_KINSTONE, 0x75, 0xffff}, #ifdef EU - {0x00, 0x00, 0x0064, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0d), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x5c, 0xff, 0xffff}, + {0x00, 0x00, 100, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0d), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_KINSTONE, 0xff, 0xffff}, #else - {0x00, 0x00, 0x00C8, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0d), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), 0x5c, 0xff, 0xffff}, + {0x00, 0x00, 200, TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x0d), TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02), ITEM_KINSTONE, 0xff, 0xffff}, #endif }; @@ -590,16 +590,16 @@ void (*const BusinessScrub_Functions[])(Entity*) = { BusinessScrub_OnGrabbed, }; -void (*const gUnk_080CC9E0[])(Entity*) = { - sub_08028994, - sub_08028A48, - sub_08028A74, - sub_08028BC4, - sub_08028C84, - sub_08028CE8, - sub_08028DE8, - sub_08028E40, - sub_08028E84, +void (*const BusinessScrub_Actions[])(Entity*) = { + BusinessScrub_Action0, + BusinessScrub_Action1, + BusinessScrub_Action2, + BusinessScrub_Action3, + BusinessScrub_Action4, + BusinessScrub_Action5, + BusinessScrub_Action6, + BusinessScrub_Action7, + BusinessScrub_Action8, }; const u8 gUnk_080CCA04[] = { diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index ba7349e9..657d9d0b 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -66,7 +66,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) { super->subtimer = 0; this->unk_78 = super->x.HALF.HI; this->unk_7a = super->y.HALF.HI; - super->animationState = 0; + super->animationState = IdleNorth; super->direction = 0x10; super->action = 5; super->timer = 120; @@ -75,7 +75,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) { sub_08046030(this, 0); sub_08095C48(super); StartCutscene(super, script_BusinessScrubIntro); - sub_0807DD50(super); + InitScriptForNPC(super); } void sub_08045CA4(BusinessScrubPrologueEntity* this) { @@ -200,7 +200,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) { } void sub_08045EC8(BusinessScrubPrologueEntity* this) { - sub_0807DD94(super, 0); + ExecuteScriptAndHandleAnimation(super, NULL); } void sub_08045ED4(BusinessScrubPrologueEntity* this) { diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 895c13f1..40f365c2 100644 --- a/src/enemy/chaser.c +++ b/src/enemy/chaser.c @@ -34,7 +34,7 @@ void sub_0802B540(Entity* this) { this->timer--; } else { u32 direction = sub_0804A024(this, 1, 0xc); - if (direction != 0xff) { + if (direction != DIR_NONE) { this->action = 2; this->speed = 0x40; this->direction = direction; diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 79c6eeaa..c53a1483 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -554,7 +554,7 @@ void sub_080262A8(ChuchuBossEntity* this) { super->timer = 1; sub_080276F4(super, 6, 1); if (super->type2 == 0) { - gPlayerState.animation = 0x104; + gPlayerState.animation = ANIM_WALK; this->unk_84->unk_03 = 1; } else { this->unk_7c = 0; diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index ca4f3585..6611126b 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -119,10 +119,11 @@ void sub_08022AA4(Entity* this) { if (!sub_08049FA0(this) && (rand >> 8) & 3) { this->direction = sub_08049EE4(this); } else { - this->direction = (rand >> 0x10) & 0x1f; + this->direction = + (rand >> 0x10) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } - if (this->direction & 0xf) + if (this->direction & (0x3 | DirectionEast | DIR_DIAGONAL)) this->spriteSettings.flipX = (this->direction >> 4) ^ 1; } @@ -144,7 +145,7 @@ void sub_08022B44(Entity* this) { this->zVelocity = Q_16_16(0.75); this->direction = GetFacingDirection(this, &gPlayerEntity); - if (this->direction & 0xf) + if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) this->spriteSettings.flipX = (this->direction >> 4) ^ 1; EnqueueSFX(SFX_VO_CHEEP); diff --git a/src/enemy/dust.c b/src/enemy/dust.c index ead2273a..9b2bec8a 100644 --- a/src/enemy/dust.c +++ b/src/enemy/dust.c @@ -37,9 +37,9 @@ typedef struct { #define DUST_SPRITE_INDEX 0x1eb #endif -void sub_08044134(DustEntity*); -void sub_0804414C(DustEntity*); -void sub_0804415C(DustEntity*); +void Dust_OnTick(DustEntity*); +void Dust_OnCollision(DustEntity*); +void Dust_OnGrabbed(DustEntity*); void sub_080441E0(DustEntity*); void sub_080442A0(DustEntity*); void sub_080441CC(DustEntity*); @@ -56,15 +56,15 @@ extern void* sub_080AD8F0(u32, u32); extern const s8 gUnk_08126EE4[]; void (*const Dust_Functions[])(Entity*) = { - (EntityActionPtr)sub_08044134, (EntityActionPtr)sub_0804414C, GenericKnockback, GenericDeath, GenericConfused, - (EntityActionPtr)sub_0804415C, + (EntityActionPtr)Dust_OnTick, (EntityActionPtr)Dust_OnCollision, GenericKnockback, GenericDeath, GenericConfused, + (EntityActionPtr)Dust_OnGrabbed, }; void Dust(Entity* this) { Dust_Functions[GetNextFunction(this)](this); } -void sub_08044134(DustEntity* this) { +void Dust_OnTick(DustEntity* this) { static void (*const Dust_Actions[])(DustEntity*) = { sub_080441E0, sub_080442A0, @@ -72,11 +72,11 @@ void sub_08044134(DustEntity* this) { Dust_Actions[super->action](this); } -void sub_0804414C(DustEntity* this) { +void Dust_OnCollision(DustEntity* this) { EnemyFunctionHandlerAfterCollision(super, Dust_Functions); } -void sub_0804415C(DustEntity* this) { +void Dust_OnGrabbed(DustEntity* this) { static void (*const Dust_SubActions[])(DustEntity*) = { sub_080441BC, sub_080441C4, diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index 7e0ee931..9fe5532b 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -108,7 +108,7 @@ void Enemy4D_Init(Enemy4DEntity* this) { super->child = projectile; COLLISION_ON(super); super->spriteSettings.draw = TRUE; - super->animationState = 2; + super->animationState = IdleEast; this->unk_7b = 0; this->unk_7c = 0; this->unk_7e = 0x28; diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index 7e47330c..dceedf13 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -75,51 +75,49 @@ void Enemy50_OnTick(Enemy50Entity* this) { Enemy50_Actions[super->action](this); } -void sub_08040B9C(Enemy50Entity* this) { +void Enemy50_OnCollision(Enemy50Entity* this) { if (super->action == 8 || super->action == 9) { super->animationState = 0xff; InitializeAnimation(super, (super->knockbackDirection >> 4 ^ 1) + 1); sub_08041134(this); sub_0803F6EC(this); } - if (super->hitType == 0x25) { + if (super->hitType == 0x25 && super->contactFlags == 0x80) { + super->action = 8; + InitializeAnimation(super, 3); + } else { if (super->contactFlags == 0x80) { - super->action = 8; - InitializeAnimation(super, 3); - goto _08040C9C; + this->unk_7c = 0x78; + sub_08041128(this); } - } else if (super->contactFlags == 0x80) { - this->unk_7c = 0x78; - sub_08041128(this); - } - if (super->contactFlags == 0x9d) { - super->zVelocity = Q_16_16(1.5); - } - if (super->confusedTime != 0) { - super->animationState = super->knockbackDirection >> 4; - InitializeAnimation(super, super->animationState + 7); - Create0x68FX(super, FX_STARS); - } - if (super->health != this->unk_7a) { - if (super->type == 0) { + if (super->contactFlags == 0x9d) { + super->zVelocity = Q_16_16(1.5); + } + if (super->confusedTime != 0) { super->animationState = super->knockbackDirection >> 4; InitializeAnimation(super, super->animationState + 7); - } else { - if (super->iframes > 0) { - *((u8*)&super->iframes) |= 0x80; - } - super->flags |= 0x80; - super->health = 0xff; - super->action = 0xa; - super->timer = 60; + Create0x68FX(super, FX_STARS); + } + if (super->health != this->unk_7a) { + if (super->type == 0) { + super->animationState = super->knockbackDirection >> 4; + InitializeAnimation(super, super->animationState + 7); + } else { + if (super->iframes > 0) { + *((u8*)&super->iframes) |= 0x80; + } + super->flags |= 0x80; + super->health = 0xff; + super->action = 0xa; + super->timer = 60; + } + this->unk_7a = super->health; } - this->unk_7a = super->health; } -_08040C9C: EnemyFunctionHandlerAfterCollision(super, Enemy50_Functions); } -void sub_08040CAC(Enemy50Entity* this) { +void Enemy50_OnKnockback(Enemy50Entity* this) { GetNextFrame(super); GenericKnockback2(super); if (super->type == 0) { @@ -137,7 +135,7 @@ void sub_08040CAC(Enemy50Entity* this) { } } -void sub_08040D30(Enemy50Entity* this) { +void Enemy50_OnConfused(Enemy50Entity* this) { if (super->animIndex != 7 && super->animIndex != 8) { InitializeAnimation(super, super->animationState + 7); } @@ -153,7 +151,7 @@ void sub_08040D30(Enemy50Entity* this) { } } -void sub_08040D90(Enemy50Entity* this) { +void Enemy50_OnGrabbed(Enemy50Entity* this) { if (sub_0806F520(super)) { Enemy50_SubActions[super->subAction](this); } else { @@ -436,7 +434,8 @@ bool32 sub_08041300(Enemy50Entity* this) { #endif void (*const Enemy50_Functions[])(Enemy50Entity*) = { - Enemy50_OnTick, sub_08040B9C, sub_08040CAC, (void (*)(Enemy50Entity*))GenericDeath, sub_08040D30, sub_08040D90, + Enemy50_OnTick, Enemy50_OnCollision, Enemy50_OnKnockback, (void (*)(Enemy50Entity*))GenericDeath, + Enemy50_OnConfused, Enemy50_OnGrabbed, }; void (*const Enemy50_Actions[])(Enemy50Entity*) = { Enemy50_Init, Enemy50_Action1, Enemy50_Action2, Enemy50_Action3, Enemy50_Action4, Enemy50_Action5, diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index 40cc1eca..fe4fbe2e 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -146,7 +146,7 @@ void Eyegore_OnGrabbed(EyegoreEntity* this) { void Eyegore_Init(EyegoreEntity* this) { sub_0804A720(super); super->action = 1; - super->animationState = 2; + super->animationState = IdleEast; super->x.HALF.HI &= 0xfff0; super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) + 0xc; this->unk_6d |= 8; @@ -198,7 +198,7 @@ void Eyegore_Action3(EyegoreEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->flags |= ENT_COLLIDE; - super->animationState = 2; + super->animationState = IdleEast; sub_08030E58(this); InitializeAnimation(super, 2); sub_08030FB4(this); @@ -242,7 +242,7 @@ void Eyegore_Action5(EyegoreEntity* this) { GetNextFrame(super); switch (super->frame & 7) { case 1: - if (super->animationState != 2) { + if (super->animationState != IdleEast) { if (super->animationState >= 3) { this->unk_7f = (super->animationState - 1) & 3; } else { @@ -266,7 +266,7 @@ void Eyegore_Action5(EyegoreEntity* this) { if (sub_08049FDC(super, 1)) { sub_08030E58(this); } else { - if (super->animationState == 2) { + if (super->animationState == IdleEast) { super->action = 6; super->flags &= ~ENT_COLLIDE; InitializeAnimation(super, 0xe); diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index db1bf3da..3eb404a1 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -117,7 +117,7 @@ void sub_08045524(Entity* this) { this->zVelocity = Q_16_16(1.75); tmp = sub_0804A024(this, 1, 8); - if (tmp != 0xff && (Random() & 3) == 0) { + if (tmp != DIR_NONE && (Random() & 3) == 0) { this->timer = Random() & 3; this->direction = DirectionRound(tmp); } else { diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index c1a569a3..b04a0d24 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -1128,7 +1128,7 @@ void sub_0802E300(GleerokEntity* this) { this->unk_79 &= ~0x80; heap = this->unk_84; - dir = sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity)) << 3; + dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) << 3; index = 0; ptr2 = &this->unk_80; tmp = 0; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index fe9a7358..60d0b8fd 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -164,8 +164,8 @@ void sub_08046930(GyorgMaleEntity* this) { return; super->subAction = 1; super->timer = 1; - super->animationState = 0; - super->direction = 0; + super->animationState = IdleNorth; + super->direction = IdleNorth; #ifdef EU super->speed = 0x200; #else diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index db2b004a..0edf083c 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -215,9 +215,9 @@ void sub_0802BE80(Entity* this) { } void sub_0802BEBC(Entity* this) { - this->direction ^= 0x10; + this->direction ^= DirectionSouth; ProcessMovement2(this); - this->direction ^= 0x10; + this->direction ^= DirectionSouth; if (!sub_080044EC(this, Q_16_16(0.125))) { sub_0802C1C0(this); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 6e2c7091..23ff2274 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -89,7 +89,7 @@ void sub_0803CD6C(Entity* this) { void sub_0803CDA8(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(this); } @@ -123,7 +123,7 @@ void sub_0803CE14(Entity* this) { UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); direction = this->direction; - if (direction & 0x80) { + if (direction & DIR_NOT_MOVING_CHECK) { return; } diff --git a/src/enemy/leever.c b/src/enemy/leever.c index 5baa8d06..2e07b2c6 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -71,7 +71,8 @@ void Leever_Idle(Entity* this) { if (Leever_PlayerInRange(this, Random() & 0x1f)) { this->action = 2; this->spriteSettings.draw = TRUE; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; + this->direction = + (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & (0x3 | DirectionNorthWest); InitializeAnimation(this, LeeverAnimation_DigUp); UpdateSpriteForCollisionLayer(this); } else { diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index ff5d0ffc..a37e5d9b 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -369,16 +369,16 @@ void sub_08029EEC(Entity* this) { void sub_08029F0C(Entity* this) { switch (this->direction >> 3) { - case 0: + case 0: // UP this->field_0x78.HWORD = this->y.HALF.HI - 0x10; break; - case 1: + case 1: // RIGHT this->field_0x78.HWORD = this->x.HALF.HI + 0x10; break; - case 2: + case 2: // DOWN this->field_0x78.HWORD = this->y.HALF.HI + 0x10; break; - case 3: + case 3: // LEFT this->field_0x78.HWORD = this->x.HALF.HI - 0x10; break; } @@ -386,25 +386,25 @@ void sub_08029F0C(Entity* this) { bool32 sub_08029F48(Entity* this) { switch (this->direction >> 3) { - case 0: + case 0: // UP if (this->y.HALF.HI <= this->field_0x78.HWORD) { this->y.HALF.HI = this->field_0x78.HWORD; return TRUE; } break; - case 1: + case 1: // RIGHT if (this->x.HALF.HI >= this->field_0x78.HWORD) { this->x.HALF.HI = this->field_0x78.HWORD; return TRUE; } break; - case 2: + case 2: // DOWN if (this->y.HALF.HI >= this->field_0x78.HWORD) { this->y.HALF.HI = this->field_0x78.HWORD; return TRUE; } break; - case 3: + case 3: // LEFT if (this->x.HALF.HI <= this->field_0x78.HWORD) { this->x.HALF.HI = this->field_0x78.HWORD; return TRUE; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index d21e8636..9180ae73 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -509,7 +509,7 @@ void sub_0803A8B8(Entity* this) { this->action = 0x10; this->timer = 30; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x80; ptr = gUnk_080CED6C; @@ -553,7 +553,7 @@ void sub_0803A978(Entity* this) { sub_08004596(this, 0x10); } LinearMoveUpdate(this); - if (this->direction == 0x10) { + if (this->direction == DirectionSouth) { this->action = 0x12; this->timer = 3; COLLISION_OFF(this); @@ -1225,7 +1225,10 @@ void sub_0803B724(Entity* param_1) { void sub_0803B798(void) { gPlayerState.jump_status = 0x41; gPlayerState.field_0xa = 0; - gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED); + gPlayerState.flags &= + ~(PL_CAPTURED | PL_FLAGS10000 | PL_GYORG_FIGHT | PL_ROLLING | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | + PL_MOLDWORM_RELEASED | PL_CLONING | PL_USE_LANTERN | PL_PARACHUTE | PL_CONVEYOR_PUSHED | PL_ENTER_MINECART | + PL_SWORD_THRUST | PL_USE_OCARINA | PL_CLIMBING | PL_FLAGS40000000 | PL_FLAGS80000000); gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.z.HALF.HI = -10; diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index a6a9ad92..1a027a87 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -561,7 +561,7 @@ void sub_0803473C(Entity* this) { if (roomX + 0xe0 < this->x.HALF.HI) { return; } - this->direction = 8; + this->direction = DirectionEast; } else { if (playerX + 4 >= this->x.HALF.HI) { return; @@ -569,7 +569,7 @@ void sub_0803473C(Entity* this) { if (roomX + 0x90 > this->x.HALF.HI) { return; } - this->direction = 0x18; + this->direction = DirectionWest; } LinearMoveUpdate(this); } @@ -581,7 +581,7 @@ void sub_080347B4(Entity* this) { if (roomX + 0xe0 < this->x.HALF.HI) { return; } - this->direction = 8; + this->direction = DirectionEast; } else { if (playerX + 4 >= this->x.HALF.HI) { return; @@ -589,7 +589,7 @@ void sub_080347B4(Entity* this) { if (roomX + 0x90 > this->x.HALF.HI) { return; } - this->direction = 0x18; + this->direction = DirectionWest; } LinearMoveUpdate(this); } diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index facad891..3d0daa83 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -209,7 +209,7 @@ void sub_08022F14(Entity* this) { } this->direction += this->field_0x78.HALF.LO; - this->direction &= 0x1f; + this->direction &= DirectionNorthWest | 0x3; this->animationState = ((this->direction + 2) & 0x1c) >> 2; this->frameIndex = this->animationState; diff --git a/src/enemy/mulldozer.c b/src/enemy/mulldozer.c index 854235de..f8b79c7e 100644 --- a/src/enemy/mulldozer.c +++ b/src/enemy/mulldozer.c @@ -53,7 +53,7 @@ void Mulldozer_OnInit(MulldozerEntity* this) { Mulldozer_Actions[super->action](this); } -void sub_08032CAC(MulldozerEntity* this) { +void Mulldozer_OnCollision(MulldozerEntity* this) { if (super->confusedTime != 0) { Create0x68FX(super, 0x1c); } @@ -80,7 +80,7 @@ void sub_08032CAC(MulldozerEntity* this) { } } -void sub_08032D3C(MulldozerEntity* this) { +void Mulldozer_OnKnockback(MulldozerEntity* this) { if (--super->subtimer == 0) { super->subtimer = 2; super->animationState = (super->animationState + 1) & 7; @@ -90,7 +90,7 @@ void sub_08032D3C(MulldozerEntity* this) { GenericKnockback(super); } -void nullsub_157(MulldozerEntity* this) { +void Mulldozer_OnGrabbed(MulldozerEntity* this) { } void Mulldozer_Init(MulldozerEntity* this) { @@ -465,11 +465,11 @@ bool32 sub_08033364(MulldozerEntity* this) { void (*const Mulldozer_Functions[])(MulldozerEntity*) = { Mulldozer_OnInit, - sub_08032CAC, - sub_08032D3C, + Mulldozer_OnCollision, + Mulldozer_OnKnockback, (void (*)(MulldozerEntity*))GenericDeath, (void (*)(MulldozerEntity*))GenericConfused, - nullsub_157, + Mulldozer_OnGrabbed, }; void (*const Mulldozer_Actions[])(MulldozerEntity*) = { Mulldozer_Init, Mulldozer_Action1, Mulldozer_Action2, Mulldozer_Action3, diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index 815c7411..12be6a8f 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -2,6 +2,7 @@ #include "map.h" #include "enemy.h" #include "player.h" +#include "item.h" void (*const OctorokGolden_Functions[])(Entity*); void (*const gUnk_080CF484[])(Entity*); @@ -40,7 +41,7 @@ void OctorokGolden_OnDeath(Entity* this) { SetGlobalFlag(this->type2); } - CreateDeathFx(this, 0xff, 0x58); + CreateDeathFx(this, 0xff, ITEM_RUPEE100); } void sub_08037CE4(Entity* this) { diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 7b5ead2a..a6ba87da 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -182,7 +182,8 @@ void Peahat_ChargeStart(Entity* this) { this->action = 3; this->timer = 120; this->speed = 192; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f; + this->direction = + (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & (0x3 | DirectionNorthWest); } } else { sub_080205F8(this); @@ -226,6 +227,8 @@ void Peahat_ChargeEnd(Entity* this) { } } +#define DIR_NONE 0xff + void Peahat_Stunned(Entity* this) { switch (this->animationState) { default: @@ -236,7 +239,7 @@ void Peahat_Stunned(Entity* this) { this->hitType = 0x71; } - if (this->direction == 0xff) + if (this->direction == DIR_NONE) this->direction = this->knockbackDirection; ProcessMovement0(this); @@ -364,7 +367,7 @@ void sub_08020604(Entity* this) { this->direction = sub_08049EE4(this); } else { this->direction += this->field_0x80.HALF.LO; - this->direction &= 0x1f; + this->direction &= (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 9c211fcc..35146f8e 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -387,7 +387,7 @@ void sub_080244E8(Entity* this) { if (tmp == 0) { this->field_0x80.HALF.LO++; this->timer = 12; - this->direction = 0x10; + this->direction = DirectionSouth; this->speed = tmp; this->cutsceneBeh.HALF.LO = 0; this->flags2 &= 0xfc; @@ -554,13 +554,13 @@ void sub_08024940(Entity* this) { } void sub_080249DC(Entity* this) { - u8 direction = ((this->direction + 2) & 0x1c) >> 2; + u8 direction = ((this->direction + 2) & DirectionNorthWest) >> 2; this->animationState = direction; InitializeAnimation(this, this->animationState); } void sub_080249F4(Entity* this) { - u32 direction = ((this->direction + 2) & 0x1f); + u32 direction = ((this->direction + 2) & (0x3 | DirectionNorthWest)); direction >>= 2; if (direction != this->animationState) { this->animationState = direction; @@ -770,8 +770,8 @@ void sub_08024D00(Entity* this) { this->field_0x80.HALF.LO++; this->timer = (Random() & 0xf) + 32; - this->direction += this->field_0x80.HALF.HI ? 4 : 0x1c; - this->direction &= 0x1f; + this->direction += this->field_0x80.HALF.HI ? DirectionNorthEast : DirectionNorthWest; + this->direction &= 0x3 | DirectionNorthWest; this->field_0x80.HALF.HI ^= 0x40; sub_08024A14(this, 3, 0x10); @@ -783,8 +783,8 @@ void sub_08024D00(Entity* this) { this->timer = (Random() & 0x1f) + 32; } else { if (--this->subtimer == 0) { - this->direction += this->field_0x80.HALF.HI ? 1 : 0x1f; - this->direction &= 0x1f; + this->direction += this->field_0x80.HALF.HI ? 1 : (0x3 | DirectionNorthWest); + this->direction &= 0x3 | DirectionNorthWest; this->subtimer = 16; sub_080249DC(this); diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index bd354489..e13c6d5d 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -339,7 +339,7 @@ void sub_080255AC(Entity* this) { } tmp -= 7; - this->direction = (GetFacingDirection(ent, this) + tmp) & 0x1f; + this->direction = (GetFacingDirection(ent, this) + tmp) & (0x3 | DirectionNorthWest); } if (this->field_0x78.HWORD == 0) { @@ -379,7 +379,7 @@ void sub_080256B4(Entity* this) { this->action = 1; this->timer = (Random() & 3) + 4; this->subtimer = 30; - this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & 0x1c; + this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & DirectionNorthWest; this->field_0x78.HWORD = gUnk_080CC000[Random() & 0xf]; this->field_0x7a.HALF.LO = ((s32)Random() % 0x18) << 1; this->field_0x7a.HALF.HI = 0; diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index bbc4a051..5e61c320 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -40,7 +40,7 @@ void Rollobite_OnCollision(Entity* this) { if (this->hitType == 34 && this->health != 0xff) { this->action = 4; this->zVelocity = Q_16_16(2.0); - this->direction = 0xff; + this->direction = DIR_NONE; this->health = 0xff; this->hitType = 35; InitializeAnimation(this, this->animationState + 8); @@ -50,7 +50,7 @@ void Rollobite_OnCollision(Entity* this) { if (this->action == 4 || this->action == 5) { this->action = 4; this->timer = 180; - this->direction = 0xff; + this->direction = DIR_NONE; InitializeAnimation(this, this->animationState + 0x10); } } @@ -75,7 +75,7 @@ void Rollobite_OnGrabbed(Entity* this) { if (this->subAction < 3 && !sub_0806F520(this)) { this->action = 4; COLLISION_ON(this); - this->direction = 0xff; + this->direction = DIR_NONE; InitializeAnimation(this, this->animationState + 0x10); } else { gUnk_080CA6A4[this->subAction](this); @@ -108,7 +108,7 @@ void sub_080207A8(Entity* this) { COLLISION_ON(this); this->spritePriority.b0 = 4; this->gustJarState &= 0xfb; - this->direction ^= 0x10; + this->direction ^= DirectionSouth; this->zVelocity = Q_16_16(1.5); this->speed = 0x80; InitializeAnimation(this, this->animationState + 0x10); @@ -194,7 +194,7 @@ void Rollobite_RolledUp(Entity* this) { if (unk == 1) EnqueueSFX(SFX_PLACE_OBJ); - if ((this->direction & 0x80) == 0) + if (!(this->direction & DIR_NOT_MOVING_CHECK)) ProcessMovement2(this); } } @@ -249,8 +249,8 @@ void sub_08020A7C(Entity* this) { if (sub_08049FA0(this) == 0) { u32 tmp = DirectionRoundUp(sub_08049EE4(this)); - if ((state ^ 0x10) == tmp) - state ^= 0x10; + if ((state ^ DirectionSouth) == tmp) + state ^= DirectionSouth; } this->direction = state; diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index b8921b9a..32535b12 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -10,6 +10,7 @@ #include "enemy.h" #include "physics.h" #include "player.h" +#include "item.h" void RopeGolden_OnTick(Entity*); void RopeGolden_OnCollision(Entity*); @@ -58,7 +59,7 @@ void RopeGolden_OnDeath(Entity* this) { if ((this->gustJarState & 2) == 0) { SetGlobalFlag(this->type2); } - CreateDeathFx(this, 0xff, 0x58); + CreateDeathFx(this, 0xff, ITEM_RUPEE100); } void sub_08038258(Entity* this) { @@ -130,7 +131,7 @@ void sub_08038304(Entity* this) { } this->field_0x7a.HALF.LO = this->field_0x78.HALF.HI; this->field_0x78.HALF.HI = cVar2; - this->direction = (this->direction + cVar2) & 0x18; + this->direction = (this->direction + cVar2) & DirectionWest; } else { this->direction = this->field_0x78.HALF.LO; } diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 39a8e586..ab1b3c0f 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -218,7 +218,7 @@ void sub_08029688(Entity* this) { void sub_0802969C(Entity* this) { u32 bVar1; - if ((this->direction & 0xf) != 0) { + if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) { bVar1 = this->direction >> 4; if (bVar1 != this->animationState) { diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index 627a75bb..87fea681 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -42,16 +42,16 @@ void sub_0802BA18(Entity* this) { this->direction = direction; switch (direction >> 3) { - case 0: + case 0: // UP this->field_0x7a.HWORD = this->y.HALF.HI - this->field_0x7c.HALF.HI; break; - case 1: + case 1: // RIGHT this->field_0x7a.HWORD = this->x.HALF.HI + this->field_0x7c.HALF.LO; break; - case 2: + case 2: // DOWN this->field_0x7a.HWORD = this->y.HALF.HI + this->field_0x7c.HALF.HI; break; - case 3: + case 3: // LEFT this->field_0x7a.HWORD = this->x.HALF.HI - this->field_0x7c.HALF.LO; break; } @@ -62,19 +62,19 @@ void sub_0802BA8C(Entity* this) { sub_0802BB10(this); } else { switch (this->direction >> 3) { - case 0: + case 0: // UP if (this->field_0x7a.HWORD >= this->y.HALF.HI) sub_0802BB10(this); break; - case 1: + case 1: // RIGHT if (this->field_0x7a.HWORD <= this->x.HALF.HI) sub_0802BB10(this); break; - case 2: + case 2: // DOWN if (this->field_0x7a.HWORD <= this->y.HALF.HI) sub_0802BB10(this); break; - case 3: + case 3: // LEFT if (this->field_0x7a.HWORD >= this->x.HALF.HI) sub_0802BB10(this); break; @@ -91,7 +91,7 @@ void sub_0802BAFC(Entity* this) { void sub_0802BB10(Entity* this) { this->action = 3; this->speed = 0xc0; - this->direction = this->direction ^ 0x10; + this->direction = this->direction ^ DirectionSouth; EnqueueSFX(SFX_METAL_CLINK); } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 490da140..1997c4df 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -91,8 +91,8 @@ void sub_08031714(Entity* this) { if (sub_08049FA0(this) == 0 && (this->subtimer & 1) != 0) { this->direction = sub_08049EE4(this); } else { - this->direction += 0x18; - this->direction = ((Random() & 0xe) + this->direction) & 0x1f; + this->direction += DirectionWest; + this->direction = ((Random() & 0xe) + this->direction) & (0x3 | DirectionNorthWest); } sub_080317E0(this); } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 26ea7c79..91efe2ff 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -60,7 +60,7 @@ void sub_0802B35C(Entity* this) { if (--this->subtimer == 0) { this->subtimer = 120; - this->direction += is_head ? 0x08 : 0x18; + this->direction += is_head ? DirectionEast : DirectionWest; this->direction = DirectionRound(this->direction); } } else { diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 29c2584f..0a6765b5 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -176,7 +176,7 @@ void sub_08028488(Entity* this) { this->timer = (Random() & 7) * 3 + 64; break; case 4: - this->direction = (this->direction + 0x10) & 0x18; + this->direction = (this->direction + 0x10) & DirectionWest; /* fallthrough */ case 1: default: @@ -265,7 +265,7 @@ void sub_08028604(Entity* this) { this->timer = this->timer + 0x10; this->field_0x82.HALF.HI--; } - this->direction = (iVar3 + 4U) & 0x18; + this->direction = (iVar3 + 4U) & DirectionWest; iVar3 = Direction8ToAnimationState(this->direction); } } else { diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 36deab65..6cb42502 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -107,7 +107,7 @@ void sub_0802B7A4(Entity* this) { this->timer = gUnk_080CD314[Random() & 3]; this->speed = 0x60; sub_0802B960(this); - if (this->direction != 0xff) { + if (this->direction != DIR_NONE) { u32 animation = this->direction >> 3; if (animation != this->animationState) { this->animationState = animation & 3; diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index 098a4c8a..9ea94452 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -73,7 +73,7 @@ void Stalfos_OnTick(StalfosEntity* this) { } } -void sub_0803933C(StalfosEntity* this) { +void Stalfos_OnCollision(StalfosEntity* this) { Entity* r0; Entity* r1; u32 r2; @@ -120,7 +120,7 @@ void sub_0803933C(StalfosEntity* this) { EnemyFunctionHandlerAfterCollision(super, Stalfos_Functions); } -void sub_08039418(StalfosEntity* this) { +void Stalfos_OnDeath(StalfosEntity* this) { if (super->type == 0) { CreateDeathFx(super, 0xf3, 0); } else { @@ -128,7 +128,7 @@ void sub_08039418(StalfosEntity* this) { } } -void sub_08039438(StalfosEntity* this) { +void Stalfos_OnGrabbed(StalfosEntity* this) { if (sub_0806F520(super)) { Stalfos_SubActions[super->subAction](this); } @@ -453,33 +453,32 @@ u32 sub_08039B28(StalfosEntity* this) { const u16* ptr; const s8* ptr2; - if (super->child == NULL) { - ptr2 = &gUnk_080CF930[super->animationState * 2]; - pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]); - - tileType = GetMetaTileType(pos, (u32)super->collisionLayer); - ptr = gUnk_080CF938; - do { - if (ptr[0] != tileType) { - ptr += 2; - } else { - goto found; - } - } while (ptr[0] != 0); + if (super->child != NULL) { + return (u16)-1; } - return 0xffff; -found: - super->type2 = ptr[1]; - return pos; + ptr2 = &gUnk_080CF930[super->animationState * 2]; + pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]); + tileType = GetMetaTileType(pos, (u32)super->collisionLayer); + ptr = gUnk_080CF938; + + do { + if (ptr[0] == tileType) { + super->type2 = ptr[1]; + return pos; + } + ptr += 2; + } while (ptr[0] != 0); + + return (u16)-1; } void (*const Stalfos_Functions[])(StalfosEntity*) = { Stalfos_OnTick, - sub_0803933C, + Stalfos_OnCollision, (void (*)(StalfosEntity*))GenericKnockback, - sub_08039418, + Stalfos_OnDeath, (void (*)(StalfosEntity*))GenericConfused, - sub_08039438, + Stalfos_OnGrabbed, }; void (*const Stalfos_Actions[])(StalfosEntity*) = { Stalfos_Init, Stalfos_Action1, Stalfos_Action2, Stalfos_Action3, Stalfos_Action4, Stalfos_Action5, diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index a5d58c33..be027d6a 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -159,7 +159,7 @@ void sub_0802F300(Entity* this) { } else if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); } else if ((GetVvvAtEntity(this) & 0xf0) == 0x50) { // VVV_240 and VVV_241? - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); } if (--this->timer == 0) { @@ -214,6 +214,6 @@ static void sub_0802F45C(Entity* this) { this->direction = sub_08049F84(this, 1); } else { temp = (Random() & 0xf) + 0x18; - this->direction = (temp + this->direction) & 0x1f; + this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index 0eb576ca..43b6bd3e 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -7,6 +7,7 @@ #include "collision.h" #include "enemy.h" +#include "item.h" #include "functions.h" void sub_08038168(Entity*); @@ -70,9 +71,9 @@ void TektiteGolden_OnDeath(Entity* this) { SetGlobalFlag(this->type2); } if (this->type != 0) { - uVar1 = 0x59; + uVar1 = ITEM_RUPEE200; } else { - uVar1 = 0x58; + uVar1 = ITEM_RUPEE100; } CreateDeathFx(this, 0xff, uVar1); } @@ -135,7 +136,7 @@ void sub_08038048(Entity* this) { } else if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); } else if ((GetVvvAtEntity(this) & 0xf0) == 0x50) { // VVV_240 and VVV_241? - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); } if (--this->timer == 0) { @@ -184,6 +185,6 @@ void sub_08038168(Entity* this) { this->direction = sub_08049F84(this, 1); } else { temp = (Random() & 0xf) + 0x18; - this->direction = (temp + this->direction) & 0x1f; + this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 7095b875..e1075076 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -74,7 +74,7 @@ void sub_0804468C(Entity* this) { case 0: this->action = 1; this->timer = 1; - this->direction = (this->field_0x78.HALF.HI * 8) & 0x1f; + this->direction = (this->field_0x78.HALF.HI * 8) & (0x3 | DirectionNorthWest); this->field_0x78.HALF.LO = 0; this->field_0x82.HALF.HI = 0; this->spriteSettings.draw = 0; @@ -123,7 +123,7 @@ void sub_0804474C(Entity* this) { if (--this->timer == 0) { this->timer = 2; this->direction++; - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; } LinearMoveUpdate(this); UpdateAnimationSingleFrame(this); @@ -253,7 +253,7 @@ void sub_080449F8(Entity* this) { this->timer = 4; this->direction++; - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; if (vaati->field_0x80.HALF.LO == 0) vaati->field_0x74.HALF.LO = 1; break; @@ -266,9 +266,9 @@ void sub_080449F8(Entity* this) { } break; case 1: - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); LinearMoveUpdate(this); - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); this->timer = 2; break; case 3: @@ -324,7 +324,7 @@ void sub_08044B04(Entity* this) { if (--this->timer == 0) { this->timer = this->field_0x78.HALF.LO ? 4 : 2; this->direction++; - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; } if (--this->subtimer == 0) { if (this->timer != 2) { @@ -346,11 +346,11 @@ void sub_08044B04(Entity* this) { case 1: if (--this->timer == 0) { this->timer = 6; - this->direction = (this->direction + 1) & 0x1f; + this->direction = (this->direction + 1) & (0x3 | DirectionNorthWest); if (++this->subtimer == 0x30) { u32 direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); this->speed = 0; - this->direction = (direction + 16) & 0x1f; + this->direction = (direction + 16) & (0x3 | DirectionNorthWest); this->timer = 16; this->subtimer = 16; this->field_0x74.HALF.LO++; @@ -485,18 +485,18 @@ void sub_08044E74(Entity* this, u32 state) { switch (state) { case 2: this->action = 2; - this->direction += 0x18; - this->direction &= 0x1f; + this->direction += DirectionWest; + this->direction &= 0x3 | DirectionNorthWest; PositionRelative(this->parent, this, 0, Q_16_16(-16.0)); this->speed = 12288; LinearMoveUpdate(this); - this->direction += 0x8; - this->direction &= 0x1f; + this->direction += DirectionEast; + this->direction &= 0x3 | DirectionNorthWest; this->speed = 1280; LinearMoveUpdate(this); break; case 1: - this->direction = (this->direction + 8) & 0x1f; + this->direction = (this->direction + 8) & (0x3 | DirectionNorthWest); break; case 0: if (this->field_0x78.HALF.LO) { @@ -507,9 +507,9 @@ void sub_08044E74(Entity* this, u32 state) { } while (this->timer-- != 3); break; case 1: - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); LinearMoveUpdate(this); - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); break; } } else { diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 1dac37a1..fd8c503c 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -233,7 +233,7 @@ void sub_0802EFB8(Entity* this) { collisionData = GetCollisionDataAtMetaTilePos(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1); if (collisionData != 0) { - this->direction = 0xff; + this->direction = DIR_NONE; } else { this->timer = (rand & 3) + 1; this->direction = (uVar1 & 0x18); @@ -252,7 +252,7 @@ void sub_0802F04C(Entity* this) { return; } switch (this->direction >> 3) { - case 0: + case 0: // UP if (((oldY & 0xf) > 8) && ((this->y.HALF.HI & 0xf) < 9)) { this->timer--; oldY = (this->y.HALF.HI & 0xfff0) + 8; @@ -264,7 +264,7 @@ void sub_0802F04C(Entity* this) { return; } break; - case 1: + case 1: // RIGHT if (((oldX & 0xf) < 8) && ((this->x.HALF.HI & 0xf) >= 8)) { this->timer--; oldX = (this->x.HALF.HI & 0xfff0) + 8; @@ -276,7 +276,7 @@ void sub_0802F04C(Entity* this) { return; } break; - case 2: + case 2: // DOWN if (((oldY & 0xf) < 8) && ((this->y.HALF.HI & 0xf) >= 8)) { this->timer--; oldY = (this->y.HALF.HI & 0xfff0) + 8; @@ -288,7 +288,7 @@ void sub_0802F04C(Entity* this) { return; } break; - default: + default: // LEFT if (((oldX & 0xf) >= 9) && ((this->x.HALF.HI & 0xf) < 9)) { this->timer--; oldX = (this->x.HALF.HI & 0xfff0) + 8; diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index 95730d9f..985e1369 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -188,7 +188,7 @@ void VaatiProjectileFunction0Action5(Entity* this) { void VaatiProjectileFunction0Action6(Entity* this) { if (--this->timer == 0) { this->action = 7; - this->direction = 0x10; + this->direction = DirectionSouth; this->speed = 0x300; } sub_0803E444(this); diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index b6a257eb..50144071 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -103,7 +103,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) { this->timer = 0; this->field_0x76.HALF.LO = 0; this->spriteSettings.draw = 1; - this->direction = 0xff; + this->direction = DIR_NONE; this->spritePriority.b0 = 4; this->z.WORD = 0; this->field_0x80.HALF.LO = 2; @@ -149,12 +149,12 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->action = 2; this->field_0x74.HALF.LO = 0; this->timer = 16; - this->direction = 0xff; + this->direction = DIR_NONE; } else { if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) { - this->direction = ((Random() & 0x80) >> 3) | 8; + this->direction = ((Random() & 0x80) >> 3) | DirectionEast; } else { - this->direction = 0xff; + this->direction = DIR_NONE; } } } else { @@ -165,7 +165,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->field_0x74.HALF.HI = this->field_0x74.HALF.LO & 0x80; this->field_0x74.HALF.LO = 0; this->timer = 192; - this->direction = 0xff; + this->direction = DIR_NONE; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 0); } @@ -176,7 +176,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { case 0: this->action = 4; this->timer = 160; - this->direction = 0xff; + this->direction = DIR_NONE; this->cutsceneBeh.HALF.LO = 0xff; InitAnimationForceUpdate(this, 1); break; @@ -184,21 +184,21 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->action = 6; this->field_0x74.HALF.LO = 0; this->timer = 0; - this->direction = 0xff; + this->direction = DIR_NONE; break; case 3: this->action = 5; this->field_0x74.HALF.LO = 0; this->subtimer = 32; - this->direction = 0xff; + this->direction = DIR_NONE; break; case 2: this->field_0x74.HALF.LO = 0; this->timer = 32; if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) { - this->direction = ((Random() & 0x80) >> 3) | 8; + this->direction = ((Random() & 0x80) >> 3) | DirectionEast; } else { - this->direction = 0xff; + this->direction = DIR_NONE; } break; } @@ -340,7 +340,7 @@ void VaatiRebornEnemyType0Action4(Entity* this) { this->action = 1; this->cutsceneBeh.HALF.LO = 0xff; this->timer = 1; - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); InitAnimationForceUpdate(this, 0); } else { if ((this->frame & 0x10) != 0) { @@ -369,7 +369,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { if (this->field_0x80.HALF.LO == 0) { this->action = 1; this->timer = 1; - this->direction = 0xff; + this->direction = DIR_NONE; InitAnimationForceUpdate(this, 0); return; } @@ -394,7 +394,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { this->field_0x86.HALF.HI++; this->subtimer = (Random() & 0x3f) + 64; uVar3 = GetFacingDirection(this, &gPlayerEntity); - this->direction = (uVar3 & 0x10) | 8; + this->direction = (uVar3 & 0x10) | DirectionEast; } else { this->field_0x74.HALF.LO++; this->field_0x86.HALF.HI = 0; @@ -408,7 +408,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { this->action = 1; this->field_0x74.HALF.LO = 0; this->timer = 1; - this->direction = 0xff; + this->direction = DIR_NONE; } break; } @@ -557,7 +557,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) { this->field_0x74.HALF.LO = 1; this->field_0x74.HALF.HI = 0; this->spriteOffsetY = -2; - this->direction = 0xff; + this->direction = DIR_NONE; PositionRelative(source, this, 0, Q_16_16(2.0)); InitAnimationForceUpdate(this, 2); } @@ -601,7 +601,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) { void VaatiRebornEnemyType3Action0(Entity* this) { this->action = 1; this->field_0x74.HALF.LO = 0; - this->direction = 0xff; + this->direction = DIR_NONE; this->spriteOffsetY = -1; InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); sub_0803DC0C(this); @@ -621,7 +621,7 @@ void VaatiRebornEnemyType3Action1(Entity* this) { } else { if (this->field_0x74.HALF.LO != 0) { this->field_0x74.HALF.LO = 0; - this->direction = 0xff; + this->direction = DIR_NONE; InitAnimationForceUpdate(this, 2); } } @@ -855,7 +855,7 @@ void VaatiRebornEnemyType0PreAction(Entity* this) { this->field_0x7c = this->y; } if (this->field_0x76.HALF.LO == 0) { - if ((this->direction == 0xff) || sub_08049FA0(this)) { + if ((this->direction == DIR_NONE) || sub_08049FA0(this)) { if (this->field_0x80.HALF.LO == 0) { this->animationState = (this->animationState + 1) & 3; this->spriteOffsetX = gUnk_080D04D3[this->animationState]; @@ -863,7 +863,7 @@ void VaatiRebornEnemyType0PreAction(Entity* this) { return; } bVar1 = sub_08049EE4(this); - this->direction = (bVar1 & 0x10) | 8; + this->direction = (bVar1 & 0x10) | DirectionEast; this->field_0x76.HALF.LO = 0x10; } else { this->field_0x76.HALF.LO--; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 5e3ccd6b..6b58c2af 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -888,7 +888,7 @@ void sub_080406A0(Entity* this) { this->direction = tmp + 0x1f; } } - this->direction &= 0x1f; + this->direction &= 0x3 | DirectionNorthWest; this->field_0x86.HALF.LO = uVar5; } @@ -974,7 +974,7 @@ void sub_08040770(Entity* this) { this->direction = tmp3 + 0x1F; } } - this->direction &= 0x1F; + this->direction &= 0x3 | DirectionNorthWest; this->field_0x86.HALF.LO = tmp2; } diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index b7c9fd3a..1c4e74ac 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -383,7 +383,7 @@ void VaatiWrathType0Action7(Entity* this) { UpdateAnimationSingleFrame(this); if (gRoomControls.origin_y + 0x48 != this->y.HALF.HI) { this->speed = 0x100; - this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? 0x10 : 0; + this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? DirectionSouth : DirectionNorth; LinearMoveUpdate(this); } else { if (--this->timer == 0) { @@ -398,7 +398,7 @@ void VaatiWrathType0Action8(Entity* this) { LinearMoveUpdate(this); if (((gRoomControls.origin_x + 0x20) > this->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < this->x.HALF.HI)) { if (0x3f < this->speed) { - this->direction ^= 0x10; + this->direction ^= DirectionSouth; } } if (--this->timer == 0) { @@ -451,7 +451,7 @@ void VaatiWrathType0ActionA(Entity* this) { if (this->field_0x7a.HALF.HI == 0xf0) { this->action = 0xb; this->subAction = 0; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x100; this->zVelocity = Q_16_16(1.125); ChangeObjPalette(this, 0x16b); @@ -521,7 +521,7 @@ void VaatiWrathType0ActionC(Entity* this) { if (this->z.HALF.HI < -4) { this->subAction = 1; this->timer = 120; - this->direction = 0x10; + this->direction = DirectionSouth; this->speed = 0x80; } break; @@ -998,8 +998,8 @@ void sub_0804235C(Entity* this) { void VaatiWrathType0PreAction(Entity* this) { int temp; if ((gRoomTransition.field_0x38 & 2) == 0) { - if (gSave.timers[3] != 0) { - gSave.timers[3]--; + if (gSave.vaati_timer != 0) { + gSave.vaati_timer--; } else { temp = gPlayerState.framestate_last; switch (temp) { diff --git a/src/enemyUtils.c b/src/enemyUtils.c index 5e8e3f4a..0b479b7e 100644 --- a/src/enemyUtils.c +++ b/src/enemyUtils.c @@ -192,7 +192,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) { int tmp = parent->base.gustJarState & 2; if (tmp == 0) { SetRoomTrackerFlag(&(parent->base)); - gSave.unk50++; + gSave.enemies_killed++; parent->base.gustJarState |= 2; parent->base.timer = 255; SetDefaultPriority(&(parent->base), 3); diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index 137a60d7..b2120956 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -177,8 +177,8 @@ void Subtask_PortalCutscene_0(void) { gScreen.bg1.yOffset = 0; controls->scroll_y = 0; portalId = gArea.portal_type; - if ((portalId == 2) && (gUI.roomControls.area != 2)) { - portalId = 3; + if ((portalId == PT_2) && (gUI.roomControls.area != 2)) { + portalId = PT_DUNGEON; } ptr = &gUnk_080D4138[portalId]; LoadPaletteGroup(ptr->paletteGroup); @@ -245,19 +245,19 @@ void RespawnAsMinish(void) { bool32 sub_0804AD18(void) { switch (gArea.portal_type) { - case 0: - case 1: - case 2: + case PT_TREESTUMP: + case PT_ROCK: + case PT_2: if (!CheckGlobalFlag(ENTRANCE_0 + gArea.portal_type)) { return FALSE; } // else: return TRUE implicitely, because it's stored in r0. But does not match if returning explicitely. break; - case 6: + case PT_TOD: return FALSE; - case 3: - case 4: - case 5: + case PT_DUNGEON: + case PT_JAR: + case PT_5: default: return FALSE; } diff --git a/src/fileselect.c b/src/fileselect.c index a4421ab9..0539b9f0 100644 --- a/src/fileselect.c +++ b/src/fileselect.c @@ -1146,16 +1146,16 @@ void sub_080610B8(void) { uVar6 = 0; tmp4 = 0; switch (gInput.unk4) { - case 0x40: + case DPAD_UP: tmp4 = -1; break; - case 0x80: + case DPAD_DOWN: tmp4 = 1; break; - case 0x20: + case DPAD_LEFT: uVar6 = -1; break; - case 0x10: + case DPAD_RIGHT: uVar6 = 1; break; } diff --git a/src/game.c b/src/game.c index 8bc2aa8e..54a17d3e 100644 --- a/src/game.c +++ b/src/game.c @@ -229,7 +229,7 @@ static void GameMain_ChangeRoom(void) { sub_0801855C(); } #elif defined(DEMO_JP) - if (gRoomTransition.field_0x2c[4]) + if (gRoomTransition.field31) CheckAreaDiscovery(); if (gArea.unk28.textBaseIndex != 0xff) { sub_0801855C(); diff --git a/src/gameData.c b/src/gameData.c index 06b11b65..84bd6ac9 100644 --- a/src/gameData.c +++ b/src/gameData.c @@ -490,9 +490,9 @@ const WorldEvent gWorldEvents[] = { // { NONE, 0, 0, 0, 0x0, 0, 0 }, // }; extern TileEntity gUnk_080FEAC8[]; // TODO differs jp, demo_jp, eu -extern EntityData gUnk_080FEBE8[]; -extern EntityData gUnk_080FEC28[]; +extern const EntityData gUnk_080FEBE8[]; extern EntityData gUnk_080FECC8[]; +extern EntityData gUnk_080FEC28[]; extern const EntityData gUnk_080FED18[]; extern EntityData gUnk_080FED58[]; // TODO need to find out what gRoomVars.field_0x8c[ptr->entity_idx] is. diff --git a/src/gameUtils.c b/src/gameUtils.c index 7947ea92..4b03a34c 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -26,8 +26,8 @@ u32 StairsAreValid(void); void ClearFlagArray(const u16*); void DummyHandler(u32* a1); -void sub_08053434(u32* a1); -void sub_080534E4(u32* a1); +void DarknutTimerHandler(u32* a1); +void BiggoronTimerHandler(u32* a1); void InitAllRoomResInfo(void); void InitRoomResInfo(RoomResInfo* info, RoomHeader* hdr, u32 area, u32 room); void sub_080532E4(void); @@ -208,7 +208,7 @@ s32 ModHealth(s32 delta) { newHealth = 0; } if (stats->maxHealth < newHealth) { - newHealth = (u32)stats->maxHealth; + newHealth = stats->maxHealth; } stats->health = newHealth; gPlayerEntity.health = newHealth; @@ -449,16 +449,10 @@ bool32 CanDispEzloMessage(void) { void DisplayEzloMessage(void) { u32 height; u32 idx; -#if defined(JP) || defined(EU) - idx = 0x10; -#else - idx = 0x11; -#endif - - if (gRoomTransition.player_status.field_0x24[idx] == 0) { + if (gRoomTransition.hint_height == 0) { height = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y > 96 ? 1 : 13; } else { - height = gRoomTransition.player_status.field_0x24[idx]; + height = gRoomTransition.hint_height; } MessageAtHeight(gRoomTransition.hint_idx, height); } @@ -467,11 +461,11 @@ void DisplayEzloMessage(void) { void CreateMiscManager(void) { Entity* e = NULL; - if (gRoomTransition.player_status.field_0x24[13]) + if (gRoomTransition.field31) return; - gRoomTransition.player_status.field_0x24[13] = 1; + gRoomTransition.field31 = 1; #ifndef DEMO_JP - gRoomTransition.player_status.field_0x24[10] = gArea.locationIndex; + gRoomTransition.location = gArea.locationIndex; #endif e = (Entity*)GetEmptyManager(); if (e == NULL) @@ -715,7 +709,7 @@ u32 sub_08053144(void) { return 0; ret = 0; if (gArea.locationIndex != 0) - ret = !!(gRoomTransition.player_status.field_0x24[10] ^ gArea.locationIndex); + ret = !!(gRoomTransition.location ^ gArea.locationIndex); return ret; } @@ -723,7 +717,7 @@ void CheckAreaDiscovery(void) { if (!sub_08053144()) return; - gRoomTransition.player_status.field_0x24[10] = gArea.locationIndex; + gRoomTransition.location = gArea.locationIndex; if (!CheckGlobalFlag(TABIDACHI)) return; @@ -773,7 +767,7 @@ void sub_0805329C(void) { if (sub_08053144()) { switch (gRoomControls.area) { case AREA_DEEPWOOD_SHRINE: - gSave.unk7 = 0; + gSave.dws_barrel_state = 0; break; case AREA_CAVE_OF_FLAMES: sub_080530B0(); @@ -837,24 +831,25 @@ void sub_080533CC(void) { void UpdateTimerCallbacks(void) { static void (*const sHandlers[])(u32*) = { - sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler, + DarknutTimerHandler, DummyHandler, BiggoronTimerHandler, DummyHandler, + DummyHandler, DummyHandler, DummyHandler, DummyHandler, }; u32* p; u32 i; - p = gSave.timers; + p = &gSave.darknut_timer; for (i = 0; i < 8; i++, p++) { (sHandlers[i])(p); } } -void DummyHandler(u32* a1) { +void DummyHandler(u32* timer) { } -void sub_08053434(u32* a1) { - if (gArea.locationIndex == 29 && *a1) { // AREA_DARK_HYRULE_CASTLE - if (!--*a1) { +void DarknutTimerHandler(u32* timer) { + if (gArea.locationIndex == 29 && *timer) { // AREA_DARK_HYRULE_CASTLE + if (!--*timer) { ResetTimerFlags(); MenuFadeIn(5, 6); } @@ -876,33 +871,31 @@ void ResetTimerFlags(void) { 0xFFFF, }; - gSave.timers[0] = 0; + gSave.darknut_timer = 0; if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_ZELDA_DISCURSE)) ClearGlobalFlag(ZELDA_CHASE); ClearFlagArray(sClearFlags); } void StartDarkNutTimer(void) { - gSave.timers[0] = 10800; + gSave.darknut_timer = 10800; } void sub_080534AC(void) { if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START)) { ClearLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START); - gSave.timers[0] = 0; + gSave.darknut_timer = 0; SoundReq(SONG_STOP_BGM); } } -void sub_080534E4(u32* a1) { - if (gRoomControls.area != AREA_VEIL_FALLS_TOP) { - if (*a1) - --*a1; - } +void BiggoronTimerHandler(u32* timer) { + if (gRoomControls.area != AREA_VEIL_FALLS_TOP && *timer) + --*timer; } void InitBiggoronTimer(void) { - gSave.timers[2] = 36000; + gSave.biggoron_timer = 36000; } void ResetTmpFlags(void) { diff --git a/src/interrupts.c b/src/interrupts.c index 3efa60ad..95703131 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -94,8 +94,10 @@ void sub_08016CA8(BgSettings* bg) { } } -NONMATCH("asm/non_matching/DispCtrlSet.inc", void DispCtrlSet(void)) { +void DispCtrlSet(void) { + u16* tmp2; BgControls* controls; + BgTransformationSettings* bgTfSettings; u16 tmp = gScreen.lcd.displayControl & gScreen.lcd.displayControlMask; REG_DISPCNT = tmp; @@ -113,36 +115,41 @@ NONMATCH("asm/non_matching/DispCtrlSet.inc", void DispCtrlSet(void)) { REG_BG3VOFS = gScreen.bg3.yOffset; controls = &(gScreen.controls); - REG_BG2PA = controls->bg2.dx; - REG_BG2PB = controls->bg2.dmx; - REG_BG2PC = controls->bg2.dy; - REG_BG2PD = controls->bg2.dmy; - REG_BG2X_L = controls->bg2.xPointLeastSig; - REG_BG2X_H = controls->bg2.xPointMostSig; - REG_BG2Y_L = controls->bg2.yPointLeastSig; - REG_BG2Y_H = controls->bg2.yPointMostSig; + bgTfSettings = &controls->bg2; - REG_BG3PA = controls->bg3.dx; - REG_BG3PB = controls->bg3.dmx; - REG_BG3PC = controls->bg3.dy; - REG_BG3PD = controls->bg3.dmy; - REG_BG3X_L = controls->bg3.xPointLeastSig; - REG_BG3X_H = controls->bg3.xPointMostSig; - REG_BG3Y_L = controls->bg3.yPointLeastSig; - REG_BG3Y_H = controls->bg3.yPointMostSig; + REG_BG2PA = bgTfSettings->dx; + REG_BG2PB = bgTfSettings->dmx; + REG_BG2PC = bgTfSettings->dy; + REG_BG2PD = bgTfSettings->dmy; + REG_BG2X_L = bgTfSettings->xPointLeastSig; + REG_BG2X_H = bgTfSettings->xPointMostSig; + REG_BG2Y_L = bgTfSettings->yPointLeastSig; + REG_BG2Y_H = bgTfSettings->yPointMostSig; - REG_WIN0H = controls->window0HorizontalDimensions; - REG_WIN1H = controls->window1HorizontalDimensions; - REG_WIN0V = controls->window0VerticalDimensions; - REG_WIN1V = controls->window1VerticalDimensions; - REG_WININ = controls->windowInsideControl; - REG_WINOUT = controls->windowOutsideControl; - REG_MOSAIC = controls->mosaicSize; - REG_BLDCNT = controls->layerFXControl; - REG_BLDALPHA = controls->alphaBlend; - REG_BLDY = controls->layerBrightness; + bgTfSettings = &controls->bg3; + + REG_BG3PA = bgTfSettings->dx; + REG_BG3PB = bgTfSettings->dmx; + REG_BG3PC = bgTfSettings->dy; + REG_BG3PD = bgTfSettings->dmy; + REG_BG3X_L = bgTfSettings->xPointLeastSig; + REG_BG3X_H = bgTfSettings->xPointMostSig; + REG_BG3Y_L = bgTfSettings->yPointLeastSig; + REG_BG3Y_H = bgTfSettings->yPointMostSig; + + tmp2 = &controls->window0HorizontalDimensions; + REG_WIN0H = tmp2[0]; + // REG_WIN0H = *tmp2; + REG_WIN1H = tmp2[1]; + REG_WIN0V = tmp2[2]; + REG_WIN1V = tmp2[3]; + REG_WININ = tmp2[4]; + REG_WINOUT = tmp2[5]; + REG_MOSAIC = tmp2[6]; + REG_BLDCNT = tmp2[7]; + REG_BLDALPHA = tmp2[8]; + REG_BLDY = tmp2[9]; } -END_NONMATCH // Load any resources that were requested with LoadResourceAsync void LoadResources(void) { diff --git a/src/item/itemBow.c b/src/item/itemBow.c index 7714734f..ca2cc809 100644 --- a/src/item/itemBow.c +++ b/src/item/itemBow.c @@ -4,14 +4,14 @@ void sub_08075DF4(ItemBehavior*, u32); void sub_08075E40(ItemBehavior*, u32); -void sub_08075EC0(ItemBehavior*, u32); +void ItemBowShoot(ItemBehavior*, u32); void sub_08075F38(ItemBehavior*, u32); void sub_08075F84(ItemBehavior*, u32); void sub_08075D88(ItemBehavior*, u32); void ItemBow(ItemBehavior* this, u32 index) { static void (*const stateFuncs[])(ItemBehavior*, u32) = { - sub_08075DF4, sub_08075E40, sub_08075EC0, sub_08075F38, sub_08075F84, sub_08075D88, + sub_08075DF4, sub_08075E40, ItemBowShoot, sub_08075F38, sub_08075F84, sub_08075D88, }; stateFuncs[this->stateID](this, index); } @@ -22,14 +22,14 @@ void sub_08075DF4(ItemBehavior* this, u32 index) { sub_0806F948(&gPlayerEntity); sub_08077BB8(this); sub_08077D38(this, index); - gPlayerState.field_0x1f[2] = 1; + gPlayerState.bow_state = 1; } else { DeleteItemBehavior(this, index); } } void sub_08075E40(ItemBehavior* this, u32 index) { - if (gPlayerState.field_0x1f[2] != 0) { + if (gPlayerState.bow_state != 0) { if ((gPlayerState.attack_status & 0x80) == 0) { UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { @@ -43,24 +43,24 @@ void sub_08075E40(ItemBehavior* this, u32 index) { return; } } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } -void sub_08075EC0(ItemBehavior* this, u32 index) { +void ItemBowShoot(ItemBehavior* this, u32 index) { u8 arrowCount; - s32 iVar2; + s32 isShooting; arrowCount = gSave.stats.arrowCount; - iVar2 = IsItemActive(this); - if (iVar2 != 0 && arrowCount != 0) { - if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) { - gPlayerState.field_0x1f[2] = 0; + isShooting = IsItemActive(this); + if (isShooting && arrowCount != 0) { + if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.bow_state == 0)) { + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } } else { gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; - SetItemAnim(this, 0x27c); + SetItemAnim(this, ANIM_BOW_SHOOT); this->animPriority = 0xf; this->priority |= 0xf; this->stateID = 3; @@ -68,19 +68,19 @@ void sub_08075EC0(ItemBehavior* this, u32 index) { } void sub_08075F38(ItemBehavior* this, u32 index) { - if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { + if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) { UpdateItemAnim(this); if ((this->playerFrame & 1) != 0) { this->stateID = 4; } } else { - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } } void sub_08075F84(ItemBehavior* this, u32 index) { - if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) { + if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) { if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) { sub_08077E3C(this, 5); } else { @@ -90,6 +90,6 @@ void sub_08075F84(ItemBehavior* this, u32 index) { return; } } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteItemBehavior(this, index); } diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index 833f1198..3f66a3c1 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -36,7 +36,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x80) != 0) { this->stateID = 2; - SetItemAnim(this, 0x504); + SetItemAnim(this, ANIM_GUSTJAR_SUCK); gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (playerItem != NULL) { @@ -64,12 +64,12 @@ void sub_08076EC8(ItemBehavior* this, u32 index) { } if (gPlayerEntity.subAction == 0x1b) { - animIndex = 0x524; + animIndex = ANIM_GUSTJAR_524; } else { - if (gPlayerState.direction & 0x80) { - animIndex = 0x504; + if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) { + animIndex = ANIM_GUSTJAR_SUCK; } else { - animIndex = 0x518; + animIndex = ANIM_GUSTJAR_WALK; } } @@ -100,7 +100,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { gPlayerState.field_0x1c = 1; gPlayerState.field_0xa &= ~(8 >> index); this->stateID = 2; - SetItemAnim(this, 0x504); + SetItemAnim(this, ANIM_GUSTJAR_SUCK); item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (item) { item->parent = player; @@ -108,7 +108,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { return; } else { gPlayerState.field_0x1c = 6; - SetItemAnim(this, 0x510); + SetItemAnim(this, ANIM_GUSTJAR_END); return; } } else { @@ -155,7 +155,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { return; break; case 7: - SetItemAnim(this, 0x514); + SetItemAnim(this, ANIM_GUSTJAR_BLOW); gPlayerState.field_0x1c = 3; gPlayerState.gustJarSpeed = 0; return; @@ -163,7 +163,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { case 2: default: gPlayerState.field_0x1c = 3; - SetItemAnim(this, 0x514); + SetItemAnim(this, ANIM_GUSTJAR_BLOW); return; case 0: break; diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c index 60997922..6296dc67 100644 --- a/src/item/itemJarEmpty.c +++ b/src/item/itemJarEmpty.c @@ -24,41 +24,41 @@ void sub_08077534(ItemBehavior* this, u32 index) { sub_08077BB8(this); this->priority |= 0xf; tmp = this->behaviorId; - this->timer = gSave.filler86[tmp + 0x14]; + this->timer = gSave.stats.bottles[tmp - ITEM_BOTTLE1]; switch (this->timer) { - case 0x20: - SetItemAnim(this, 0x614); + case ITEM_BOTTLE_EMPTY: + SetItemAnim(this, ANIM_BOTTLE_SWING); return; - case 0x21: - case 0x22: - case 0x23: - case 0x24: - case 0x25: - case 0x29: - case 0x2a: - case 0x2b: - case 0x2c: - case 0x2d: - case 0x2e: + case ITEM_BOTTLE_BUTTER: + case ITEM_BOTTLE_MILK: + case ITEM_BOTTLE_HALF_MILK: + case ITEM_BOTTLE_RED_POTION: + case ITEM_BOTTLE_BLUE_POTION: + case ITEM_BOTTLE_PICOLYTE_RED: + case ITEM_BOTTLE_PICOLYTE_ORANGE: + case ITEM_BOTTLE_PICOLYTE_YELLOW: + case ITEM_BOTTLE_PICOLYTE_GREEN: + case ITEM_BOTTLE_PICOLYTE_BLUE: + case ITEM_BOTTLE_PICOLYTE_WHITE: this->stateID = 3; gPlayerEntity.animationState = 4; gPlayerEntity.spriteSettings.flipX = 0; - SetItemAnim(this, 0x2df); + SetItemAnim(this, ANIM_BOTTLE_DRINK); break; - case 0x2f: - case 0x30: - case 0x31: + case BOTTLE_CHARM_NAYRU: + case BOTTLE_CHARM_FARORE: + case BOTTLE_CHARM_DIN: default: this->stateID = 3; - SetItemAnim(this, 0x610); + SetItemAnim(this, ANIM_BOTTLE_POUR); break; } gPlayerEntity.flags &= ~ENT_COLLIDE; } void sub_08077618(ItemBehavior* this, u32 index) { - if ((this->playerFrame & 0x80) != 0) { - SetItemAnim(this, 0x618); + if (this->playerFrame & 0x80) { + SetItemAnim(this, ANIM_BOTTLE_SWING_END); this->stateID++; } else { UpdateItemAnim(this); diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 4e9902a0..070d9a89 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -104,7 +104,7 @@ void sub_08075B54(ItemBehavior* this, u32 index) { object->x.HALF.HI = tmp[0] + object->x.HALF.HI; object->y.HALF.HI = tmp[1] + object->y.HALF.HI; } - SetItemAnim(this, 0x60c); + SetItemAnim(this, ANIM_LANTERN_BURN); bVar1 = (8 >> (index)); gPlayerState.field_0xa |= bVar1; gPlayerState.keepFacing |= bVar1; diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index 53800f30..cf307a79 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -35,7 +35,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { iVar1 = sub_080774A0(); if (iVar1 != 0) { if (this->timer == 0) { - SetItemAnim(this, 0x50c); + SetItemAnim(this, ANIM_MOLEMITTS_DIG); this->stateID = 2; if (iVar1 == 0x56) { if ((gPlayerEntity.animationState & 2) != 0) { @@ -46,7 +46,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { } } } else { - SetItemAnim(this, 0x508); + SetItemAnim(this, ANIM_MOLEMITTS_FLOOR); this->stateID = 1; } } else { @@ -72,9 +72,9 @@ void sub_080771C8(ItemBehavior* this, u32 index) { } if ((this->playerFrame & 0x10) != 0) { if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) { - SetItemAnim(this, 0x520); + SetItemAnim(this, ANIM_MOLEMITTS_MISS); this->stateID = 3; - SoundReq(SFX_107); + SoundReq(SFX_ITEM_GLOVES_AIR); } else { if (this->subtimer != 0xff) { object = CreateObjectWithParent(&gPlayerEntity, OBJECT_1F, 0, this->field_0x2[1]); @@ -141,7 +141,7 @@ void sub_080772A8(ItemBehavior* this, u32 index) { SoundReq(SFX_108); CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0); } else { - SetItemAnim(this, 0x51c); + SetItemAnim(this, ANIM_MOLEMITTS_CLANG); effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0); if (effect != NULL) { effect->animationState = this->playerAnimationState; diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 7b487cee..1f4aa52a 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -67,11 +67,11 @@ void sub_080768F8(ItemBehavior* this, u32 index) { bVar1 |= bVar2; if (bVar1 == 0) { gPlayerState.dash_state = 1; - gPlayerState.field_0x1f[2] = bVar1; - if ((gPlayerState.flags & PL_MINISH) == 0) { + gPlayerState.bow_state = bVar1; + if (!(gPlayerState.flags & PL_MINISH)) { this->timer = 0x10; } else { - gPlayerState.animation = 0xc14; + gPlayerState.animation = ANIM_DASH_CHARGE_MINISH; } sub_08077D38(this, index); sub_08076964(this, index); @@ -104,7 +104,7 @@ void sub_08076964(ItemBehavior* this, u32 index) { if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 && (gPlayerState.skills & SKILL_DASH_ATTACK) != 0) { gPlayerState.lastSwordMove = SWORD_MOVE_DASH; - SetItemAnim(this, 0x298); + SetItemAnim(this, ANIM_DASH); entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD); if (entity != NULL) { if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) { @@ -115,11 +115,11 @@ void sub_08076964(ItemBehavior* this, u32 index) { entity->field_0x68.HALF.LO = uVar3; return; } - } else if ((gPlayerState.flags & PL_MINISH) == 0) { - SetItemAnim(this, 0x104); + } else if (!(gPlayerState.flags & PL_MINISH)) { + SetItemAnim(this, ANIM_WALK); return; } else { - gPlayerState.animation = 0xc10; + gPlayerState.animation = ANIM_DASH_MINISH; return; } } else { @@ -136,7 +136,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { u8* ptr; if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) { - if ((gPlayerState.flags & PL_MINISH) == 0) { + if (!(gPlayerState.flags & PL_MINISH)) { gPlayerEntity.speed = 0x300; } else { gPlayerEntity.speed = 0x280; @@ -148,7 +148,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { gPlayerEntity.subAction = 0; COLLISION_OFF(&gPlayerEntity); gPlayerState.field_0x38 = 0; - gPlayerState.direction = 0xff; + gPlayerState.direction = DIR_NONE; return; } this->subtimer = 1; @@ -157,12 +157,13 @@ void sub_08076A88(ItemBehavior* this, u32 index) { ptr = gUnk_0811BE38; if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) { this->direction = (this->playerAnimationState & 0xe) * 4; - if ((gPlayerState.direction != 0xff) && (gPlayerState.direction != this->direction)) { - if (((gPlayerState.direction - this->direction) & 0x1f) < 0x10) { + if ((gPlayerState.direction != DIR_NONE) && (gPlayerState.direction != this->direction)) { + if (((gPlayerState.direction - this->direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | + DirectionSouth | DirectionWest)) < DirectionSouth) { this->direction = this->direction + 2; } this->direction--; - this->direction &= 0x1f; + this->direction &= 0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest; } gPlayerState.direction = this->direction; UpdateItemAnim(this); diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index dee55950..cfb165a3 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -69,7 +69,7 @@ void sub_08076758(ItemBehavior* this, u32 index) { gPlayerEntity.field_0x7a.HWORD = 2; gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerState.jump_status |= 0x10; - gPlayerState.animation = 0x288; + gPlayerState.animation = ANIM_ROCS_CAPE; SoundReq(SFX_172); } } else { diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 5598e0d7..f27e0f2b 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -31,7 +31,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_MINISH) { this->priority |= 0x80; sub_08077D38(this, index); - gPlayerState.animation = 0xc00; + gPlayerState.animation = ANIM_SWORD_MINISH; SoundReq(SFX_PLY_VO1); return; } @@ -80,7 +80,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { this->priority |= 0x80; gPlayerState.lastSwordMove = SWORD_MOVE_ROLL; gPlayerState.flags |= PL_SWORD_THRUST; - SetItemAnim(this, 0x130); + SetItemAnim(this, ANIM_ROLLATTACK_SLIDE); SoundReq(SFX_PLY_VO3); return; } @@ -150,7 +150,7 @@ void sub_08075580(ItemBehavior* this, u32 index) { } else { this->timer = 0x50; } - SetItemAnim(this, 0x168); + SetItemAnim(this, ANIM_SWORD_CHARGE); CreateObject(SWORD_PARTICLE, 0, 0); return; } @@ -190,10 +190,10 @@ void sub_08075694(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_SWORD_THRUST) { gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.flags &= ~PL_ROLLING; - SetItemAnim(this, 300); + SetItemAnim(this, ANIM_ROLLATTACK_SPIN); } else { gPlayerState.lastSwordMove = SWORD_MOVE_SPIN; - SetItemAnim(this, 0x124); + SetItemAnim(this, ANIM_SPINATTACK); } gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; this->stateID = 4; @@ -220,7 +220,7 @@ void sub_08075738(ItemBehavior* this, u32 index) { } if ((gPlayerState.sword_state & 0x10) != 0) { - if ((gPlayerState.direction & 0x80) == 0) { + if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { this->direction = gPlayerState.direction; } gPlayerEntity.direction = this->direction; @@ -252,7 +252,7 @@ void sub_08075738(ItemBehavior* this, u32 index) { this->timer = 1; this->subtimer = 1; gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); - SetItemAnim(this, 0x128); + SetItemAnim(this, ANIM_GREATSPIN); } if ((this->playerFrame & 0x80) != 0) { @@ -298,7 +298,7 @@ void sub_08075900(ItemBehavior* this, u32 index) { } else { if (this->timer != 0) { if (--this->timer == 0) { - SetItemAnim(this, 0x134); + SetItemAnim(this, ANIM_ROLLATTACK_END); } gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3; gPlayerEntity.speed = 0x300; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 19838963..7e4eb7be 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -14,6 +14,11 @@ void sub_08076518(ItemBehavior*, u32); void sub_080765E0(ItemBehavior*, u32); void sub_0807660C(ItemBehavior*, u32); +extern s32 sub_0800875A(Entity*, u32, ItemBehavior*); + +extern const u16 gUnk_0811BE38[]; +extern const u16 gUnk_0811BE40[]; + void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { if (param_2 != NULL) { if ((param_2->carryFlags & 1) != 0) { @@ -25,9 +30,9 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { this->field_0x18 = param_2; if ((gPlayerState.flags & PL_NO_CAP)) { - SetItemAnim(this, 0x928); + SetItemAnim(this, ANIM_PICKUP_NOCAP); } else { - SetItemAnim(this, 0x338); + SetItemAnim(this, ANIM_PICKUP); } gPlayerState.heldObject = 3; gPlayerState.framestate = 4; @@ -108,12 +113,12 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { this->animPriority = 6; gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; gPlayerState.keepFacing = (8 >> index) | gPlayerState.keepFacing; - if ((gPlayerState.flags & PL_NO_CAP) == 0) { - SetItemAnim(this, 0x378); + if (!(gPlayerState.flags & PL_NO_CAP)) { + SetItemAnim(this, ANIM_GRAB); } else { - SetItemAnim(this, 0x948); + SetItemAnim(this, ANIM_GRAB_NOCAP); } - SoundReq(SFX_88); + SoundReq(SFX_GRAB); break; default: break; @@ -129,7 +134,101 @@ void sub_080762C4(ItemBehavior* this, Entity* arg1, u8 arg2, u32 arg3) { sub_08077D38(this, arg3); } -ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 index)) +void sub_080762D8(ItemBehavior* this, u32 index) { + u32 animIndex; + + gPlayerState.heldObject &= 0xcf; + if (!PlayerTryDropObject(this, index)) { + return; + } + + if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) { + if (this->field_0x18 != NULL) { + if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) { + if (!(gPlayerState.playerInput.heldInput & PLAYER_INPUT_80)) { // Pressing R + this->field_0x18->subAction = 6; + PlayerCancelHoldItem(this, index); + return; + } + } else { + PlayerCancelHoldItem(this, index); + return; + } + } + + gPlayerState.framestate = PL_STATE_THROW; + gHUD.rActionGrabbing = 8; + } else { + if (this->field_0x18 != NULL) { + this->field_0x18->subAction = 6; + } + PlayerCancelHoldItem(this, index); + return; + } + + if (!gPlayerState.jump_status) { + + if (gPlayerState.heldObject == 1 && sub_0800875A(&gPlayerEntity, 6, this) != 0) { + sub_08076088(this, NULL, index); + return; + } else if (gUnk_0811BE38[gPlayerEntity.animationState >> 1] & gPlayerState.playerInput.heldInput) { + UpdateItemAnim(this); + + if (!(gPlayerState.flags & PL_NO_CAP)) { + animIndex = ANIM_PULL; + } else { + animIndex = ANIM_PULL_START_NOCAP; + } + + if (animIndex != this->animIndex) { + SetItemAnim(this, animIndex); + } + + gPlayerState.heldObject |= 0x10; + gPlayerState.framestate = PL_STATE_PULL; + + if (gPlayerState.heldObject == 1) { + return; + } + + sub_08076088(this, this->field_0x18, index); + } else { + if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.animationState >> 1]) { + if (gPlayerEntity.subtimer < 6) { + gPlayerEntity.subtimer++; + return; + } + + gPlayerState.field_0x35 = this->playerAnimationState; + gPlayerState.pushedObject |= 0x80; + gPlayerState.heldObject |= 0x20; + gPlayerState.framestate = PL_STATE_PUSH; + + if (!(gPlayerState.flags & PL_NO_CAP)) { + animIndex = ANIM_PUSH; + } else { + animIndex = ANIM_PUSH_NOCAP; + } + + if (animIndex == this->animIndex) { + UpdateItemAnim(this); + } else { + SetItemAnim(this, animIndex); + } + } else { + gPlayerEntity.subtimer = 0; + + if (!(gPlayerState.flags & PL_NO_CAP)) { + SetItemAnim(this, ANIM_PULL); + } else { + SetItemAnim(this, ANIM_PULL_START_NOCAP); + } + } + } + } else { + PlayerCancelHoldItem(this, index); + } +} void sub_08076488(ItemBehavior* this, u32 index) { u32 bVar1; @@ -172,10 +271,10 @@ void sub_08076518(ItemBehavior* this, u32 index) { this->field_0x18 = NULL; this->stateID++; this->animPriority = 0x0f; - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - SetItemAnim(this, 0x930); + if (gPlayerState.flags & PL_NO_CAP) { + SetItemAnim(this, ANIM_THROW_NOCAP); } else { - SetItemAnim(this, 0x344); + SetItemAnim(this, ANIM_THROW); } gPlayerState.field_0xa |= 8 >> index; gPlayerState.keepFacing |= 8 >> index; diff --git a/src/itemDefinitions.c b/src/itemDefinitions.c index c6a8567b..0550f3e9 100644 --- a/src/itemDefinitions.c +++ b/src/itemDefinitions.c @@ -4,38 +4,38 @@ const ItemDefinition gItemDefinitions[] = { [ITEM_NONE] = { TRUE, 1, CREATE_ITEM_0, PLAYER_ITEM_NONE, 0, 0, FALSE, FALSE }, - [ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, - [ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE }, + [ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, + [ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE }, [ITEM_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE }, [ITEM_REMOTE_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE }, - [ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE }, - [ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE }, - [ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 2072, 3, FALSE, FALSE }, - [ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 1796, 3, FALSE, FALSE }, - [ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE }, - [ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE }, + [ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, ANIM_BOW_PULLOUT, 3, FALSE, FALSE }, + [ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, ANIM_BOW_PULLOUT, 3, FALSE, FALSE }, + [ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, ANIM_BOOMERANG, 3, FALSE, FALSE }, + [ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, ANIM_BOOMERANG_MAGIC, 3, FALSE, FALSE }, + [ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, ANIM_SHIELD_PULLOUT, 2, FALSE, FALSE }, + [ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, ANIM_SHIELD_PULLOUT, 2, FALSE, FALSE }, #ifdef EU - [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE }, - [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE }, + [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 6, FALSE, FALSE }, + [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 6, FALSE, FALSE }, #else - [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE }, - [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE }, + [ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 2, FALSE, FALSE }, + [ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 2, FALSE, FALSE }, #endif - [ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, 1280, 2, FALSE, FALSE }, - [ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, 1576, 6, TRUE, FALSE }, + [ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, ANIM_GUSTJAR_PULLOUT, 2, FALSE, FALSE }, + [ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, ANIM_CANE, 6, TRUE, FALSE }, [ITEM_MOLE_MITTS] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NONE2, 0, 2, TRUE, FALSE }, - [ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, 2060, 0, FALSE, FALSE }, - [ITEM_PEGASUS_BOOTS] = { TRUE, CREATE_ITEM_1, PLAYER_ITEM_SWORD, 12, 260, 6, FALSE, FALSE }, - [ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, 260, 6, FALSE, FALSE }, - [ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, 2273, 6, FALSE, FALSE }, + [ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, ANIM_HOP, 0, FALSE, FALSE }, + [ITEM_PEGASUS_BOOTS] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_DASH_SWORD, ANIM_WALK, 6, FALSE, FALSE }, + [ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, ANIM_WALK, 6, FALSE, FALSE }, + [ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, ANIM_OCARINA, 6, FALSE, FALSE }, [ITEM_ORB_GREEN] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED2, 0, 1, TRUE, TRUE }, [ITEM_ORB_BLUE] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED, 0, 1, TRUE, TRUE }, [ITEM_ORB_RED] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET2, 0, 1, TRUE, TRUE }, - [ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, 832, 4, FALSE, TRUE }, + [ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, ANIM_PULL, 4, FALSE, TRUE }, [ITEM_BOTTLE1] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE }, [ITEM_BOTTLE2] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE }, [ITEM_BOTTLE3] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE }, diff --git a/src/itemUtils.c b/src/itemUtils.c index 99208f41..decda449 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -385,7 +385,7 @@ void sub_08054524(void) { bVar1 = gArea.locationIndex; if (gArea.locationIndex == 0) { - bVar1 = gRoomTransition.player_status.field_0x24[0xa]; + bVar1 = gRoomTransition.location; } if (bVar1 > 0x16) { bVar1 = 0; @@ -480,7 +480,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { ptr2 = &gDroptableModifiers[DROPTABLE_NO_SHELLS]; } // don't drop kinstones anymore - if (gSave.didAllFusions != 0) { + if (gSave.kinstones.didAllFusions != 0) { ptr3 = &gDroptableModifiers[DROPTABLE_NO_KINSTONES]; } // vector addition, s0 = s0 + ptr2 + ptr3 diff --git a/src/kinstone.c b/src/kinstone.c index e4ae451b..d9a90230 100644 --- a/src/kinstone.c +++ b/src/kinstone.c @@ -12,11 +12,11 @@ #include "tiles.h" extern const struct_gUnk_080B3D20 gUnk_080B3D20[]; -extern EntityData gUnk_080FEC28[]; -extern EntityData gUnk_080FEBE8[]; -extern EntityData gUnk_080FECC8[]; -extern EntityData gUnk_080FEE78[]; -extern EntityData gUnk_080FED58[]; +extern const EntityData gUnk_080FEC28[]; +extern const EntityData gUnk_080FEBE8[]; +extern const EntityData gUnk_080FECC8[]; +extern const EntityData gUnk_080FEE78[]; +extern const EntityData gUnk_080FED58[]; extern const EntityData gUnk_080FED18[]; extern const EntityData gUnk_080FEE38[]; extern const EntityData gUnk_080FEE18[]; @@ -179,12 +179,7 @@ void GenerateAreaHint(void) { struct_area_28* ptr; gPlayerState.queued_action = PLAYER_TALKEZLO; -#if defined(EU) || defined(JP) - // TODO what fields of the room transition are switched in these variants? - gRoomTransition.field_0x2c[7] = 0; -#else gRoomTransition.hint_height = 0; -#endif ptr = &gArea.unk28; if (ptr->textBaseIndex == 0xff) { gRoomTransition.hint_idx = ptr->ezloHintTexts[0]; @@ -505,7 +500,7 @@ void sub_08018BB4(u32 worldEventId) { MemCopy(gUnk_080FEAC8 + worldEventId, &tile, sizeof(TileEntity)); ptr = &gWorldEvents[worldEventId]; tile.tilePos = (ptr->x >> 4 & 0x3f) | (((ptr->y) >> 4 & 0x3f) << 6); - sub_0804B3C4(&tile); + LoadSmallChestTile2(&tile); if (CheckLocalFlag(tile.localFlag) == 0) { position = tile.tilePos; if ((tile._6 & 1) == 0) { diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c index ea3ae958..aa7fc1a5 100644 --- a/src/manager/minishPortalManager.c +++ b/src/manager/minishPortalManager.c @@ -33,7 +33,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) { gArea.portal_type = super->type; if (!CheckGlobalFlag(EZERO_1ST)) { gArea.portal_mode = 1; - gArea.portal_type = 5; + gArea.portal_type = PT_5; } else { if ((gPlayerState.flags & PL_USE_PORTAL) && gPlayerState.jump_status == 0) { gArea.portal_mode = 2; @@ -82,7 +82,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { } bool32 PortalReadyForMinish(void) { - if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != 0x6) && + if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != PT_TOD) && (gPlayerState.heldObject == 0)) { switch (gPlayerState.framestate) { case PL_STATE_IDLE: diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index e73bb714..a25aa3e5 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -434,6 +434,6 @@ void MiscManager_TypeF(MiscManager* this) { if (gPlayerEntity.action == PLAYER_TALKEZLO) { DeleteThisEntity(); } - gInput.heldKeys |= 0x4; + gInput.heldKeys |= SELECT_BUTTON; } #endif diff --git a/src/manager/rollingBarrelManager.c b/src/manager/rollingBarrelManager.c index 0a1cab7e..ec215c34 100644 --- a/src/manager/rollingBarrelManager.c +++ b/src/manager/rollingBarrelManager.c @@ -191,7 +191,7 @@ void sub_08058B5C(RollingBarrelManager* this, u32 unk1) { gRoomTransition.player_status.start_anim = unk1 & 1 ? 4 : 0; gRoomTransition.player_status.start_pos_x = gUnk_081082E8[unk1 * 3]; gRoomTransition.player_status.start_pos_y = gUnk_081082E8[unk1 * 3 + 1]; - gSave.unk7 = gUnk_081082E8[unk1 * 3 + 2]; + gSave.dws_barrel_state = gUnk_081082E8[unk1 * 3 + 2]; SoundReq(SFX_STAIRS); } diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index c53528d8..6d1c666d 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -54,7 +54,7 @@ void Vaati3StartManager_Type0_Init(Vaati3StartManager* this) { *(u8*)&gRoomTransition.field_0x3a = 0x20; *((u8*)&gRoomTransition.field_0x3a + 1) = 0x20; #if !defined(EU) && !defined(JP) - gSave.timers[3] = 0x1194; + gSave.vaati_timer = 0x1194; #endif } @@ -71,7 +71,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { super->timer = 120; SetPlayerControl(2); sub_08078B48(); - object = CreateObject(THUNDERBOLD, 0, 0); + object = CreateObject(THUNDERBOLT, 0, 0); if (object != NULL) { object->x.HALF.HI = gRoomControls.origin_x + 0x88; object->y.HALF.HI = gRoomControls.origin_y + 0x48; diff --git a/src/manager/vaatiAppearingManager.c b/src/manager/vaatiAppearingManager.c index 9e349cb1..6eabadd8 100644 --- a/src/manager/vaatiAppearingManager.c +++ b/src/manager/vaatiAppearingManager.c @@ -138,16 +138,16 @@ void VaatiAppearingManager_Action2(VaatiAppearingManager* this) { } void VaatiAppearingManager_Action3(VaatiAppearingManager* this) { - if ((gInput.heldKeys & 0x40) != 0) { + if ((gInput.heldKeys & DPAD_UP) != 0) { this->field_0x20--; } - if ((gInput.heldKeys & 0x80) != 0) { + if ((gInput.heldKeys & DPAD_DOWN) != 0) { this->field_0x20++; } - if ((gInput.heldKeys & 0x20) != 0) { + if ((gInput.heldKeys & DPAD_LEFT) != 0) { this->field_0x28--; } - if ((gInput.heldKeys & 0x10) != 0) { + if ((gInput.heldKeys & DPAD_RIGHT) != 0) { this->field_0x28++; } } diff --git a/src/menu/figurineMenu.c b/src/menu/figurineMenu.c index 56a37316..6d22bdda 100644 --- a/src/menu/figurineMenu.c +++ b/src/menu/figurineMenu.c @@ -57,24 +57,24 @@ extern const struct_08128AD8 gUnk_08128AD8[]; Subtask FigurineMenu0_Type0; Subtask FigurineMenu0_Type1; Subtask FigurineMenu0_Type2; -Subtask FigurineMenu0_Type3; +Subtask FigurineMenu0_ViewFigurineAfterDrawing; Subtask FigurineMenu1_Type0; -Subtask FigurineMenu1_Type1; +Subtask FigurineMenu1_ViewAllFigurines; Subtask FigurineMenu1_Type2; -Subtask FigurineMenu1_Type3; +Subtask FigurineMenu1_ExitMenu; void Subtask_FigurineMenu(void) { static Subtask* const figurineMenu1_Types[] = { FigurineMenu0_Type0, FigurineMenu0_Type1, FigurineMenu0_Type2, - FigurineMenu0_Type3, + FigurineMenu0_ViewFigurineAfterDrawing, }; static Subtask* const figurineMenu0_Types[] = { FigurineMenu1_Type0, - FigurineMenu1_Type1, + FigurineMenu1_ViewAllFigurines, FigurineMenu1_Type2, - FigurineMenu1_Type3, + FigurineMenu1_ExitMenu, }; #if !(defined(DEMO_USA) || defined(DEMO_JP)) FlushSprites(); @@ -94,7 +94,7 @@ void Subtask_FigurineMenu(void) { } void FigurineMenu_080A4608(void) { - s32 iVar2, r1, r2; + s32 iVar2, r1, maxFigurines; SetBgmVolume(0x80); sub_080A4DA8(3); @@ -112,15 +112,15 @@ void FigurineMenu_080A4608(void) { } r1 = gUI.field_0x3; - r2 = !gSave.saw_staffroll ? 0x82 : 0x88; - if (r2 < r1) { + maxFigurines = !gSave.saw_staffroll ? 130 : 136; + if (maxFigurines < r1) { r1 = 1; } gFigurineMenu.figure_idx = r1; SetFade(FADE_INSTANT, 8); } -void FigurineMenu_080A46C0(void) { +void FigurineMenu_ExitMenu(void) { SetBgmVolume(0x100); SoundReq(SFX_MENU_CANCEL); ClearRoomFlag(2); @@ -147,7 +147,7 @@ void FigurineMenu0_Type2(void) { gFigurineMenu.unk20++; switch (gFigurineMenu.unk20) { case 0x40: - gFigurineMenu.duplicate = WriteBit(&gSave.stats.filler4[4], gFigurineMenu.figure_idx); + gFigurineMenu.duplicate = WriteBit(gSave.figurines, gFigurineMenu.figure_idx); gMenu.column_idx = 1; default: bVar1 = gFigurineMenu.unk20 >> 2; @@ -175,32 +175,32 @@ void FigurineMenu0_Type2(void) { } } -void FigurineMenu0_Type3(void) { - s32 uVar1; +void FigurineMenu0_ViewFigurineAfterDrawing(void) { + s32 infoY; s32 t; - uVar1 = gFigurineMenu.unk1f; + infoY = gFigurineMenu.unk1f; switch (gInput.unk4) { - case 2: - case 8: - FigurineMenu_080A46C0(); + case B_BUTTON: + case START_BUTTON: + FigurineMenu_ExitMenu(); break; - case 0x10: - uVar1 += 8; + case DPAD_RIGHT: + infoY += 8; break; - case 0x20: - uVar1 -= 8; + case DPAD_LEFT: + infoY -= 8; break; } t = gFigurineMenu.unk1e; - if (uVar1 < 0) { - uVar1 = 0; + if (infoY < 0) { + infoY = 0; } - if (t < uVar1) { - uVar1 = t; + if (t < infoY) { + infoY = t; } - gFigurineMenu.unk1f = uVar1; - gScreen.bg1.yOffset = uVar1 - 0x70; + gFigurineMenu.unk1f = infoY; + gScreen.bg1.yOffset = infoY - 112; } void FigurineMenu1_Type0(void) { @@ -211,85 +211,85 @@ void FigurineMenu1_Type0(void) { SetMenuType(1); } -void FigurineMenu1_Type1(void) { - int r0, r1, r4, r5; +void FigurineMenu1_ViewAllFigurines(void) { + int prevFigurineIndex, maxFigurines, figurineIndex, infoY; if (gFadeControl.active) return; - r5 = gFigurineMenu.unk1f; - r4 = gFigurineMenu.figure_idx; + infoY = gFigurineMenu.unk1f; + figurineIndex = gFigurineMenu.figure_idx; switch (gInput.unk4) { case B_BUTTON: case START_BUTTON: SetMenuType(3); break; case L_BUTTON: - r4 -= 5; + figurineIndex -= 5; break; case R_BUTTON: - r4 += 5; + figurineIndex += 5; break; case DPAD_UP: - r4--; + figurineIndex--; break; case DPAD_DOWN: - r4++; + figurineIndex++; break; case DPAD_RIGHT: - r5 += 8; + infoY += 8; break; case DPAD_LEFT: - r5 -= 8; + infoY -= 8; break; case A_BUTTON: break; } - r1 = !gSave.saw_staffroll ? 0x82 : 0x88; - if (r4 <= 0) { - r4 = 1; + maxFigurines = !gSave.saw_staffroll ? 130 : 136; + if (figurineIndex <= 0) { + figurineIndex = 1; } - if (r1 < r4) { - r4 = r1; + if (maxFigurines < figurineIndex) { + figurineIndex = maxFigurines; } - r0 = gFigurineMenu.figure_idx; - if (r0 != r4) { - gFigurineMenu.figure_idx = r4; + prevFigurineIndex = gFigurineMenu.figure_idx; + if (prevFigurineIndex != figurineIndex) { + gFigurineMenu.figure_idx = figurineIndex; SoundReq(SFX_TEXTBOX_CHOICE); SetMenuType(2); - r5 = 0; + infoY = 0; } - r0 = gFigurineMenu.unk1e; - if (r5 < 0) { - r5 = 0; + prevFigurineIndex = gFigurineMenu.unk1e; + if (infoY < 0) { + infoY = 0; } - if (r0 < r5) { - r5 = r0; + if (prevFigurineIndex < infoY) { + infoY = prevFigurineIndex; } - gFigurineMenu.unk1f = r5; - gScreen.bg1.yOffset = r5 - 0x70; + gFigurineMenu.unk1f = infoY; + gScreen.bg1.yOffset = infoY - 112; } void FigurineMenu1_Type2(void) { SetMenuType(1); } -void FigurineMenu1_Type3(void) { - FigurineMenu_080A46C0(); +void FigurineMenu1_ExitMenu(void) { + FigurineMenu_ExitMenu(); } -u32 sub_080A4948(s32 param_1) { - s32 iVar1; - u32 uVar2; +u32 FigurineMenu_isFigurineOwned(s32 figurineIndex) { + s32 maxFigurines; + u32 hasFigurine; - uVar2 = 0; - iVar1 = !gSave.saw_staffroll ? 0x82 : 0x88; - if ((0 < param_1) || (iVar1 >= param_1)) { - if (ReadBit((u32*)&gSave.stats.filler4[4], param_1)) { - uVar2 = 1; + hasFigurine = 0; + maxFigurines = !gSave.saw_staffroll ? 130 : 136; + if ((0 < figurineIndex) || (maxFigurines >= figurineIndex)) { + if (ReadBit(gSave.figurines, figurineIndex)) { + hasFigurine = 1; } } - return uVar2; + return hasFigurine; } typedef struct { @@ -307,7 +307,7 @@ extern const Figurine gFigurines[]; #define sub_080A4978_draw_constant 0x1fc #endif void FigurineMenu_080A4978(void) { - int r0, r2, r4, r6; + int r0, maxFigurines, r4, r6; gOamCmd._4 = 0; gOamCmd._6 = 0; @@ -315,11 +315,11 @@ void FigurineMenu_080A4978(void) { gOamCmd.x = 0x9c; gOamCmd.y = 0x48; DrawDirect(sub_080A4978_draw_constant, 0); - r2 = !gSave.saw_staffroll ? 0x82 : 0x88; + maxFigurines = !gSave.saw_staffroll ? 130 : 136; if ((gMenu.column_idx & 2) != 0) { - if (r2 >= (gFigurineMenu.figure_idx)) { + if (maxFigurines >= (gFigurineMenu.figure_idx)) { gOamCmd.x = 0xe8; - r0 = (0x5000 / r2) * (gFigurineMenu.figure_idx - 1); + r0 = (0x5000 / maxFigurines) * (gFigurineMenu.figure_idx - 1); if (r0 < 0) { r0 += 0xff; } @@ -367,7 +367,7 @@ void FigurineMenu_080A4978(void) { } } if (gMenu.column_idx & 1) { - if (sub_080A4948(gFigurineMenu.figure_idx)) { + if (FigurineMenu_isFigurineOwned(gFigurineMenu.figure_idx)) { gOamCmd.x = 0x2c; gOamCmd.y = 0x48; gOamCmd._8 = 0xd4 << 7; @@ -447,7 +447,7 @@ extern void ShowTextBox(u32, const struct_0812816C*); void sub_080A4BA0(u32 arg1, u32 arg2) { int r0, r5, r6; - int tmp; + int maxFigurines; struct_0812816C s0; u8 buffer[0x30]; @@ -465,13 +465,13 @@ void sub_080A4BA0(u32 arg1, u32 arg2) { s0.unk14 = arg2; } - tmp = !gSave.saw_staffroll ? 0x82 : 0x88; + maxFigurines = !gSave.saw_staffroll ? 130 : 136; - if (r5 <= 0 || tmp < r5) { + if (r5 <= 0 || maxFigurines < r5) { r5 = -1; } else { sub_08057044(r5, gUnk_020227E8, 0x303030); - if (sub_080A4948(r5) == 0) { + if (FigurineMenu_isFigurineOwned(r5) == 0) { r5 += 0x8000; } else { r5 += 0x800; @@ -526,18 +526,18 @@ const struct_0812816C gUnk_08128190 = { 0x5u, }; -u32 sub_080A4CBC(u32 param_1) { - s32 iVar1; +u32 sub_080A4CBC(u32 figurineIndex) { + s32 ownsFigurine; const u16* psVar2; u32 uVar3; - if (gFigurineMenu.unk1a != param_1) { - gFigurineMenu.unk1a = param_1; + if (gFigurineMenu.unk1a != figurineIndex) { + gFigurineMenu.unk1a = figurineIndex; MemClear(&gBG1Buffer, sizeof(gBG1Buffer)); MemCopy(&gBG1Buffer, (void*)0x600e000, sizeof(gBG1Buffer)); - iVar1 = sub_080A4948(param_1); - if (iVar1 != 0) { - ShowTextBox(param_1 + 0x900, &gUnk_08128190); + ownsFigurine = FigurineMenu_isFigurineOwned(figurineIndex); + if (ownsFigurine != 0) { + ShowTextBox(figurineIndex + 0x900, &gUnk_08128190); } gScreen.bg1.updated = 1; } diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c index 77b55818..b41d3707 100644 --- a/src/menu/kinstoneMenu.c +++ b/src/menu/kinstoneMenu.c @@ -86,7 +86,7 @@ const ScreenTransitionData gUnk_08128024[] = { u32 sub_080A3B48(void) { u32 index; for (index = 0; index <= 0x12; index++) { - if (gSave.kinstoneAmounts[index] == 0) { + if (gSave.kinstones.amounts[index] == 0) { break; } } @@ -206,7 +206,7 @@ void KinstoneMenu_Type1(void) { case A_BUTTON: if (gMenu.column_idx == 2) { tmp3 = gGenericMenu.unk10.i / 0x10000; - gGenericMenu.unk2a = gSave.kinstoneTypes[tmp3]; + gGenericMenu.unk2a = gSave.kinstones.types[tmp3]; SetMenuType(3); } break; @@ -229,7 +229,7 @@ void KinstoneMenu_Type1(void) { void KinstoneMenu_Type2(void) { const KinstoneWorldEvent* ptr; if (gMenu.column_idx == 6) { - gFuseInfo._0 = 6; + gFuseInfo.fusionState = FUSION_STATE_6; ptr = &gKinstoneWorldEvents[gFuseInfo.kinstoneId]; if (ptr->subtask != 0) { MenuFadeIn(ptr->subtask, ptr->worldEventId); @@ -237,7 +237,7 @@ void KinstoneMenu_Type2(void) { Subtask_Exit(); } } else { - gFuseInfo._0 = 5; + gFuseInfo.fusionState = FUSION_STATE_5; Subtask_Exit(); } } @@ -319,9 +319,9 @@ void KinstoneMenu_Type5(void) { void KinstoneMenu_Type5_Overlay0(void) { gMenu.column_idx = 5; - WriteBit(gSave.fusedKinstones, gFuseInfo.kinstoneId); - if (++gSave.fusedKinstoneCount > 99) { - gSave.didAllFusions = 1; + WriteBit(gSave.kinstones.fusedKinstones, gFuseInfo.kinstoneId); + if (++gSave.kinstones.fusedCount > 99) { + gSave.kinstones.didAllFusions = 1; } KinstoneMenu_080A4468(); SoundReq(SFX_TASK_COMPLETE); @@ -433,22 +433,36 @@ void KinstoneMenu_080A4080(void) { } } -NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void KinstoneMenu_080A414C(void)) { +void KinstoneMenu_080A414C(void) { s32 uVar1; s32 iVar2; s32 uVar3; + s32 tmp1; + s32 tmp2; + s32 tmp3; + s32 tmp4; + const s16* ptr; + OAMCommand* OamCmd; + u16 tmp5; s32 i; gOamCmd._4 = 0; gOamCmd._6 = 0; - uVar1 = gKinstoneMenu.unk10.HALF.LO / 0xb21; - for (i = -3, uVar1 = -uVar1 - 0x45; i < 4; uVar1 += 0x17, i++) { - gOamCmd.y = ((gSineTable[uVar1 & 0xff] * 0x44) / 0x100) + 0x4f; - gOamCmd.x = ((gSineTable[(uVar1 + 0x40) & 0xff] * 0x42) / 0x100) - 0x10; + tmp3 = (s32)(gKinstoneMenu.unk10.HALF_U.LO); + tmp2 = 0xb21; + tmp5 = (tmp3 / tmp2); + i = -3; + tmp1 = 0xff; + OamCmd = &gOamCmd; + ptr = gSineTable; + uVar1 = -tmp5 - 0x45; + while (i < 4) { + OamCmd->y = ((ptr[uVar1 & tmp1] * 0x44) / 0x100) + 0x4f; + OamCmd->x = ((ptr[((uVar1 & tmp1) + 0x40) & tmp1] * 0x42) / 0x100) - 0x10; iVar2 = gKinstoneMenu.unk10.WORD / 0x10000 + i; if (iVar2 >= 0) { - uVar3 = gSave.kinstoneAmounts[iVar2]; + uVar3 = gSave.kinstones.amounts[iVar2]; if (i == 0) { switch (gMenu.column_idx) { case 3: @@ -459,13 +473,14 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void K break; } } - if (0 < uVar3) { - sub_080A42E0(gSave.kinstoneTypes[iVar2], uVar3); + if (uVar3 > 0) { + sub_080A42E0(gSave.kinstones.types[iVar2], uVar3); } } + uVar1 += 0x17; + i++; } } -END_NONMATCH void KinstoneMenu_080A422C(void) { static const s8 gUnk_08128120[] = { @@ -625,9 +640,9 @@ u32 KinstoneMenu_080A4494(void) { psVar1->unk1 = 0; sub_080A44E0(psVar1, gSave.name, 0x80); #if NON_MATCHING - ret = sub_080A44E0(psVar1, GetFuserId(gFuseInfo.ent) >> 0x20, 0xa0); + ret = sub_080A44E0(psVar1, GetFuserId(gFuseInfo.entity) >> 0x20, 0xa0); #else - GetFuserId(gFuseInfo.ent); + GetFuserId(gFuseInfo.entity); asm("" : "=r"(r1)); ret = sub_080A44E0(psVar1, r1, 0xa0); #endif @@ -652,13 +667,13 @@ u32 sub_080A44E0(WStruct* param_1, u8* param_2, u32 param_3) { void KinstoneMenu_080A4528(void) { Entity* entity; - if (gFuseInfo.ent->kind == NPC) { - entity = CreateNPC(gFuseInfo.ent->id, gFuseInfo.ent->type, gFuseInfo.ent->type2); + if (gFuseInfo.entity->kind == NPC) { + entity = CreateNPC(gFuseInfo.entity->id, gFuseInfo.entity->type, gFuseInfo.entity->type2); } else { - if (gFuseInfo.ent->kind != ENEMY) { + if (gFuseInfo.entity->kind != ENEMY) { return; } - entity = CreateEnemy(gFuseInfo.ent->id, gFuseInfo.ent->type); + entity = CreateEnemy(gFuseInfo.entity->id, gFuseInfo.entity->type); } if (entity != NULL) { if (entity->kind == NPC) { diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c index 02ec7a63..a478b128 100644 --- a/src/menu/pauseMenu.c +++ b/src/menu/pauseMenu.c @@ -396,7 +396,7 @@ void PauseMenu_ItemMenu_Update(void) { } case B_BUTTON: if (gPauseMenu.items[menuSlot] != 0) { - u32 slot = !!(gInput.newKeys ^ 1); + u32 slot = !!(gInput.newKeys ^ A_BUTTON); ForceEquipItem(gPauseMenu.items[menuSlot], slot); SoundReq(SFX_TEXTBOX_SELECT); } @@ -429,7 +429,7 @@ void PauseMenu_ItemMenu_Update(void) { case MENU_SLOT_BOTTLE2: case MENU_SLOT_BOTTLE3: if (item != 0) { - item = gSave.saved_status.field_0x24[item - 6]; + item = gSave.stats.bottles[item - ITEM_BOTTLE1]; } break; case MENU_SLOT_SAVE_BUTTON: @@ -663,7 +663,7 @@ void sub_080A5594(void) { iVar5 = 0; if (GetInventoryValue(ITEM_KINSTONE_BAG) != 0) { for (i = 0; i < 0x13; i++) { - iVar5 += gSave.kinstoneAmounts[i]; + iVar5 += gSave.kinstones.amounts[i]; } if (iVar5 >= 0x50) { @@ -902,37 +902,37 @@ void sub_080A59AC(void) { } void sub_080A59C8(void) { - u32 uVar2; - u32 bVar3; + u32 cursor_position; + u32 select_option; if (!sub_080A51F4()) { return; } - uVar2 = gMenu.field_0x3; - bVar3 = FALSE; + cursor_position = gMenu.field_0x3; + select_option = FALSE; switch (gInput.newKeys) { case DPAD_UP: - uVar2 = 0; + cursor_position = 0; break; case B_BUTTON: if (gMenu.field_0x3 == 0) { - uVar2 = 1; + cursor_position = 1; } else { - bVar3 = TRUE; + select_option = TRUE; } break; case DPAD_DOWN: - uVar2 = 1; + cursor_position = 1; break; case A_BUTTON: - bVar3 = TRUE; + select_option = TRUE; break; } - if (bVar3) { + if (select_option) { gMenu.transitionTimer = 255; - if (uVar2 == 0) { + if (cursor_position == 0) { CreateDialogBox(8, 0); SetMenuType(2); SoundReq(SFX_TEXTBOX_SELECT); @@ -940,9 +940,9 @@ void sub_080A59C8(void) { SetMenuType(3); SoundReq(SFX_MENU_CANCEL); } - } else if (gMenu.field_0x3 != uVar2) { - gMenu.field_0x3 = uVar2; - SetPopupState(0, uVar2); + } else if (gMenu.field_0x3 != cursor_position) { + gMenu.field_0x3 = cursor_position; + SetPopupState(0, cursor_position); SoundReq(SFX_TEXTBOX_CHOICE); } } @@ -1232,7 +1232,7 @@ bool32 sub_080A5F24(void) { return result; } -void sub_080A5F48(u32 param_1, u32 param_2) { +void sub_080A5F48(Item item, u32 param_2) { extern u32 gSprite_082E68F4[]; u32 ammoCount; u32 tensDigit; @@ -1242,19 +1242,24 @@ void sub_080A5F48(u32 param_1, u32 param_2) { u32 temp3; register u32 rem asm("r1"); - switch (param_1) { - case 0x1c ... 0x1f: - param_1 = (u32)gSave.saved_status.field_0x24[param_1 - 6]; + switch (item) { + case ITEM_BOTTLE1: + case ITEM_BOTTLE2: + case ITEM_BOTTLE3: + case ITEM_BOTTLE4: + item = gSave.stats.bottles[item - ITEM_BOTTLE1]; + break; + default: break; } temp1 = param_2 * 0x20 + 0x6010000; - temp3 = gSpriteAnimations_322[param_1]->index; + temp3 = gSpriteAnimations_322[item]->index; temp2 = &gMoreSpritePtrs[1][temp3 * 2]; DmaCopy32(3, &gMoreSpritePtrs[2][temp2[1] * 0x10], temp1, 0x40 * 4); ammoCount = -1; - switch (param_1) { + switch (item) { case 7: case 8: ammoCount = gSave.stats.bombCount; @@ -1267,12 +1272,12 @@ void sub_080A5F48(u32 param_1, u32 param_2) { if (-1 < (int)ammoCount) { tensDigit = Div(ammoCount, 10); - param_1 = rem; + item = rem; if ((int)tensDigit >= 10) { tensDigit = 9; } DmaCopy32(3, gUnk_085C4620 + tensDigit * 0x8, temp1, 0x8 * 4); - DmaCopy32(3, gUnk_085C4620 + (param_1 + 10) * 0x8, temp1 + 0x20, 0x8 * 4); + DmaCopy32(3, gUnk_085C4620 + (item + 10) * 0x8, temp1 + 0x20, 0x8 * 4); } } @@ -1300,11 +1305,11 @@ void sub_080A6044(void) { gOamCmd._6 = 0; uVar4 = 0; uVar2 = 0; - uVar1 = gSave.kinstoneTypes[0]; + uVar1 = gSave.kinstones.types[0]; while (uVar1 != 0) { gOamCmd.x = (uVar4 & 3) * 0x30 + 0x2b; gOamCmd.y = (uVar4 >> 2) * 0x24 + 0x34; - uVar3 = gSave.kinstoneAmounts[uVar2]; + uVar3 = gSave.kinstones.amounts[uVar2]; gMenu.column_idx = 0; sub_080A42E0(uVar1, uVar3); uVar4++; @@ -1315,7 +1320,7 @@ void sub_080A6044(void) { if (0x11 < uVar2) { return; } - uVar1 = gSave.kinstoneTypes[uVar2]; + uVar1 = gSave.kinstones.types[uVar2]; } } } @@ -1431,7 +1436,7 @@ void sub_080A62E0(void) { switch (gInput.newKeys) { case A_BUTTON: - if ((gSave.windcrests & (1 << gMenu.field_0x3)) != 0) { + if (IS_BIT_SET(gSave.windcrests, gMenu.field_0x3)) { SoundReq(SFX_TEXTBOX_SELECT); sub_080A4E84(6); windcrest = -1; @@ -1495,7 +1500,7 @@ void sub_080A6438(void) { gOamCmd._4 = 0x400; gOamCmd._6 = 0; gOamCmd._8 = 0; - uVar1 = gSave.field_0x20 & gGenericMenu.unk10.h[0]; + uVar1 = gSave.map_hints & gGenericMenu.unk10.h[0]; for (pcVar2 = gUnk_08128F58, uVar3 = 0; pcVar2->frameIndex != 0; uVar3++, pcVar2++) { if ((1 << uVar3 & uVar1) != 0) { gOamCmd.x = pcVar2->unk1; @@ -1512,7 +1517,7 @@ void sub_080A6498(void) { gOamCmd._6 = 0; gOamCmd._8 = 0; for (i = 0; i <= 0x10; i++) { - if ((gSave.windcrests & (1 << i)) == 0) { + if (!IS_BIT_SET(gSave.windcrests, i)) { gUnk_08128DE8_struct* ptr = &gUnk_08128DE8[i]; gOamCmd.x = ptr->unk6; gOamCmd.y = ptr->unk7; diff --git a/src/menu/pauseMenuScreen6.c b/src/menu/pauseMenuScreen6.c index d1024f99..e36ef549 100644 --- a/src/menu/pauseMenuScreen6.c +++ b/src/menu/pauseMenuScreen6.c @@ -196,7 +196,7 @@ void sub_080A68D4(void) { sub_080A698C(gRoomTransition.player_status.overworld_map_x, gRoomTransition.player_status.overworld_map_y, DRAW_DIRECT_SPRITE_INDEX, iVar6 + 0x100); uVar1 = sub_080A6F40(); - uVar1 &= gSave.field_0x20; + uVar1 &= gSave.map_hints; for (pcVar4 = gUnk_08128F58, i = 0; pcVar4->frameIndex != 0; i++, pcVar4++) { if (((1 << i) & uVar1) != 0) { diff --git a/src/movement.c b/src/movement.c index e24145b5..74882cd9 100644 --- a/src/movement.c +++ b/src/movement.c @@ -2080,7 +2080,7 @@ bool32 MoveNorthWest(Entity* this, s32 radius, s32 angle, u32 collisionType) { bool32 ProcessMovement0(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 0); result = ProcessMovementInternal(this, this->speed, this->direction, 0); } else { @@ -2092,7 +2092,7 @@ bool32 ProcessMovement0(Entity* this) { bool32 ProcessMovement1(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 1); result = ProcessMovementInternal(this, this->speed, this->direction, 1); } else { @@ -2104,7 +2104,7 @@ bool32 ProcessMovement1(Entity* this) { bool32 ProcessMovement2(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 2); result = ProcessMovementInternal(this, this->speed, this->direction, 2); } else { @@ -2116,7 +2116,7 @@ bool32 ProcessMovement2(Entity* this) { bool32 ProcessMovement10(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 10); result = ProcessMovementInternal(this, this->speed, this->direction, 10); } else { @@ -2128,7 +2128,7 @@ bool32 ProcessMovement10(Entity* this) { bool32 ProcessMovement12(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 12); result = ProcessMovementInternal(this, this->speed, this->direction, 12); } else { @@ -2140,7 +2140,7 @@ bool32 ProcessMovement12(Entity* this) { bool32 ProcessMovement0_custom(Entity* this, u32 direction, u32 speed) { bool32 result; - if ((direction & 0x80) == 0) { + if (!(direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, direction, 0); result = ProcessMovementInternal(this, speed, direction, 0); } else { @@ -2152,7 +2152,7 @@ bool32 ProcessMovement0_custom(Entity* this, u32 direction, u32 speed) { bool32 ProcessMovement3(Entity* this) { bool32 result; - if (((this->direction & 0x80) == 0) && (sub_080AF0C8(this) == 0)) { + if (!(this->direction & DIR_NOT_MOVING_CHECK) && !sub_080AF0C8(this)) { CalculateEntityTileCollisions(this, this->direction, 3); result = ProcessMovementInternal(this, this->speed, this->direction, 3); } else { @@ -2165,25 +2165,29 @@ bool32 sub_080AF0C8(Entity* this) { u32 tileType = GetMetaTileTypeByEntity(this); switch (tileType) { case 0x87: - if (((this->direction + 7) & 0x1f) < 0x10) { + if (((this->direction + 7) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_NORTH_ANY; return TRUE; } break; case 0x8a: - if (((this->direction - 1) & 0x1f) < 0x10) { + if (((this->direction - 1) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_EAST_ANY; return TRUE; } break; case 0x88: - if (((this->direction - 9) & 0x1f) < 0x10) { + if (((this->direction - 9) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_SOUTH_ANY; return TRUE; } break; case 0x89: - if (((this->direction - 0x11) & 0x1f) < 0x10) { + if (((this->direction - 0x11) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | + DirectionWest)) < DirectionSouth) { this->collisions = COL_WEST_ANY; return TRUE; } @@ -2195,7 +2199,7 @@ bool32 sub_080AF0C8(Entity* this) { bool32 ProcessMovement4(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 4); result = ProcessMovementInternal(this, this->speed, this->direction, 4); } else { @@ -2207,7 +2211,7 @@ bool32 ProcessMovement4(Entity* this) { bool32 ProcessMovement5(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 5); result = ProcessMovementInternal(this, this->speed, this->direction, 5); } else { @@ -2231,7 +2235,7 @@ void Knockback2(Entity* this) { bool32 ProcessMovement6(Entity* this) { bool32 result; - if ((this->direction & 0x80) == 0) { + if (!(this->direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, this->direction, 6); result = ProcessMovementInternal(this, this->speed, this->direction, 6); } else { @@ -2243,7 +2247,7 @@ bool32 ProcessMovement6(Entity* this) { bool32 ProcessMovement6_custom(Entity* this, u32 direction, u32 speed) { bool32 result; - if ((direction & 0x80) == 0) { + if (!(direction & DIR_NOT_MOVING_CHECK)) { CalculateEntityTileCollisions(this, direction, 6); result = ProcessMovementInternal(this, speed, direction, 6); } else { diff --git a/src/npc/anju.c b/src/npc/anju.c index fa66f537..0c0df5a9 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -1,44 +1,56 @@ +/** + * @file anju.c + * @ingroup NPCs + * + * @brief Anju NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "npc.h" +#include "player.h" -void Anju(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} AnjuEntity; + +void Anju(AnjuEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - this->animationState = this->timer; - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = 1; + super->animationState = super->timer; + InitScriptForNPC(super); return; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitializeAnimation(this, - (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( + GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(super, NULL); } return; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } } } -void Anju_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Anju_MakeInteractable(AnjuEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } -void Anju_Fusion(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = 1; - InitAnimationForceUpdate(this, 6); +void Anju_Fusion(AnjuEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + InitAnimationForceUpdate(super, 6); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 16ed2ec2..38bcb381 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -1,12 +1,18 @@ -#include "global.h" +/** + * @file beedle.c + * @ingroup NPCs + * + * @brief Beedle NPC + */ +#define NENT_DEPRECATED #include "entity.h" +#include "functions.h" +#include "game.h" +#include "item.h" #include "message.h" +#include "npc.h" #include "room.h" #include "script.h" -#include "npc.h" -#include "game.h" -#include "functions.h" -#include "item.h" typedef struct { Rect customHitbox; @@ -14,10 +20,10 @@ typedef struct { u8 unused[3]; } InteractCollisionData; -void sub_080632E0(Entity* this); -void sub_08063314(Entity* this); -void sub_0806336C(Entity* this); -void sub_08063390(Entity* this); +void Beedle_Init(Entity* this); +void Beedle_Action1(Entity* this); +void Beedle_Action2(Entity* this); +void Beedle_Action3(Entity* this); static const u8 gBeedleItems[] = { ITEM_NONE, @@ -41,30 +47,30 @@ static const SpriteLoadData gUnk_0810C8D4[] = { { 0, 0, 0 }, }; -void sub_080632C8(Entity* this); +void Beedle_Update(Entity* this); void sub_08063410(Entity* this); -s32 sub_080633C8(Entity* this); +s32 Beedle_GetAnimIndexFacingPlayer(Entity* this); void sub_0806346C(Entity* this); void Beedle(Entity* this) { if (this->flags & ENT_SCRIPTED) { sub_08063410(this); } else { - sub_080632C8(this); + Beedle_Update(this); } } -void sub_080632C8(Entity* this) { - static void (*const gUnk_0810C8E0[])(Entity*) = { - sub_080632E0, - sub_08063314, - sub_0806336C, - sub_08063390, +void Beedle_Update(Entity* this) { + static void (*const beedleActions[])(Entity*) = { + Beedle_Init, + Beedle_Action1, + Beedle_Action2, + Beedle_Action3, }; - gUnk_0810C8E0[this->action](this); + beedleActions[this->action](this); } -void sub_080632E0(Entity* this) { +void Beedle_Init(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810C8D4)) { InitializeAnimation(this, 0); AddInteractableWhenBigObject(this); @@ -73,27 +79,28 @@ void sub_080632E0(Entity* this) { } } -void sub_08063314(Entity* this) { - u32 offset; +void Beedle_Action1(Entity* this) { + u32 animIndex; - if (((++this->subtimer & 0xF) == 0) && (offset = sub_080633C8(this), this->animIndex != offset)) { - InitializeAnimation(this, offset); + if (((++this->subtimer & 0xF) == 0) && + (animIndex = Beedle_GetAnimIndexFacingPlayer(this), this->animIndex != animIndex)) { + InitializeAnimation(this, animIndex); } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { MessageFromTarget(this->timer + TEXT_INDEX(TEXT_EMPTY, 0x01)); this->action++; } sub_0806ED78(this); } -void sub_0806336C(Entity* this) { +void Beedle_Action2(Entity* this) { if ((gMessage.doTextBox & 0x7F) == 0) { this->action++; InitializeAnimation(this, 8); } } -void sub_08063390(Entity* this) { +void Beedle_Action3(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { this->action = 1; @@ -103,14 +110,13 @@ void sub_08063390(Entity* this) { sub_0806ED78(this); } -s32 sub_080633C8(Entity* this) { - s32 uVar1; - - uVar1 = GetAnimationStateInRectRadius(this, 0x20, 0x20); - if (uVar1 < 0) { - uVar1 = this->animIndex; +// If the player is inside a 32x32 rect, face the player. Otherwise keep facing the same direction. +s32 Beedle_GetAnimIndexFacingPlayer(Entity* this) { + s32 animationState = GetAnimationStateInRectRadius(this, 32, 32); + if (animationState < 0) { + animationState = this->animIndex; } - return uVar1; + return animationState; } void Beedle_Head(Entity* this) { diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 8948059d..ee370eee 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -1,8 +1,20 @@ -#include "npc.h" +/** + * @file bigGoron.c + * @ingroup NPCs + * + * @brief BigGoron NPC + */ +#define NENT_DEPRECATED #include "functions.h" -#include "screen.h" #include "hitbox.h" #include "item.h" +#include "npc.h" +#include "screen.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 originalX; +} BigGoronEntity; static const u16 goronSounds[] = { SFX_VO_GORON1, @@ -14,19 +26,18 @@ static const u16 goronSounds[] = { extern u8 gMapDataTopSpecial[]; extern u8 gUnk_02006F00[]; -void sub_0806D520(Entity*, u32); -void sub_0806D41C(Entity*); -void sub_0806CF30(Entity*); -void sub_0806D1D0(Entity*); -void sub_0806D274(Entity*); -void sub_0806D348(Entity*); -void sub_0806D3C0(Entity*); -void sub_0806D41C(Entity*); -void sub_0806D4F0(Entity*); -void sub_0806D4FC(Entity*); -void sub_0806D508(Entity*); -void sub_0806D514(Entity*); -void sub_0806D40C(Entity*); +void sub_0806D520(BigGoronEntity* this, u32); +void sub_0806CF30(BigGoronEntity* this); +void sub_0806D1D0(BigGoronEntity* this); +void sub_0806D274(BigGoronEntity* this); +void sub_0806D348(BigGoronEntity* this); +void sub_0806D3C0(BigGoronEntity* this); +void sub_0806D41C(BigGoronEntity* this); +void sub_0806D4F0(BigGoronEntity* this); +void sub_0806D4FC(BigGoronEntity* this); +void sub_0806D508(BigGoronEntity* this); +void sub_0806D514(BigGoronEntity* this); +void sub_0806D40C(BigGoronEntity* this); static void sub_0806D02C(Entity* this); @@ -48,7 +59,7 @@ void sub_0806D164(Entity* this); Entity* sub_0806D00C(Entity* this); -void sub_0806D4C0(Entity*, u32); +void sub_0806D4C0(BigGoronEntity* this, u32 type); typedef struct { s8 type; @@ -57,51 +68,51 @@ typedef struct { u8 direction; } struct_08114104; -void BigGoron(Entity* this) { - static void (*const typeFunctions[])(Entity*) = { +void BigGoron(BigGoronEntity* this) { + static void (*const typeFunctions[])(BigGoronEntity*) = { sub_0806CF30, sub_0806D1D0, sub_0806D274, sub_0806D348, sub_0806D3C0, sub_0806D41C, sub_0806D4F0, sub_0806D4FC, sub_0806D508, sub_0806D514, sub_0806D40C, }; - typeFunctions[this->type](this); + typeFunctions[super->type](this); } -void sub_0806CF30(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->subAction = 1; - this->field_0x68.HWORD = this->x.HALF.HI; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0806D0B0(this); - sub_0807DD64(this); +void sub_0806CF30(BigGoronEntity* this) { + if (super->action == 0) { + super->action = 1; + super->subAction = 1; + this->originalX = super->x.HALF.HI; + SetDefaultPriority(super, PRIO_MESSAGE); + sub_0806D0B0(super); + sub_0807DD64(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); } - switch (this->subAction) { + switch (super->subAction) { case 0: case 1: if (gRoomTransition.frameCount % 4 == 0) { - if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI && this->field_0x68.HWORD - 32 < this->x.HALF.HI) { - this->x.HALF.HI--; + if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI && this->originalX - 32 < super->x.HALF.HI) { + super->x.HALF.HI--; } - if (gPlayerEntity.x.HALF.HI > this->x.HALF.HI && this->field_0x68.HWORD + 32 > this->x.HALF.HI) { - this->x.HALF.HI++; + if (gPlayerEntity.x.HALF.HI > super->x.HALF.HI && this->originalX + 32 > super->x.HALF.HI) { + super->x.HALF.HI++; } } break; case 2: - if (--this->timer == 0) { + if (--super->timer == 0) { u32 uVar2 = Random(); SoundReq(goronSounds[uVar2 % 4]); - this->timer = ((u8)uVar2 & 7) * 16; - this->timer += 128; + super->timer = ((u8)uVar2 & 7) * 16; + super->timer += 128; } break; case 3: break; } - sub_0806D02C(this); + sub_0806D02C(super); } Entity* sub_0806D00C(Entity* this) { @@ -192,228 +203,228 @@ void sub_0806D164(Entity* this) { gScreen.bg1.updated = 1; } -void sub_0806D1D0(Entity* this) { - if (this->action == 0) { - if (sub_0806D00C(this) == NULL) { +void sub_0806D1D0(BigGoronEntity* this) { + if (super->action == 0) { + if (sub_0806D00C(super) == NULL) { DeleteThisEntity(); } - this->action = 1; - this->spriteOrientation.flipY = 3; - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = 7; - this->spriteSettings.draw = 3; - this->frameIndex = 0; - this->timer = 30; - SetDefaultPriority(this, PRIO_MESSAGE); + super->action = 1; + super->spriteOrientation.flipY = 3; + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = 7; + super->spriteSettings.draw = 3; + super->frameIndex = 0; + super->timer = 30; + SetDefaultPriority(super, PRIO_MESSAGE); } - switch (this->subAction) { + switch (super->subAction) { case 0: default: - if (--this->timer == 0) { - this->timer = (Random() & 0x7f) + 48; - this->subtimer = 8; - this->frameIndex = 1; + if (--super->timer == 0) { + super->timer = (Random() & 0x7f) + 48; + super->subtimer = 8; + super->frameIndex = 1; } - if (this->subtimer != 0) { - if (--this->subtimer == 0) { - this->frameIndex = 0; + if (super->subtimer != 0) { + if (--super->subtimer == 0) { + super->frameIndex = 0; } } break; case 1: - this->frameIndex = this->subAction; + super->frameIndex = super->subAction; break; case 2: - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; break; } - this->x.HALF.HI = this->parent->x.HALF.HI; - this->y.HALF.HI = this->parent->y.HALF.HI; + super->x.HALF.HI = super->parent->x.HALF.HI; + super->y.HALF.HI = super->parent->y.HALF.HI; } -void sub_0806D274(Entity* this) { +void sub_0806D274(BigGoronEntity* this) { Entity* npc; - if (this->action == 0) { - if (sub_0806D00C(this) == NULL) { + if (super->action == 0) { + if (sub_0806D00C(super) == NULL) { DeleteThisEntity(); } - this->action = 1; - this->spriteOrientation.flipY = 3; - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = 7; - this->frameIndex = 2; - this->timer = 8; - SetDefaultPriority(this, PRIO_MESSAGE); + super->action = 1; + super->spriteOrientation.flipY = 3; + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = 7; + super->frameIndex = 2; + super->timer = 8; + SetDefaultPriority(super, PRIO_MESSAGE); npc = CreateNPC(BIG_GORON, 3, 0); if (npc != NULL) { - npc->child = this; + npc->child = super; } } - switch (this->subAction) { + switch (super->subAction) { case 0: case 1: default: if ((gMessage.doTextBox & 0x7f) == 0) { - this->frameIndex = 2; + super->frameIndex = 2; break; } - if (--this->timer == 0) { - this->timer = 8; - this->frameIndex ^= 1; + if (--super->timer == 0) { + super->timer = 8; + super->frameIndex ^= 1; } break; case 2: - if (--this->timer == 0) { - this->timer = 8; - this->frameIndex ^= 1; + if (--super->timer == 0) { + super->timer = 8; + super->frameIndex ^= 1; } break; case 3: - this->frameIndex = 4; + super->frameIndex = 4; break; case 4: - this->frameIndex = 2; + super->frameIndex = 2; break; } - this->x.HALF.HI = this->parent->x.HALF.HI; - this->y.HALF.HI = this->parent->y.HALF.HI; + super->x.HALF.HI = super->parent->x.HALF.HI; + super->y.HALF.HI = super->parent->y.HALF.HI; } -void sub_0806D348(Entity* this) { - if (this->action == 0) { - if (sub_0806D00C(this) == NULL) { +void sub_0806D348(BigGoronEntity* this) { + if (super->action == 0) { + if (sub_0806D00C(super) == NULL) { DeleteThisEntity(); } - this->action = 1; - this->spriteOrientation.flipY = 3; - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = 6; - this->spriteSettings.draw = 0; - this->frameIndex = 5; - SetDefaultPriority(this, PRIO_MESSAGE); + super->action = 1; + super->spriteOrientation.flipY = 3; + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = 6; + super->spriteSettings.draw = 0; + super->frameIndex = 5; + SetDefaultPriority(super, PRIO_MESSAGE); } - if (this->child->frameIndex == 4) { - this->spriteSettings.draw = 3; + if (super->child->frameIndex == 4) { + super->spriteSettings.draw = 3; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } - this->x.HALF.HI = this->parent->x.HALF.HI; - this->y.HALF.HI = this->parent->y.HALF.HI; + super->x.HALF.HI = super->parent->x.HALF.HI; + super->y.HALF.HI = super->parent->y.HALF.HI; } -void sub_0806D3C0(Entity* this) { - if (this->action == 0) { - if (sub_0806D00C(this) == NULL) { +void sub_0806D3C0(BigGoronEntity* this) { + if (super->action == 0) { + if (sub_0806D00C(super) == NULL) { DeleteThisEntity(); } - this->action = 1; - this->hitbox = (Hitbox*)&gHitbox_3; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD64(this); + super->action = 1; + super->hitbox = (Hitbox*)&gHitbox_3; + SetDefaultPriority(super, PRIO_MESSAGE); + sub_0807DD64(super); } else { - this->x.HALF.HI = this->parent->x.HALF.HI; - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); + super->x.HALF.HI = super->parent->x.HALF.HI; + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); } } -void sub_0806D40C(Entity* this) { - this->spriteSettings.flipX = 1; +void sub_0806D40C(BigGoronEntity* this) { + super->spriteSettings.flipX = 1; sub_0806D41C(this); } -void sub_0806D41C(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->frameIndex = 6; - sub_0807DD64(this); +void sub_0806D41C(BigGoronEntity* this) { + if (super->action == 0) { + super->action = 1; + super->frameIndex = 6; + sub_0807DD64(super); sub_0806D4C0(this, 0); sub_0806D4C0(this, 1); sub_0806D4C0(this, 2); sub_0806D4C0(this, 3); - SetDefaultPriority(this, PRIO_MESSAGE); + SetDefaultPriority(super, PRIO_MESSAGE); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); } if ((gRoomTransition.frameCount & 1) == 0) { - if (CheckPlayerProximity(this->x.HALF.HI - 0x20, this->y.HALF.HI, 0x40, 0x40) != 0) { - if (this->spriteOffsetY > -8) { - this->spriteOffsetY--; + if (CheckPlayerProximity(super->x.HALF.HI - 0x20, super->y.HALF.HI, 0x40, 0x40) != 0) { + if (super->spriteOffsetY > -8) { + super->spriteOffsetY--; } } else { - if (this->spriteOffsetY < 0) { - this->spriteOffsetY++; + if (super->spriteOffsetY < 0) { + super->spriteOffsetY++; } } } } -void sub_0806D4C0(Entity* this, u32 param) { - Entity* npc = CreateNPC(BIG_GORON, param + 6, 0); +void sub_0806D4C0(BigGoronEntity* this, u32 type) { + Entity* npc = CreateNPC(BIG_GORON, type + 6, 0); if (npc != NULL) { - npc->parent = this; - CopyPosition(this, npc); - SortEntityAbove(this, npc); + npc->parent = super; + CopyPosition(super, npc); + SortEntityAbove(super, npc); SetDefaultPriority(npc, PRIO_MESSAGE); } } -void sub_0806D4F0(Entity* this) { +void sub_0806D4F0(BigGoronEntity* this) { sub_0806D520(this, 0); } -void sub_0806D4FC(Entity* this) { +void sub_0806D4FC(BigGoronEntity* this) { sub_0806D520(this, 1); } -void sub_0806D508(Entity* this) { +void sub_0806D508(BigGoronEntity* this) { sub_0806D520(this, 2); } -void sub_0806D514(Entity* this) { +void sub_0806D514(BigGoronEntity* this) { sub_0806D520(this, 3); } -void sub_0806D520(Entity* this, u32 param_2) { +void sub_0806D520(BigGoronEntity* this, u32 param_2) { static const u8 gUnk_08114100[] = { 10, 7, 4, 1, }; - if (this->action == 0) { - this->action = 1; - this->subtimer = gUnk_08114100[param_2] + 6; - this->frameIndex = this->subtimer; - this->timer = 8; + if (super->action == 0) { + super->action = 1; + super->subtimer = gUnk_08114100[param_2] + 6; + super->frameIndex = super->subtimer; + super->timer = 8; } - this->x.HALF.HI = this->parent->x.HALF.HI; - this->y.HALF.HI = this->parent->y.HALF.HI; - this->spriteOffsetX = this->parent->spriteOffsetX; - this->spriteOffsetY = this->parent->spriteOffsetY; - this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; - if (this->subAction != 0 || - CheckPlayerProximity(this->x.HALF.HI + param_2 * -0x10 + 0xc, this->y.HALF.HI, 0x18, 0x40)) { - if (this->frameIndex >= this->subtimer + 2) { + super->x.HALF.HI = super->parent->x.HALF.HI; + super->y.HALF.HI = super->parent->y.HALF.HI; + super->spriteOffsetX = super->parent->spriteOffsetX; + super->spriteOffsetY = super->parent->spriteOffsetY; + super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY; + if (super->subAction != 0 || + CheckPlayerProximity(super->x.HALF.HI + param_2 * -0x10 + 0xc, super->y.HALF.HI, 0x18, 0x40)) { + if (super->frameIndex >= super->subtimer + 2) { return; } - if (--this->timer != 0) { + if (--super->timer != 0) { return; } - this->timer = 8; - this->frameIndex++; + super->timer = 8; + super->frameIndex++; } else { - if (this->frameIndex <= this->subtimer) { + if (super->frameIndex <= super->subtimer) { return; } - if (--this->timer != 0) { + if (--super->timer != 0) { return; } - this->timer = 8; - this->frameIndex--; + super->timer = 8; + super->frameIndex--; } } @@ -429,7 +440,7 @@ void sub_0806D5D4(void) { } void sub_0806D600(Entity* this, ScriptExecutionContext* context) { - context->condition = gSave.timers[2] == 0; + context->condition = gSave.biggoron_timer == 0; } void sub_0806D620(void) { @@ -443,7 +454,7 @@ void sub_0806D638(Entity* this) { void sub_0806D640(Entity* this) { this->y.HALF.HI += 0x20; - this->interactType = 0; + this->interactType = INTERACTION_NONE; } void sub_0806D650(Entity* this) { diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 11cc0864..c5589933 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -1,3 +1,10 @@ +/** + * @file bladeBrothers.c + * @ingroup NPCs + * + * @brief Blade Brothers NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -10,6 +17,13 @@ #include "save.h" #include "script.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 itemSlotA; + /*0x6a*/ u8 itemSlotB; +} BladeBrothersEntity; + void sub_08068A1C(Entity*); void sub_08068A4C(Entity*); void sub_08068AA4(Entity*); @@ -20,10 +34,10 @@ void (*const gUnk_081115C0[])(Entity*) = { sub_08068AA4, sub_08068ADC, }; -void sub_08068AFC(Entity*); -void sub_08068b2c(Entity*); -void sub_08068B70(Entity*); -void (*const gUnk_081115D0[])(Entity*) = { +void sub_08068AFC(BladeBrothersEntity*); +void sub_08068b2c(BladeBrothersEntity*); +void sub_08068B70(BladeBrothersEntity*); +void (*const gUnk_081115D0[])(BladeBrothersEntity*) = { sub_08068AFC, sub_08068b2c, sub_08068B70, @@ -69,9 +83,9 @@ const u8 gUnk_0811162B[] = { ITEM_SKILL_SWORD_BEAM, ITEM_SKILL_PERIL_BEAM, ITEM_SKILL_GREAT_SPIN, - 243, - 244, - 245, + ITEM_SKILL_FAST_SPIN | 0x80, + ITEM_SKILL_FAST_SPLIT | 0x80, + ITEM_SKILL_LONG_SPIN | 0x80, 0, 0, 0, @@ -219,16 +233,16 @@ extern EntityData gUnk_080F3494; static void sub_08068BEC(Entity* this, u32 unused); -void BladeBrothers(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { - gUnk_081115D0[this->action](this); +void BladeBrothers(BladeBrothersEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { + gUnk_081115D0[super->action](this); } else { - gUnk_081115C0[this->action](this); - sub_0806ED78(this); + gUnk_081115C0[super->action](super); + sub_0806ED78(super); } - if ((this->frame & 1) != 0) { - this->frame &= 0xfe; - sub_08068BEC(this, 0); + if ((super->frame & 1) != 0) { + super->frame &= 0xfe; + sub_08068BEC(super, 0); } } @@ -269,8 +283,8 @@ void sub_08068A4C(Entity* this) { if (iVar2 == 0) { GetNextFrame(this); } - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; this->action = 2; MessageFromTarget(0); } @@ -295,31 +309,30 @@ void sub_08068ADC(Entity* this) { sub_0806FD3C(this); } -void sub_08068AFC(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - sub_0807DD50(this); +void sub_08068AFC(BladeBrothersEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitScriptForNPC(super); } -void sub_08068b2c(Entity* this) { - u32 uVar1; - - if (this->interactType == '\x02') { - this->action = 2; - this->interactType = 0; - uVar1 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); - InitAnimationForceUpdate(this, uVar1); - sub_0806F118(this); +void sub_08068b2c(BladeBrothersEntity* this) { + u32 animationState; + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + InitAnimationForceUpdate(super, animationState); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } } -void sub_08068B70(Entity* this) { - if (UpdateFuseInteraction(this)) { - this->action = 1; +void sub_08068B70(BladeBrothersEntity* this) { + if (UpdateFuseInteraction(super)) { + super->action = 1; } } @@ -333,18 +346,18 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext InitPlayerMacro((PlayerMacroEntry*)BladeBrothers_PlayerMacros[this->timer]); } -void sub_08068BB4(Entity* this) { +void sub_08068BB4(BladeBrothersEntity* this) { u32 item = gSave.stats.itemButtons[SLOT_A]; - this->field_0x68.HALF.HI = item; + this->itemSlotA = item; item = gSave.stats.itemButtons[SLOT_B]; - *(&this->field_0x68.HALF.HI + 1) = item; + this->itemSlotB = item; } // Restore previous equipped items. -void sub_08068BD0(Entity* this) { - ForceEquipItem(this->field_0x68.HALF.HI, EQUIP_SLOT_A); - ForceEquipItem(*(u8*)(&this->field_0x68.HALF.HI + 1), EQUIP_SLOT_B); +void sub_08068BD0(BladeBrothersEntity* this) { + ForceEquipItem(this->itemSlotA, EQUIP_SLOT_A); + ForceEquipItem(this->itemSlotB, EQUIP_SLOT_B); } static void sub_08068BEC(Entity* this, u32 unused) { @@ -431,22 +444,22 @@ void sub_08068CFC(Entity* this, ScriptExecutionContext* context) { context->condition = 1; return; case 1: - itemID = 0x2; + itemID = ITEM_GREEN_SWORD; break; case 2: - itemID = 0x15; + itemID = ITEM_PEGASUS_BOOTS; break; case 3: - itemID = 0x14; + itemID = ITEM_ROCS_CAPE; break; case 5: - if (CheckLocalFlag(3) == 0) { + if (CheckLocalFlag(DOUKUTU_05_EVENT) == 0) { return; } context->condition = 1; return; case 6: - if (gSave.stats.maxHealth < 0x50) + if (gSave.stats.maxHealth < (10 * 8)) // ten hearts return; context->condition = 1; return; diff --git a/src/npc/brocco.c b/src/npc/brocco.c index e02ca622..9236bb60 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -1,19 +1,32 @@ +/** + * @file brocco.c + * @ingroup NPCs + * + * @brief Brocco NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "message.h" -#include "save.h" #include "npc.h" +#include "save.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} BroccoEntity; void sub_08063544(Entity*); -void sub_0806362C(Entity*); +void sub_0806362C(BroccoEntity*); void sub_0806355C(Entity*); void sub_08063584(Entity*); void sub_08063608(Entity*); -void Brocco(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { +void Brocco(BroccoEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_0806362C(this); } else { - sub_08063544(this); + sub_08063544(super); } } @@ -50,7 +63,7 @@ void sub_08063584(Entity* this) { } } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; InitAnimationForceUpdate(this, GetAnimationState(this) + 4); MessageFromTarget(this->timer + TEXT_INDEX(TEXT_EMPTY, 0x01)); @@ -67,32 +80,33 @@ void sub_08063608(Entity* this) { } } -void sub_0806362C(Entity* this) { - switch (this->action) { +void sub_0806362C(BroccoEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.HI = 0; - sub_0807DD64(this); + super->action = 1; + super->spriteSettings.draw = 1; + this->animIndex = 0; + sub_0807DD64(super); case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - UpdateAnimationSingleFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + UpdateAnimationSingleFrame(super); } break; case 2: - if (UpdateFuseInteraction(this) == 0) { + if (UpdateFuseInteraction(super) == 0) { return; } - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.HI); + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); break; } } @@ -114,9 +128,9 @@ void sub_080636D8(Entity* this) { ShowNPCDialogue(this, &gUnk_0810CAAC[gSave.global_progress]); } -void Brocco_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Brocco_MakeInteractable(BroccoEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Brocco_Fusion(Entity* this) { diff --git a/src/npc/carlov.c b/src/npc/carlov.c index ec97c9ba..0cc92008 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -1,14 +1,21 @@ -#include "sound.h" +/** + * @file carlov.c + * @ingroup NPCs + * + * @brief Carlov NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "room.h" #include "npc.h" +#include "room.h" +#include "sound.h" void Carlov(Entity* this) { if (this->action == 0) { this->action++; - sub_0807DD50(this); + InitScriptForNPC(this); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } if ((this->frame & 0x10) != 0) { this->frame &= ~0x10; diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index f54795e0..2157168f 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -1,8 +1,22 @@ -#include "global.h" +/** + * @file carpenter.c + * @ingroup NPCs + * + * @brief Carpenter NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" -#include "npc.h" #include "item.h" +#include "npc.h" +#include "player.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; + /*0x6a*/ u8 unused[26]; + /*0x84*/ ScriptExecutionContext* context; +} CarpenterEntity; static const SpriteLoadData gUnk_08110CA8[] = { { 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0x4001, 0x3f, 0x4 }, { 0, 0, 0 }, @@ -11,38 +25,38 @@ static const SpriteLoadData gUnk_08110CA8[] = { { 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 }, }; -void Carpenter(Entity* this) { - if (*(u32*)&this->cutsceneBeh == 0) { +void Carpenter(CarpenterEntity* this) { + if (this->context == NULL) { DeleteThisEntity(); } - switch (this->action) { + switch (super->action) { case 0: - if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->type * 4)) + if (!LoadExtraSpriteData(super, gUnk_08110CA8 + super->type * 4)) break; - this->action = 1; - this->field_0x68.HALF.HI = 0; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD64(this); + super->action = 1; + this->animIndex = 0; + SetDefaultPriority(super, PRIO_MESSAGE); + sub_0807DD64(super); case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, - sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->type * 8)); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + + 4 + (super->type * 8)); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, 0); - HandleEntity0x82Actions(this); - GetNextFrame(this); + ExecuteScriptForEntity(super, 0); + HandleEntity0x82Actions(super); + GetNextFrame(super); } break; case 2: - if (!UpdateFuseInteraction(this)) + if (!UpdateFuseInteraction(super)) break; - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + super->action = 1; + InitializeAnimation(super, this->animIndex); break; } } @@ -91,15 +105,15 @@ void sub_08067304(Entity* this) { ShowNPCDialogue(this, &dialog); } -void Carpenter_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Carpenter_MakeInteractable(CarpenterEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Carpenter_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type * 4])) { - this->action = this->action + 1; + this->action++; this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); InitializeAnimation(this, (u32)this->type * 8 + 2); diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index c17db2f8..2001f0d2 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -1,12 +1,18 @@ +/** + * @file castleMaid.c + * @ingroup NPCs + * + * @brief Castle Maid NPC + */ #define NENT_DEPRECATED #include "entity.h" -#include "script.h" -#include "save.h" #include "flags.h" +#include "functions.h" +#include "manager.h" #include "message.h" #include "npc.h" -#include "manager.h" -#include "functions.h" +#include "save.h" +#include "script.h" typedef struct { Entity base; @@ -80,13 +86,13 @@ void sub_08064570(CastleMaidEntity* this) { this->field_0x6e = tmp2; } this->dialogFunc = NULL; - sub_0807DD50(super); + InitScriptForNPC(super); case 1: - sub_0807DD94(super, NULL); - if (super->interactType != 0) { + ExecuteScriptAndHandleAnimation(super, NULL); + if (super->interactType != INTERACTION_NONE) { super->action++; - super->interactType = 0; - InitializeAnimation(super, sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity))); + super->interactType = INTERACTION_NONE; + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); if (this->dialogFunc != NULL) { this->dialogFunc(); } @@ -172,7 +178,7 @@ void sub_080646A4(CastleMaidEntity* this, ScriptExecutionContext* context) { break; } super->direction = dir; - super->animationState = sub_0806F5B0(dir); + super->animationState = GetAnimationStateForDirection8(dir); super->speed = 0x80; } diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index 6305f026..1a7c926f 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -1,3 +1,10 @@ +/** + * @file castorWildsStatue.c + * @ingroup NPCs + * + * @brief Castor Wilds Statue NPC + */ +#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" @@ -7,6 +14,12 @@ #include "sound.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[12]; + /*0x74*/ u16 tilePos; +} CastorWildsStatueEntity; + static const Hitbox gUnk_08110E94; typedef struct { @@ -18,25 +31,25 @@ void sub_080673C0(Entity*); void sub_080673F4(Entity*); void sub_08067410(Entity*); void sub_0806752C(Entity*); -void sub_08067418(Entity*); -void sub_08067514(Entity*); +void sub_08067418(CastorWildsStatueEntity*); +void sub_08067514(CastorWildsStatueEntity*); -void CastorWildsStatue(Entity* this) { +void CastorWildsStatue(CastorWildsStatueEntity* this) { static void (*const actionFuncs[])(Entity*) = { sub_080673C0, sub_080673F4, sub_08067410, sub_0806752C, }; - static void (*const scriptedActionFuncs[])(Entity*) = { + static void (*const scriptedActionFuncs[])(CastorWildsStatueEntity*) = { sub_08067418, sub_08067514, }; - if ((this->flags & ENT_SCRIPTED) != 0) { - scriptedActionFuncs[this->action](this); + if ((super->flags & ENT_SCRIPTED) != 0) { + scriptedActionFuncs[super->action](this); } else { - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](super); + sub_0806ED78(super); } } @@ -53,9 +66,9 @@ void sub_080673C0(Entity* this) { } void sub_080673F4(Entity* this) { - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; - this->interactType = 0; + this->interactType = INTERACTION_NONE; } } @@ -63,20 +76,20 @@ void sub_08067410(Entity* this) { this->action = 1; } -void sub_08067418(Entity* this) { - this->action = 1; - this->field_0x74.HWORD = COORD_TO_TILE(this); - if (this->type == 0) { - this->hitbox = (Hitbox*)&gUnk_08110E94; - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD - 1, this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD, this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD + 0x3f, this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD + 0x40, this->collisionLayer); +void sub_08067418(CastorWildsStatueEntity* this) { + super->action = 1; + this->tilePos = COORD_TO_TILE(super); + if (super->type == 0) { + super->hitbox = (Hitbox*)&gUnk_08110E94; + SetMetaTile(SPECIAL_META_TILE_34, this->tilePos - 1, super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, this->tilePos, super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, this->tilePos + 0x3f, super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, this->tilePos + 0x40, super->collisionLayer); } else { - this->collisionLayer = 3; - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 1; - this->spritePriority.b0 = 2; + super->collisionLayer = 3; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; + super->spritePriority.b0 = 2; if (CheckLocalFlag(HIKYOU_00_SEKIZOU) == 0) { SetMetaTile(SPECIAL_META_TILE_34, TILE_POS(1, 58), LAYER_BOTTOM); SetMetaTile(SPECIAL_META_TILE_34, TILE_POS(2, 58), LAYER_BOTTOM); @@ -84,13 +97,13 @@ void sub_08067418(Entity* this) { SetMetaTile(SPECIAL_META_TILE_34, TILE_POS(3, 59), LAYER_BOTTOM); } } - sub_0807DD50(this); + InitScriptForNPC(super); } -void sub_08067514(Entity* this) { - sub_0807DD94(this, NULL); - if (this->type == 0) { - sub_0806ED78(this); +void sub_08067514(CastorWildsStatueEntity* this) { + ExecuteScriptAndHandleAnimation(super, NULL); + if (super->type == 0) { + sub_0806ED78(super); } } diff --git a/src/npc/cat.c b/src/npc/cat.c index 33586cb9..aa2d221e 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -1,35 +1,55 @@ -#include "global.h" +/** + * @file cat.c + * @ingroup NPCs + * + * @brief Cat NPC + */ +#define NENT_DEPRECATED +#include "enemy.h" #include "entity.h" #include "functions.h" -#include "save.h" #include "message.h" #include "npc.h" -#include "enemy.h" +#include "save.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unk_69; + /*0x6a*/ u8 unused[2]; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u16 unk_6e; + /*0x70*/ u8 unk_70; + /*0x71*/ u8 unk_71; + /*0x72*/ u16 unk_72; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; +} CatEntity; static const Hitbox gUnk_08110EF0 = { 0, -1, { 5, 3, 3, 5 }, 5, 4 }; -void sub_08067C44(Entity*); -void sub_08067B08(Entity*); -u32 sub_08067D20(Entity*); -void sub_08067AAC(Entity*); -void sub_08067B34(Entity*); -void sub_08067B80(Entity*, u32); -void sub_08067B70(Entity*); -void sub_08067C24(Entity*); +void sub_08067C44(CatEntity*); +void sub_08067B08(CatEntity*); +bool32 sub_08067D20(CatEntity*); +void sub_08067AAC(CatEntity*); +void sub_08067B34(CatEntity*); +void sub_08067B80(CatEntity*, u32); +void sub_08067B70(CatEntity*); +void sub_08067C24(CatEntity*); void sub_08067BD4(Entity*); -u32 sub_08067D74(Entity*); +bool32 sub_08067D74(Entity*); void sub_08067C18(Entity*); -void sub_08067DCC(Entity*, u32); +void sub_08067DCC(CatEntity*, u32); void sub_08067DDC(Entity*); -void sub_080677EC(Entity*); -void sub_080678AC(Entity*); -void sub_08067904(Entity*); -void sub_0806797C(Entity*); -void sub_0806799C(Entity*); -void sub_080679C4(Entity*); -void sub_08067A0C(Entity*); -void sub_08067A78(Entity*); -void sub_08067A98(Entity*); +void sub_080677EC(CatEntity*); +void sub_080678AC(CatEntity*); +void sub_08067904(CatEntity*); +void sub_0806797C(CatEntity*); +void sub_0806799C(CatEntity*); +void sub_080679C4(CatEntity*); +void sub_08067A0C(CatEntity*); +void sub_08067A78(CatEntity*); +void sub_08067A98(CatEntity*); extern Hitbox* gUnk_08111154[8]; @@ -100,159 +120,154 @@ void sub_08067790(Entity* this) { } // Main -void Cat(Entity* ent) { - static void (*const actionFuncs[9])(Entity*) = { +void Cat(CatEntity* this) { + static void (*const actionFuncs[9])(CatEntity*) = { sub_080677EC, sub_080678AC, sub_08067904, sub_0806797C, sub_0806799C, sub_080679C4, sub_08067A0C, sub_08067A78, sub_08067A98, }; - actionFuncs[ent->action](ent); - sub_08067C44(ent); - if (((ent->flags & ENT_COLLIDE) == 0) && (ent->type != 5)) { - sub_0806ED78(ent); + actionFuncs[super->action](this); + sub_08067C44(this); + if (((super->flags & ENT_COLLIDE) == 0) && (super->type != 5)) { + sub_0806ED78(super); } } -void sub_080677EC(Entity* this) { +void sub_080677EC(CatEntity* this) { u32 uVar2; - this->spriteSettings.draw = 1; - this->direction = 8; - this->speed = 0x80; - this->collisionFlags = 7; - this->hurtType = 0x48; - this->hitType = -0x58; - this->flags2 = 1; - this->field_0x68.HALF.HI = 0xff; - if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) { - this->spriteSettings.flipX = 1; + super->spriteSettings.draw = 1; + super->direction = 8; + super->speed = 0x80; + super->collisionFlags = 7; + super->hurtType = 0x48; + super->hitType = -0x58; + super->flags2 = 1; + this->unk_69 = 0xff; + if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + super->spriteSettings.flipX = 1; } else { - this->spriteSettings.flipX = 0; + super->spriteSettings.flipX = 0; } - this->field_0x68.HALF.LO = GetFusionToOffer(this); - this->hitbox = (Hitbox*)&gUnk_08110EF0; - uVar2 = sub_0805ACC0(this); + this->fusionOffer = GetFusionToOffer(super); + super->hitbox = (Hitbox*)&gUnk_08110EF0; + uVar2 = sub_0805ACC0(super); if (uVar2 == 0) { - uVar2 = this->x.HALF.HI; + uVar2 = super->x.HALF.HI; } else { uVar2 >>= 0x10; } - this->field_0x6c.HWORD = uVar2; - this->field_0x6e.HWORD = this->timer + uVar2; - this->timer = 0; - this->field_0x74.HALF.HI = 0; - this->field_0x74.HALF.LO = (Random() & 0x7f) + 0x1e; - this->field_0x68.HALF.HI = 0xff; + this->unk_6c = uVar2; + this->unk_6e = super->timer + uVar2; + super->timer = 0; + this->unk_75 = 0; + this->unk_74 = (Random() & 0x7f) + 0x1e; + this->unk_69 = 0xff; sub_08067B08(this); } -void sub_080678AC(Entity* this) { - u32 iVar1; - u16* psVar2; - - iVar1 = sub_08067D20(this); - if (iVar1 != 0) { +void sub_080678AC(CatEntity* this) { + if (sub_08067D20(this)) { sub_08067B80(this, 5); } else { - psVar2 = (u16*)&this->field_0x70.HALF.HI; - if (*psVar2 != 0) { - *psVar2 = *psVar2 - 1; + if (this->unk_72 != 0) { + this->unk_72--; } - if ((this->frame == 1) && (*psVar2 == 0)) { + if ((super->frame == 1) && (this->unk_72 == 0)) { sub_08067AAC(this); } else { - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) != 0) { + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) != 0) { sub_08067B34(this); } } } } -void sub_08067904(Entity* this) { +void sub_08067904(CatEntity* this) { if (sub_08067D20(this) != 0) { sub_08067B80(this, 8); return; } - this->field_0x70.HALF.HI--; - if (this->field_0x70.HALF.HI == 0) { + this->unk_72--; + if (this->unk_72 == 0) { sub_08067B70(this); return; } - if (this->direction == 8) { - if (this->x.HALF.HI > this->field_0x6e.HWORD) { - this->direction = 0x18; - this->spriteSettings.flipX = 0; + if (super->direction == 8) { + if (super->x.HALF.HI > this->unk_6e) { + super->direction = 0x18; + super->spriteSettings.flipX = 0; } } else { - if (this->x.HALF.HI < this->field_0x6c.HWORD) { - this->direction = 8; - this->spriteSettings.flipX = 1; + if (super->x.HALF.HI < this->unk_6c) { + super->direction = 8; + super->spriteSettings.flipX = 1; } } - LinearMoveUpdate(this); - UpdateAnimationSingleFrame(this); + LinearMoveUpdate(super); + UpdateAnimationSingleFrame(super); } -void sub_0806797C(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { +void sub_0806797C(CatEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { sub_08067B08(this); } } -void sub_0806799C(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_0806799C(CatEntity* this) { + UpdateAnimationSingleFrame(super); if ((gMessage.doTextBox & 0x7f) == 0) { sub_08067B08(this); - SetDefaultPriority(this, PRIO_PLAYER); + SetDefaultPriority(super, PRIO_PLAYER); } } -void sub_080679C4(Entity* this) { - if (this->field_0x74.HALF.LO == 0 || --this->field_0x74.HALF.LO == 0 || sub_08067D20(this) == 0) { +void sub_080679C4(CatEntity* this) { + if (this->unk_74 == 0 || --this->unk_74 == 0 || sub_08067D20(this) == 0) { sub_08067C24(this); } else { - UpdateAnimationSingleFrame(this); - sub_08067BD4(this); - if (sub_08067D74(this) != 0) { - sub_08067C18(this); + UpdateAnimationSingleFrame(super); + sub_08067BD4(super); + if (sub_08067D74(super) != 0) { + sub_08067C18(super); } } } -void sub_08067A0C(Entity* this) { +void sub_08067A0C(CatEntity* this) { u8 tmp; - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { - if (sub_08067D20(this) != 0) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { + if (sub_08067D20(this)) { sub_08067B80(this, 5); - this->timer += 20; + super->timer += 20; } else { sub_08067C24(this); } } else { - tmp = (this->frame & 7); + tmp = (super->frame & 7); if (tmp != 0) { - COLLISION_ON(this); - this->hitbox = gUnk_08111154[tmp - 1 + ((this->spriteSettings.flipX << 2))]; + COLLISION_ON(super); + super->hitbox = gUnk_08111154[tmp - 1 + ((super->spriteSettings.flipX << 2))]; } else { - sub_08067DDC(this); + sub_08067DDC(super); } } } -void sub_08067A78(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { +void sub_08067A78(CatEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { sub_08067AAC(this); } } -void sub_08067A98(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { +void sub_08067A98(CatEntity* this) { + if (UpdateFuseInteraction(super) != 0) { sub_08067B08(this); } } @@ -274,43 +289,43 @@ static const u16 gUnk_08111104[] = { static const u8 gUnk_0811110C[] = { 0x3c, 0x96, 0x14 }; static const u8 gUnk_0811110F[] = { 0, -4, 8, 8, 0 }; -void sub_08067AAC(Entity* this) { - this->action = 2; - this->field_0x70.HALF.HI = gUnk_081110FC[(Random() & 3)]; +void sub_08067AAC(CatEntity* this) { + super->action = 2; + this->unk_72 = gUnk_081110FC[(Random() & 3)]; - this->spriteSettings.flipX = this->direction >> 4 ^ 1; + super->spriteSettings.flipX = super->direction >> 4 ^ 1; sub_08067DCC(this, 3); - SetInteractableObjectCollision(this, 0, gUnk_0811110C[2], gUnk_0811110F); + SetInteractableObjectCollision(super, 0, gUnk_0811110C[2], gUnk_0811110F); } -void sub_08067B08(Entity* this) { - this->action = 1; - this->field_0x70.HALF.HI = gUnk_08111104[Random() & 3]; +void sub_08067B08(CatEntity* this) { + super->action = 1; + this->unk_72 = gUnk_08111104[Random() & 3]; sub_08067B34(this); } -void sub_08067B34(Entity* this) { +void sub_08067B34(CatEntity* this) { sub_08067DCC(this, 0); - this->frameDuration = (Random() & 0x30) + 0xb4; - SetInteractableObjectCollision(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F); + super->frameDuration = (Random() & 0x30) + 0xb4; + SetInteractableObjectCollision(super, 0, gUnk_0811110C[super->spriteSettings.flipX], gUnk_0811110F); } -void sub_08067B70(Entity* this) { - this->action = 3; +void sub_08067B70(CatEntity* this) { + super->action = 3; sub_08067DCC(this, 4); } -void sub_08067B80(Entity* this, u32 param) { - this->action = 5; - this->timer = 20; - this->field_0x74.HALF.LO = (Random() & 0x7f) + 0x1e; - InitAnimationForceUpdate(this, param); - sub_08067DDC(this); - if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) { - this->spriteSettings.flipX = 1; +void sub_08067B80(CatEntity* this, u32 animIndex) { + super->action = 5; + super->timer = 20; + this->unk_74 = (Random() & 0x7f) + 0x1e; + InitAnimationForceUpdate(super, animIndex); + sub_08067DDC(super); + if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + super->spriteSettings.flipX = 1; } else { - this->spriteSettings.flipX = 0; + super->spriteSettings.flipX = 0; } } @@ -331,14 +346,14 @@ void sub_08067C18(Entity* this) { InitAnimationForceUpdate(this, 6); } -void sub_08067C24(Entity* this) { - this->action = 7; - this->field_0x74.HALF.HI = 0x14; - sub_08067DDC(this); - InitAnimationForceUpdate(this, 7); +void sub_08067C24(CatEntity* this) { + super->action = 7; + this->unk_75 = 0x14; + sub_08067DDC(super); + InitAnimationForceUpdate(super, 7); } -void sub_08067C44(Entity* this) { +void sub_08067C44(CatEntity* this) { s32 iVar4; u32 uVar5; @@ -348,78 +363,78 @@ void sub_08067C44(Entity* this) { uVar5 = FALSE; } - if (uVar5 != this->field_0x68.HALF.HI) { + if (uVar5 != this->unk_69) { if (uVar5 == 0) { - AddInteractableWhenBigObject(this); + AddInteractableWhenBigObject(super); } else { - AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); + AddInteractableAsMinishFuser(super, this->fusionOffer); } } - this->field_0x68.HALF.HI = uVar5; + this->unk_69 = uVar5; - if (this->interactType == 0) { + if (super->interactType == INTERACTION_NONE) { return; } - iVar4 = sub_0806FCA0(this, &gPlayerEntity); - switch (this->animIndex) { + iVar4 = sub_0806FCA0(super, &gPlayerEntity); + switch (super->animIndex) { case 0: default: if (iVar4 == 2) { - InitAnimationForceUpdate(this, 2); + InitAnimationForceUpdate(super, 2); } else { - InitAnimationForceUpdate(this, 1); + InitAnimationForceUpdate(super, 1); } break; case 3: if (iVar4 == 1) { - this->spriteSettings.flipX = 1; + super->spriteSettings.flipX = 1; } else { - if (this->spriteSettings.flipX == 3) { // TODO 3 ??? - this->spriteSettings.flipX = 0; + if (super->spriteSettings.flipX == 3) { // TODO 3 ??? + super->spriteSettings.flipX = 0; } } if (iVar4 != 2) { - InitAnimationForceUpdate(this, 1); + InitAnimationForceUpdate(super, 1); } else { - InitAnimationForceUpdate(this, 2); + InitAnimationForceUpdate(super, 2); } break; } - if (this->interactType == 2) { - this->action = 8; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 8; + InitializeNPCFusion(super); } else { - this->action = 4; - sub_08067790(this); - SetDefaultPriority(this, PRIO_MESSAGE); + super->action = 4; + sub_08067790(super); + SetDefaultPriority(super, PRIO_MESSAGE); } - this->interactType = 0; + super->interactType = INTERACTION_NONE; SoundReq(SFX_VO_CAT); } -u32 sub_08067D20(Entity* this) { +bool32 sub_08067D20(CatEntity* this) { s32 tmp; Entity* entity; int iVar4; - if (this->field_0x74.HALF.HI != 0) { - this->field_0x74.HALF.HI--; + if (this->unk_75 != 0) { + this->unk_75--; } else { entity = sub_08049DF4(2); if (entity != NULL) { - iVar4 = this->spriteSettings.flipX ? 0x10 : 0x28; - if (((u32)(entity->x.HALF.HI - (this->x.HALF.HI - iVar4)) < 0x31) && - ((((u32)entity->y.HALF.HI) - (this->y.HALF.HI - 4)) < 0x39)) { - return 1; + iVar4 = super->spriteSettings.flipX ? 0x10 : 0x28; + if (((u32)(entity->x.HALF.HI - (super->x.HALF.HI - iVar4)) < 0x31) && + ((((u32)entity->y.HALF.HI) - (super->y.HALF.HI - 4)) < 0x39)) { + return TRUE; } } } - return 0; + return FALSE; } -u32 sub_08067D74(Entity* this) { +bool32 sub_08067D74(Entity* this) { Entity* entity; int iVar2; @@ -433,16 +448,16 @@ u32 sub_08067D74(Entity* this) { if ((((u32)(entity->x.HALF.HI - (this->x.HALF.HI - iVar2)) < 0x1f) && ((u32)(entity->y.HALF.HI - this->y.HALF.HI) < 0x17)) && (this->timer == 0)) { - return 1; + return TRUE; } } } - return 0; + return FALSE; } -void sub_08067DCC(Entity* this, u32 param) { - this->field_0x70.BYTES.byte1 = param; - InitAnimationForceUpdate(this, param); +void sub_08067DCC(CatEntity* this, u32 animIndex) { + this->unk_71 = animIndex; + InitAnimationForceUpdate(super, animIndex); } void sub_08067DDC(Entity* this) { diff --git a/src/npc/clothesRack.c b/src/npc/clothesRack.c index 03690470..db711388 100644 --- a/src/npc/clothesRack.c +++ b/src/npc/clothesRack.c @@ -1,3 +1,10 @@ +/** + * @file clothesRack.c + * @ingroup NPCs + * + * @brief Clothes Rack NPC + */ +#define NENT_DEPRECATED #include "npc.h" #include "tiles.h" @@ -13,23 +20,22 @@ void ClothesRack(Entity* this) { } void sub_0806DD90(Entity* this) { - u32 uVar1; - u32 uVar2; + u32 animIndex; u32 x; u32 y; this->action = 1; - uVar2 = 0; + animIndex = 0; if (CheckGlobalFlag(DRUG_1)) { - uVar2 = 1; + animIndex = 1; } - if (CheckGlobalFlag(DRUG_2) != 0) { - uVar2 = 2; + if (CheckGlobalFlag(DRUG_2)) { + animIndex = 2; } - if (CheckGlobalFlag(DRUG_3) != 0) { - uVar2 = 3; + if (CheckGlobalFlag(DRUG_3)) { + animIndex = 3; } - InitializeAnimation(this, uVar2); + InitializeAnimation(this, animIndex); x = this->x.HALF.HI; y = this->y.HALF.HI; SetMetaTile(SPECIAL_META_TILE_114, TILE(x - 24, y - 16), this->collisionLayer); diff --git a/src/npc/cow.c b/src/npc/cow.c index e74ed30a..8d4f1d4b 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -1,194 +1,208 @@ -#include "global.h" -#include "sound.h" +/** + * @file cow.c + * @ingroup NPCs + * + * @brief Cow NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" -#include "npc.h" #include "functions.h" +#include "npc.h" +#include "player.h" +#include "sound.h" -void sub_0806920C(Entity* ent); -void sub_0806924C(Entity* ent); -void sub_08068FC0(Entity* ent); -void sub_08069018(Entity* ent); -void sub_08069068(Entity* ent); -void sub_08069124(Entity* ent); -void sub_080691E0(Entity* ent); -void sub_08069148(Entity* ent); -void sub_08069168(Entity* ent); -void sub_08069188(Entity* ent); -void sub_080691BC(Entity* ent); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u16 unk_6a; + /*0x6c*/ u8 fusionOffer; + /*0x6d*/ u8 unk_6d; +} CowEntity; -void Cow(Entity* ent) { - static void (*const actionFuncs[])(Entity*) = { +void sub_0806920C(CowEntity* this); +void sub_0806924C(CowEntity* this); +void sub_08068FC0(CowEntity* this); +void sub_08069018(CowEntity* this); +void sub_08069068(CowEntity* this); +void sub_08069124(CowEntity* this); +void sub_080691E0(CowEntity* this); +void sub_08069148(CowEntity* this); +void sub_08069168(CowEntity* this); +void sub_08069188(CowEntity* this); +void sub_080691BC(CowEntity* this); + +void Cow(CowEntity* this) { + static void (*const actionFuncs[])(CowEntity*) = { sub_08068FC0, sub_08069018, sub_08069068, sub_08069124, sub_080691E0, }; - actionFuncs[ent->action](ent); - sub_0806ED78(ent); - sub_0806920C(ent); + actionFuncs[super->action](this); + sub_0806ED78(super); + sub_0806920C(this); } -void sub_08068FC0(Entity* ent) { +void sub_08068FC0(CowEntity* this) { u32 r2; - ent->action = 1; - ent->animationState = ent->type2; - ent->speed = 0x40; + super->action = 1; + super->animationState = super->type2; + super->speed = 0x40; - ent->field_0x6c.HALF.HI = 0xFF; + this->unk_6d = 0xff; - r2 = sub_0805ACC0(ent); + r2 = sub_0805ACC0(super); if (r2 == 0) { u16 x, y; - x = ent->x.HALF.HI; - *(u16*)&ent->field_0x68 = x; + x = super->x.HALF.HI; + this->unk_68 = x; - y = ent->y.HALF.HI; - ent->field_0x6a.HWORD = y; + y = super->y.HALF.HI; + this->unk_6a = y; } else { u32 var1 = r2 >> 16; // 0x68+0x69 probably a SplitWord - *(u16*)&ent->field_0x68 = var1; - ent->field_0x6a.HWORD = r2; + this->unk_68 = var1; + this->unk_6a = r2; } - ent->field_0x6c.HALF.LO = GetFusionToOffer(ent); + this->fusionOffer = GetFusionToOffer(super); - InitAnimationForceUpdate(ent, ent->animationState + 4); + InitAnimationForceUpdate(super, super->animationState + 4); } -void sub_08069018(Entity* ent) { +void sub_08069018(CowEntity* this) { s32 var0; - if (ent->subAction == 0) { - ent->subAction++; - ent->subtimer = (Random() & 0x3F) + 0x3C; - InitAnimationForceUpdate(ent, ent->animationState); + if (super->subAction == 0) { + super->subAction++; + super->subtimer = (Random() & 0x3F) + 0x3C; + InitAnimationForceUpdate(super, super->animationState); } - UpdateAnimationSingleFrame(ent); - var0 = --ent->subtimer; + UpdateAnimationSingleFrame(super); + var0 = --super->subtimer; if (var0 == 0) { - if (ent->timer == 0) { - ent->action = 2; + if (super->timer == 0) { + super->action = 2; } else { - ent->action = 3; + super->action = 3; } - ent->subAction = var0; + super->subAction = var0; } - sub_0806924C(ent); + sub_0806924C(this); } -void sub_08069068(Entity* ent) { +void sub_08069068(CowEntity* this) { s32 var0; - if (ent->subAction == 0) { + if (super->subAction == 0) { u32 anim; - ent->subAction++; + super->subAction++; anim = (Random() & 2) - 1; - anim = (anim + ent->animationState) & 3; - ent->animationState = anim; - ent->direction = anim <<= 3; + anim = (anim + super->animationState) & 3; + super->animationState = anim; + super->direction = anim <<= 3; - ent->subtimer = (Random() & 0x3F) + 60; - InitAnimationForceUpdate(ent, ent->animationState + 4); + super->subtimer = (Random() & 0x3F) + 60; + InitAnimationForceUpdate(super, super->animationState + 4); } - ProcessMovement0(ent); - UpdateAnimationSingleFrame(ent); + ProcessMovement0(super); + UpdateAnimationSingleFrame(super); { - s32 x = ent->x.HALF.HI; - s16* x2 = (s16*)&ent->field_0x68; + s32 x = super->x.HALF.HI; + s16* x2 = (s16*)&this->unk_68; x -= *x2; if (x > 16) { - ent->x.HALF.HI = *x2 + 16; - ent->subtimer = 1; + super->x.HALF.HI = *x2 + 16; + super->subtimer = 1; } if (x < -16) { - ent->x.HALF.HI = *x2 - 16; - ent->subtimer = 1; + super->x.HALF.HI = *x2 - 16; + super->subtimer = 1; } } { - s32 y = ent->y.HALF.HI; - s16* y2 = &ent->field_0x6a.HWORD; + s32 y = super->y.HALF.HI; + s16* y2 = &this->unk_6a; y -= *y2; if (y > 16) { - ent->y.HALF.HI = *y2 + 16; - ent->subtimer = 1; + super->y.HALF.HI = *y2 + 16; + super->subtimer = 1; } if (y < -16) { - ent->y.HALF.HI = *y2 - 16; - ent->subtimer = 1; + super->y.HALF.HI = *y2 - 16; + super->subtimer = 1; } } - var0 = --ent->subtimer; + var0 = --super->subtimer; if (var0 == 0) { - ent->action = 3; - ent->subAction = var0; + super->action = 3; + super->subAction = var0; } - sub_0806924C(ent); + sub_0806924C(this); } -void sub_08069124(Entity* ent) { - static void (*const subActionFuncs[])(Entity*) = { +void sub_08069124(CowEntity* this) { + static void (*const subActionFuncs[])(CowEntity*) = { sub_08069148, sub_08069168, sub_08069188, sub_080691BC, }; - UpdateAnimationSingleFrame(ent); - subActionFuncs[ent->subAction](ent); - sub_0806924C(ent); + UpdateAnimationSingleFrame(super); + subActionFuncs[super->subAction](this); + sub_0806924C(this); } -void sub_08069148(Entity* ent) { +void sub_08069148(CowEntity* this) { u32 var0 = Random() & 3; var0 += 3; - ent->subtimer = var0; - ent->subAction = 1; - InitAnimationForceUpdate(ent, ent->animationState + 8); + super->subtimer = var0; + super->subAction = 1; + InitAnimationForceUpdate(super, super->animationState + 8); } -void sub_08069168(Entity* ent) { - if ((s8)ent->frame < 0) { - ent->subAction = 2; - InitAnimationForceUpdate(ent, ent->animationState + 12); +void sub_08069168(CowEntity* this) { + if ((s8)super->frame < 0) { + super->subAction = 2; + InitAnimationForceUpdate(super, super->animationState + 12); } } -void sub_08069188(Entity* ent) { - if ((ent->frame & 1) == 0) +void sub_08069188(CowEntity* this) { + if ((super->frame & 1) == 0) return; - ent->frame = 0; + super->frame = 0; - if (--ent->subtimer != 0) + if (--super->subtimer != 0) return; - ent->subAction = 3; - InitAnimationForceUpdate(ent, ent->animationState + 16); + super->subAction = 3; + InitAnimationForceUpdate(super, super->animationState + 16); } -void sub_080691BC(Entity* ent) { - if ((s8)ent->frame < 0) { - ent->action = 1; - ent->subAction = 0; - InitAnimationForceUpdate(ent, ent->animationState + 4); +void sub_080691BC(CowEntity* this) { + if ((s8)super->frame < 0) { + super->action = 1; + super->subAction = 0; + InitAnimationForceUpdate(super, super->animationState + 4); } } -void sub_080691E0(Entity* ent) { - if (UpdateFuseInteraction(ent) != 0) { - ent->action = 1; - ent->subAction = 0; +void sub_080691E0(CowEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + super->subAction = 0; } } // Show dialogue -void Cow_ShowDialogue(Entity* ent) { +void Cow_ShowDialogue(CowEntity* this) { static const Dialog gUnk_08111938[] = { { 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x34) } }, { 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x35) } }, @@ -196,10 +210,10 @@ void Cow_ShowDialogue(Entity* ent) { { 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x37) } }, { 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x38) } } }; - ShowNPCDialogue(ent, &gUnk_08111938[ent->type]); + ShowNPCDialogue(super, &gUnk_08111938[super->type]); } -void sub_0806920C(Entity* ent) { +void sub_0806920C(CowEntity* this) { u32 var1; if ((gPlayerState.flags & PL_MINISH) != 0) { var1 = TRUE; @@ -207,43 +221,43 @@ void sub_0806920C(Entity* ent) { var1 = FALSE; } - if (var1 != ent->field_0x6c.HALF.HI) { + if (var1 != this->unk_6d) { if (var1 == 0) { - AddInteractableWhenBigObject(ent); + AddInteractableWhenBigObject(super); } else { - AddInteractableAsMinishFuser(ent, ent->field_0x6c.HALF.LO); + AddInteractableAsMinishFuser(super, this->fusionOffer); } } - ent->field_0x6c.HALF.HI = var1; + this->unk_6d = var1; } // Check if player interacting -void sub_0806924C(Entity* ent) { - s8 itype = ent->interactType; - if (itype != 0) { - if ((gPlayerState.flags & PL_MINISH) != 0) { - if (itype == 2) { - ent->action = 4; - sub_0806F118(ent); +void sub_0806924C(CowEntity* this) { + s8 itype = super->interactType; + if (itype != INTERACTION_NONE) { + if (gPlayerState.flags & PL_MINISH) { + if (itype == INTERACTION_FUSE) { + super->action = 4; + InitializeNPCFusion(super); } else { - Cow_ShowDialogue(ent); + Cow_ShowDialogue(this); } } else { - Cow_ShowDialogue(ent); + Cow_ShowDialogue(this); ResetPlayerAnimationAndAction(); } SoundReq(SFX_VO_COW); - ent->interactType = 0; + super->interactType = INTERACTION_NONE; } } -void Cow_Fusion(Entity* ent) { - if (ent->action == 0) { - ent->action++; - ent->spriteSettings.draw = 1; - InitAnimationForceUpdate(ent, 15); +void Cow_Fusion(CowEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + InitAnimationForceUpdate(super, 15); } else { - UpdateAnimationSingleFrame(ent); + UpdateAnimationSingleFrame(super); } } diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 28709607..f936bc1e 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -1,105 +1,117 @@ -#include "npc.h" +/** + * @file cucco.c + * @ingroup NPCs + * + * @brief Cucco NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "kinstone.h" +#include "npc.h" -void (*const Cucco_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} CuccoEntity; + +void (*const Cucco_Actions[])(CuccoEntity*); const u16 Cucco_Sounds[]; const u16 Cucco_Messages[]; -void sub_0806E4EC(Entity*); +void sub_0806E4EC(CuccoEntity*); void Cucco_ShowMessage(Entity*); void sub_0806E65C(Entity* this); -void Cucco(Entity* this) { - Cucco_Actions[this->action](this); +void Cucco(CuccoEntity* this) { + Cucco_Actions[super->action](this); } -void Cucco_Init(Entity* this) { - this->action++; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); - SetDefaultPriority(this, PRIO_MESSAGE); - this->subAction = 0; +void Cucco_Init(CuccoEntity* this) { + super->action++; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableAsMinishFuser(super, this->fusionOffer); + SetDefaultPriority(super, PRIO_MESSAGE); + super->subAction = 0; sub_0806E4EC(this); } -void sub_0806E4EC(Entity* this) { - if (this->subAction == 0) { - this->subAction++; - this->timer = (Random() & 0x1f) + 60; - InitAnimationForceUpdate(this, 0); +void sub_0806E4EC(CuccoEntity* this) { + if (super->subAction == 0) { + super->subAction++; + super->timer = (Random() & 0x1f) + 60; + InitAnimationForceUpdate(super, 0); } - if (--this->timer == 0) { + if (--super->timer == 0) { if ((Random() & 1) != 0) { - this->action = 3; + super->action = 3; } else { - this->action = 2; + super->action = 2; } - this->subAction = 0; + super->subAction = 0; if ((Random() & 1) != 0) { EnqueueSFX(Cucco_Sounds[Random() & 3]); } } - sub_0806E65C(this); - UpdateAnimationSingleFrame(this); + sub_0806E65C(super); + UpdateAnimationSingleFrame(super); } -void Cucco_Fly(Entity* this) { - if (this->subAction == 0) { - this->subAction++; +void Cucco_Fly(CuccoEntity* this) { + if (super->subAction == 0) { + super->subAction++; if (Random() & 1) { - this->spriteSettings.flipX ^= 1; + super->spriteSettings.flipX ^= 1; } - this->timer = (Random() & 1) + 1; - this->zVelocity = Q_16_16(1.5); - InitAnimationForceUpdate(this, 1); + super->timer = (Random() & 1) + 1; + super->zVelocity = Q_16_16(1.5); + InitAnimationForceUpdate(super, 1); } - if (GravityUpdate(this, Q_8_8(40.0)) == 0) { - if (--this->timer == 0) { - this->action = 1; - this->subAction = 0; + if (GravityUpdate(super, Q_8_8(40.0)) == 0) { + if (--super->timer == 0) { + super->action = 1; + super->subAction = 0; } else { - this->zVelocity = Q_16_16(1.5); + super->zVelocity = Q_16_16(1.5); } } - sub_0806E65C(this); - UpdateAnimationSingleFrame(this); + sub_0806E65C(super); + UpdateAnimationSingleFrame(super); } -void Cucco_Idle(Entity* this) { - if (this->subAction == 0) { - this->subAction++; +void Cucco_Idle(CuccoEntity* this) { + if (super->subAction == 0) { + super->subAction++; if (Random() & 1) { - this->spriteSettings.flipX ^= 1; + super->spriteSettings.flipX ^= 1; } - InitAnimationForceUpdate(this, (Random() & 1) + 2); + InitAnimationForceUpdate(super, (Random() & 1) + 2); } - if (this->frame & ANIM_DONE) { - this->action = 1; - this->subAction = 0; + if (super->frame & ANIM_DONE) { + super->action = 1; + super->subAction = 0; } - sub_0806E65C(this); - UpdateAnimationSingleFrame(this); + sub_0806E65C(super); + UpdateAnimationSingleFrame(super); } -void sub_0806E648(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; +void sub_0806E648(CuccoEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } } void sub_0806E65C(Entity* this) { - if (this->interactType != 0) { - if ((gPlayerState.flags & PL_MINISH) != 0) { - if (this->interactType == 2) { + if (this->interactType != INTERACTION_NONE) { + if (gPlayerState.flags & PL_MINISH) { + if (this->interactType == INTERACTION_FUSE) { this->action = 4; - sub_0806F118(this); + InitializeNPCFusion(this); } else { Cucco_ShowMessage(this); } @@ -107,14 +119,14 @@ void sub_0806E65C(Entity* this) { ResetPlayerAnimationAndAction(); } SoundReq(SFX_VO_CUCCO_CALL); - this->interactType = 0; + this->interactType = INTERACTION_NONE; } } void Cucco_ShowMessage(Entity* this) { u32 val = 0; u32 index = GetFuserId(this); - if (gSave.fuserOffers[index] == KINSTONE_FUSER_DONE) { + if (gSave.kinstones.fuserOffers[index] == KINSTONE_FUSER_DONE) { val = 1; } @@ -131,7 +143,7 @@ void Cucco_Fusion(Entity* this) { } } -void (*const Cucco_Actions[])(Entity*) = { +void (*const Cucco_Actions[])(CuccoEntity*) = { Cucco_Init, sub_0806E4EC, Cucco_Fly, Cucco_Idle, sub_0806E648, }; diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index 75ccdce3..fa4da6a6 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -1,44 +1,56 @@ -#include "npc.h" +/** + * @file cuccoChick.c + * @ingroup NPCs + * + * @brief Cucco Chick NPC + */ +#define NENT_DEPRECATED #include "functions.h" +#include "npc.h" -void CuccoChick_Init(Entity*); -void sub_0806E764(Entity*); -void CuccoChick_Fly(Entity*); -void sub_0806E824(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} CuccoChickEntity; -void sub_0806E838(Entity* this); +void CuccoChick_Init(CuccoChickEntity*); +void sub_0806E764(CuccoChickEntity*); +void CuccoChick_Fly(CuccoChickEntity*); +void sub_0806E824(CuccoChickEntity*); -void sub_0806E884(Entity* this); +void sub_0806E838(CuccoChickEntity* this); -void CuccoChick(Entity* this) { - static void (*const CuccoChick_Actions[])(Entity*) = { +void sub_0806E884(CuccoChickEntity* this); + +void CuccoChick(CuccoChickEntity* this) { + static void (*const CuccoChick_Actions[])(CuccoChickEntity*) = { CuccoChick_Init, sub_0806E764, CuccoChick_Fly, sub_0806E824, }; - CuccoChick_Actions[this->action](this); - sub_0806ED78(this); + CuccoChick_Actions[super->action](this); + sub_0806ED78(super); } -void CuccoChick_Init(Entity* this) { - this->action++; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); - SetDefaultPriority(this, PRIO_MESSAGE); - this->subAction = 0; +void CuccoChick_Init(CuccoChickEntity* this) { + super->action++; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableAsMinishFuser(super, this->fusionOffer); + SetDefaultPriority(super, PRIO_MESSAGE); + super->subAction = 0; sub_0806E764(this); } -void sub_0806E764(Entity* this) { - if (this->subAction == 0) { - this->subAction++; - this->timer = (Random() & 0x1f) + 30; - this->frameIndex = 0; +void sub_0806E764(CuccoChickEntity* this) { + if (super->subAction == 0) { + super->subAction++; + super->timer = (Random() & 0x1f) + 30; + super->frameIndex = 0; } - if (--this->timer == 0) { - this->action = 2; - this->subAction = 0; + if (--super->timer == 0) { + super->action = 2; + super->subAction = 0; if ((Random() & 1) != 0) { EnqueueSFX(SFX_VO_CHEEP); } @@ -46,39 +58,39 @@ void sub_0806E764(Entity* this) { sub_0806E838(this); } -void CuccoChick_Fly(Entity* this) { - if (this->subAction == 0) { - this->subAction++; +void CuccoChick_Fly(CuccoChickEntity* this) { + if (super->subAction == 0) { + super->subAction++; if ((Random() & 1) != 0) { - this->spriteSettings.flipX ^= 1; + super->spriteSettings.flipX ^= 1; } - this->timer = (Random() & 3) + 1; - this->zVelocity = Q_16_16(1.0); - this->frameIndex = 1; + super->timer = (Random() & 3) + 1; + super->zVelocity = Q_16_16(1.0); + super->frameIndex = 1; } - if (GravityUpdate(this, Q_8_8(48.0)) == 0) { - if (--this->timer == 0) { - this->action = 1; - this->subAction = 0; + if (GravityUpdate(super, Q_8_8(48.0)) == 0) { + if (--super->timer == 0) { + super->action = 1; + super->subAction = 0; } else { - this->zVelocity = Q_16_16(1.0); + super->zVelocity = Q_16_16(1.0); } } sub_0806E838(this); } -void sub_0806E824(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; +void sub_0806E824(CuccoChickEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } } -void sub_0806E838(Entity* this) { - if (this->interactType != 0) { - if ((gPlayerState.flags & PL_MINISH) != 0) { - if (this->interactType == 2) { - this->action = 3; - sub_0806F118(this); +void sub_0806E838(CuccoChickEntity* this) { + if (super->interactType != INTERACTION_NONE) { + if (gPlayerState.flags & PL_MINISH) { + if (super->interactType == INTERACTION_FUSE) { + super->action = 3; + InitializeNPCFusion(super); } else { sub_0806E884(this); } @@ -86,22 +98,22 @@ void sub_0806E838(Entity* this) { ResetPlayerAnimationAndAction(); } SoundReq(SFX_VO_CHEEP); - this->interactType = 0; + super->interactType = INTERACTION_NONE; } } -void sub_0806E884(Entity* this) { - MessageNoOverlap(TEXT_INDEX(TEXT_MINISH, 0Xb6), this); +void sub_0806E884(CuccoChickEntity* this) { + MessageNoOverlap(TEXT_INDEX(TEXT_MINISH, 0xB6), super); } -void CuccoChick_Fusion(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = 1; - this->frameIndex = 1; +void CuccoChick_Fusion(CuccoChickEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + super->frameIndex = 1; } else { - if (GravityUpdate(this, Q_8_8(48.0)) == 0) { - this->zVelocity = Q_16_16(1.0); + if (GravityUpdate(super, Q_8_8(48.0)) == 0) { + super->zVelocity = Q_16_16(1.0); } } } diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 199996e9..86795600 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -1,3 +1,10 @@ +/** + * @file dampe.c + * @ingroup NPCs + * + * @brief Dampe NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" @@ -8,22 +15,28 @@ #include "room.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} DampeEntity; + void Dampe(Entity* this) { switch (this->action) { case 0: this->action = 1; this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); return; case 1: - if (this->interactType == 2) { + if (this->interactType == INTERACTION_FUSE) { this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); - sub_0806F118(this); + this->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(this, + GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)) + 4); + InitializeNPCFusion(this); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } return; case 2: @@ -34,9 +47,9 @@ void Dampe(Entity* this) { } } -void Dampe_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Dampe_MakeInteractable(DampeEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Dampe_Fusion(Entity* this) { diff --git a/src/npc/din.c b/src/npc/din.c index c5608c7e..cfbef459 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -1,30 +1,42 @@ -#include "global.h" +/** + * @file din.c + * @ingroup NPCs + * + * @brief Din NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "npc.h" #include "kinstone.h" +#include "npc.h" -void Din(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 animIndex; +} DinEntity; + +void Din(DinEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = 1; + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - sub_0806F118(this); - this->field_0x68.HALF.LO = this->animIndex; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.LO); + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); } break; } @@ -32,7 +44,7 @@ void Din(Entity* this) { void Din_MakeInteractable(Entity* this) { u32 kinstoneId = GetFusionToOffer(this); - if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { + if ((gSave.kinstones.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { kinstoneId = KINSTONE_NONE; } AddInteractableWhenBigFuser(this, kinstoneId); diff --git a/src/npc/dog.c b/src/npc/dog.c index d529cf58..9deab06d 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -1,3 +1,10 @@ +/** + * @file dog.c + * @ingroup NPCs + * + * @brief Dog NPC + */ +#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "functions.h" @@ -5,15 +12,27 @@ #include "npc.h" #include "tiles.h" -void sub_08069FE8(Entity*); -bool32 sub_08069EF0(Entity*); -bool32 sub_08069F90(Entity*); -void sub_08069F6C(Entity*); -void sub_08069D00(Entity*); -void sub_08069CB8(Entity*); -void sub_0806A028(Entity*); -void sub_08069FBC(Entity*); -void sub_0806A080(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u8 unk_6a; + /*0x6b*/ u8 unk_6b; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u16 unk_6e; + /*0x70*/ u16 unk_70; + /*0x72*/ u16 unk_72; + /*0x74*/ u8 unk_74; +} DogEntity; + +void sub_08069FE8(DogEntity*); +bool32 sub_08069EF0(DogEntity*); +bool32 sub_08069F90(DogEntity*); +void sub_08069F6C(DogEntity*); +void sub_08069D00(DogEntity*); +void sub_08069CB8(DogEntity*); +void sub_0806A028(DogEntity*); +void sub_08069FBC(DogEntity*); +void sub_0806A080(DogEntity*); const SpriteLoadData gUnk_08111D58[] = { #ifdef EU @@ -24,15 +43,15 @@ const SpriteLoadData gUnk_08111D58[] = { { 4, 68, 4 }, { 7172, 68, 4 }, { 0, 0, 0 }, { 83, 69, 4 }, { 7251, 69, 4 }, { 0, 0, 0 }, }; -void sub_08069B44(Entity*); -void sub_08069C40(Entity*); -void sub_08069D54(Entity*); -void sub_08069DF8(Entity*); -void sub_08069E44(Entity*); -void sub_08069E50(Entity*); -void sub_08069ECC(Entity*); -void sub_08069EE0(Entity*); -void (*const gUnk_08111D88[])(Entity*) = { +void sub_08069B44(DogEntity*); +void sub_08069C40(DogEntity*); +void sub_08069D54(DogEntity*); +void sub_08069DF8(DogEntity*); +void sub_08069E44(DogEntity*); +void sub_08069E50(DogEntity*); +void sub_08069ECC(DogEntity*); +void sub_08069EE0(DogEntity*); +void (*const gUnk_08111D88[])(DogEntity*) = { sub_08069B44, sub_08069C40, sub_08069D54, sub_08069DF8, sub_08069E44, sub_08069E50, sub_08069ECC, sub_08069EE0, }; @@ -176,254 +195,254 @@ const u16 gUnk_08111FD8[] = { TEXT_INDEX(TEXT_TOWN8, 0x7), TEXT_INDEX(TEXT_TOWN8, 0x8), TEXT_INDEX(TEXT_TOWN8, 0x9), TEXT_INDEX(TEXT_TOWN8, 0x11), TEXT_INDEX(TEXT_TOWN8, 0x3), }; -void Dog(Entity* this) { - gUnk_08111D88[this->action](this); - sub_0806ED78(this); +void Dog(DogEntity* this) { + gUnk_08111D88[super->action](this); + sub_0806ED78(super); sub_08069FE8(this); } -void sub_08069B44(Entity* this) { +void sub_08069B44(DogEntity* this) { u32 uVar2; u32 sVar3; u32 uVar4; u32 uVar5; if (sub_08069EF0(this)) { - uVar5 = sub_0805ACC0(this); + uVar5 = sub_0805ACC0(super); if (uVar5 == 0) { - sVar3 = this->x.HALF.HI; - uVar2 = this->y.HALF.HI; + sVar3 = super->x.HALF.HI; + uVar2 = super->y.HALF.HI; } else { sVar3 = uVar5 >> 0x10; uVar2 = uVar5; } - uVar4 = this->timer == 0 ? 0x20 : this->timer; + uVar4 = super->timer == 0 ? 0x20 : super->timer; - 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->timer = 30; - this->animationState = 2; - this->field_0x6a.HALF.LO = 0xff; - this->field_0x74.HALF.LO = GetFusionToOffer(this); - SetDefaultPriority(this, PRIO_MESSAGE); - InitAnimationForceUpdate(this, 10); - if ((this->flags & ENT_SCRIPTED) != 0) { - sub_0807DD50(this); + this->unk_6e = sVar3 - uVar4; + this->unk_6c = sVar3 + uVar4; + this->unk_70 = uVar2 - 8; + this->unk_72 = uVar2 + 8; + super->speed = 0x100; + super->timer = 30; + super->animationState = 2; + this->unk_6a = 0xff; + this->unk_74 = GetFusionToOffer(super); + SetDefaultPriority(super, PRIO_MESSAGE); + InitAnimationForceUpdate(super, 10); + if ((super->flags & ENT_SCRIPTED) != 0) { + InitScriptForNPC(super); } - if (((this->type == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) && + if (((super->type == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) && (GetInventoryValue(ITEM_QST_DOGFOOD) != 2)) { - this->action = 4; + super->action = 4; } - if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { - SetMetaTile(SPECIAL_META_TILE_114, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer); + if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { + SetMetaTile(SPECIAL_META_TILE_114, TILE(super->x.HALF.HI, super->y.HALF.HI - 8), super->collisionLayer); } } } -void sub_08069C40(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_08069C40(DogEntity* this) { + UpdateAnimationSingleFrame(super); if (sub_08069F90(this)) { if ((gPlayerState.flags & PL_MINISH) != 0) { sub_08069CB8(this); } else { - this->animationState = GetAnimationState(this); + super->animationState = GetAnimationState(super); sub_08069D00(this); } - this->timer = 30; + super->timer = 30; } else { - this->timer--; - if (this->timer == 0) { - this->action = 2; - this->timer = (Random() & 0x1f) + 30; - this->direction = gUnk_08111DA8[Random() & 7]; + super->timer--; + if (super->timer == 0) { + super->action = 2; + super->timer = (Random() & 0x1f) + 30; + super->direction = gUnk_08111DA8[Random() & 7]; sub_08069F6C(this); } } } -void sub_08069CB8(Entity* this) { +void sub_08069CB8(DogEntity* 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; + direction = GetFacingDirection(super, &gPlayerEntity); + animState = gUnk_08111DB0[direction + super->animationState * 0x20]; + super->animationState = animState >> 6; + this->unk_6b = animState & 0x3f; sub_0806A028(this); - if (this->animIndex != this->field_0x6a.HALF.HI) { - InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI); + if (super->animIndex != this->unk_6b) { + InitAnimationForceUpdate(super, this->unk_6b); } } -void sub_08069D00(Entity* this) { - this->field_0x6a.HALF.HI = 8; +void sub_08069D00(DogEntity* this) { + this->unk_6b = 8; sub_0806A028(this); - if (0x1f < this->animIndex) { - if ((this->frame & ANIM_DONE) == 0) { + if (0x1f < super->animIndex) { + if ((super->frame & ANIM_DONE) == 0) { return; } - this->field_0x6a.HALF.HI = 8; + this->unk_6b = 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); + if (super->animIndex != this->unk_6b + super->animationState) { + InitAnimationForceUpdate(super, this->unk_6b + super->animationState); } } -void sub_08069D54(Entity* this) { +void sub_08069D54(DogEntity* this) { u16 collisions; if (!sub_08069F90(this)) { - this->timer--; - if (this->timer != 0) { - UpdateAnimationSingleFrame(this); - ProcessMovement0(this); - collisions = this->collisions; + super->timer--; + if (super->timer != 0) { + UpdateAnimationSingleFrame(super); + ProcessMovement0(super); + collisions = super->collisions; - if (this->x.HALF.HI < this->field_0x6e.HWORD) { - this->x.HALF.HI = this->field_0x6e.HWORD + 1; + if (super->x.HALF.HI < this->unk_6e) { + super->x.HALF.HI = this->unk_6e + 1; collisions = COL_WEST_ANY; - } else if (this->x.HALF.HI > this->field_0x6c.HWORD) { - this->x.HALF.HI = this->field_0x6c.HWORD - 1; + } else if (super->x.HALF.HI > this->unk_6c) { + super->x.HALF.HI = this->unk_6c - 1; collisions = COL_EAST_ANY; } - if (this->y.HALF.HI < this->field_0x70.HALF_U.LO) { - this->y.HALF.HI = this->field_0x70.HALF_U.LO + 1; + if (super->y.HALF.HI < this->unk_70) { + super->y.HALF.HI = this->unk_70 + 1; collisions = COL_NORTH_ANY; - } else if (this->y.HALF.HI > this->field_0x70.HALF_U.HI) { - this->y.HALF.HI = this->field_0x70.HALF_U.HI - 1; + } else if (super->y.HALF.HI > this->unk_72) { + super->y.HALF.HI = this->unk_72 - 1; collisions = COL_SOUTH_ANY; } - sub_0800417E(this, collisions); + sub_0800417E(super, collisions); sub_08069F6C(this); return; } } if (sub_08069F90(this)) { - this->action = 1; + super->action = 1; } else { - this->action = 3; + super->action = 3; } - this->timer = (Random() & 0x1f) + 30; + super->timer = (Random() & 0x1f) + 30; } -void sub_08069DF8(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_08069DF8(DogEntity* this) { + UpdateAnimationSingleFrame(super); if (sub_08069F90(this)) { - this->action = 1; + super->action = 1; } else { - this->timer--; - if (this->timer != 0) { + super->timer--; + if (super->timer != 0) { sub_08069D00(this); return; } if ((Random() & 0xff) < 0x30) { - this->action = 2; + super->action = 2; } else { - this->action = 3; + super->action = 3; } } - this->timer = (Random() & 0x1f) + 30; + super->timer = (Random() & 0x1f) + 30; } -void sub_08069E44(Entity* this) { - sub_0807DD94(this, NULL); +void sub_08069E44(DogEntity* this) { + ExecuteScriptAndHandleAnimation(super, NULL); } -void sub_08069E50(Entity* this) { - this->animationState = GetAnimationState(this); - this->field_0x6a.HALF.HI = 8; +void sub_08069E50(DogEntity* this) { + super->animationState = GetAnimationState(super); + this->unk_6b = 8; sub_0806A028(this); - UpdateAnimationSingleFrame(this); - if (this->animIndex > 0x1f) { - if ((this->frame & ANIM_DONE) == 0) { + UpdateAnimationSingleFrame(super); + if (super->animIndex > 0x1f) { + if ((super->frame & ANIM_DONE) == 0) { return; } - this->field_0x6a.HALF.HI = 8; + this->unk_6b = 8; } sub_08069FBC(this); - if (this->animIndex != this->field_0x6a.HALF.HI + this->animationState) { - InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI + this->animationState); + if (super->animIndex != this->unk_6b + super->animationState) { + InitAnimationForceUpdate(super, this->unk_6b + super->animationState); } if (GetInventoryValue(ITEM_QST_DOGFOOD) == 2) { - this->action = 7; - InitAnimationForceUpdate(this, 0x29); - RemoveInteractableObject(this); + super->action = 7; + InitAnimationForceUpdate(super, 0x29); + RemoveInteractableObject(super); EnqueueSFX(SFX_VO_DOG); EnqueueSFX(SFX_TASK_COMPLETE); } } -void sub_08069ECC(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { +void sub_08069ECC(DogEntity* this) { + if (UpdateFuseInteraction(super) != 0) { #ifdef EU if (GetInventoryValue(ITEM_QST_DOGFOOD) != 2) { - this->action = 5; + super->action = 5; } else { - this->action = 1; + super->action = 1; } #else - this->action = 1; + super->action = 1; #endif } } -void sub_08069EE0(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_08069EE0(DogEntity* this) { + UpdateAnimationSingleFrame(super); } -void sub_08069EE8(Entity* this) { - this->action = 5; +void sub_08069EE8(DogEntity* this) { + super->action = 5; } -bool32 sub_08069EF0(Entity* this) { - if (!LoadExtraSpriteData(this, &gUnk_08111D58[this->type * 3])) { +bool32 sub_08069EF0(DogEntity* this) { + if (!LoadExtraSpriteData(super, &gUnk_08111D58[super->type * 3])) { return FALSE; } - this->action = 1; - this->field_0x68.HWORD = gUnk_08111E30[this->type]; + super->action = 1; + this->unk_68 = gUnk_08111E30[super->type]; return TRUE; } -void Dog_Head(Entity* this) { +void Dog_Head(DogEntity* this) { u32 frame; - frame = this->frame & ~ANIM_DONE; + frame = super->frame & ~ANIM_DONE; if (frame != 0) { - frame += this->field_0x68.HWORD; + frame += this->unk_68; } - SetExtraSpriteFrame(this, 0, frame - 1); - SetExtraSpriteFrame(this, 1, this->frameIndex); - SetSpriteSubEntryOffsetData1(this, 1, 0); - sub_0807000C(this); + SetExtraSpriteFrame(super, 0, frame - 1); + SetExtraSpriteFrame(super, 1, super->frameIndex); + SetSpriteSubEntryOffsetData1(super, 1, 0); + sub_0807000C(super); } -void sub_08069F6C(Entity* this) { - this->animationState = sub_0806F5A4(this->direction); - if (this->animationState + 4 != this->animIndex) { - InitAnimationForceUpdate(this, this->animationState + 4); +void sub_08069F6C(DogEntity* this) { + super->animationState = GetAnimationStateForDirection4(super->direction); + if (super->animationState + 4 != super->animIndex) { + InitAnimationForceUpdate(super, super->animationState + 4); } } -bool32 sub_08069F90(Entity* this) { - if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { +bool32 sub_08069F90(DogEntity* this) { + if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { return TRUE; } else { - return EntityInRectRadius(this, &gPlayerEntity, 0x14, 0x14); + return EntityInRectRadius(super, &gPlayerEntity, 0x14, 0x14); } } -void sub_08069FBC(Entity* this) { +void sub_08069FBC(DogEntity* this) { u32 tmp = (gPlayerState.flags & PL_MINISH) != 0 ? 0x24 : 0x20; - if ((this->animationState == 1) || (this->animationState == 3)) { - this->field_0x6a.HALF.HI = tmp; + if ((super->animationState == 1) || (super->animationState == 3)) { + this->unk_6b = tmp; } } -void sub_08069FE8(Entity* this) { +void sub_08069FE8(DogEntity* this) { u32 tmp; if ((gPlayerState.flags & PL_MINISH) != 0) { tmp = TRUE; @@ -431,22 +450,22 @@ void sub_08069FE8(Entity* this) { tmp = FALSE; } - if (tmp != this->field_0x6a.HALF.LO) { + if (tmp != this->unk_6a) { if (tmp == 0) { - AddInteractableWhenBigObject(this); + AddInteractableWhenBigObject(super); } else { - AddInteractableAsMinishFuser(this, this->field_0x74.HALF.LO); + AddInteractableAsMinishFuser(super, this->unk_74); } } - this->field_0x6a.HALF.LO = tmp; + this->unk_6a = tmp; } -void sub_0806A028(Entity* this) { - if (this->interactType != 0) { +void sub_0806A028(DogEntity* this) { + if (super->interactType != INTERACTION_NONE) { if ((gPlayerState.flags & PL_MINISH) != 0) { - if (this->interactType == 2) { - this->action = 6; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 6; + InitializeNPCFusion(super); } else { sub_0806A080(this); } @@ -456,12 +475,12 @@ void sub_0806A028(Entity* this) { SoundReq(SFX_VO_DOG); ResetPlayerAnimationAndAction(); } - this->interactType = 0; + super->interactType = INTERACTION_NONE; } } -void sub_0806A080(Entity* this) { - ShowNPCDialogue(this, &(gUnk_08111E34[this->type2][gSave.global_progress])); +void sub_0806A080(DogEntity* this) { + ShowNPCDialogue(super, &(gUnk_08111E34[super->type2][gSave.global_progress])); } void sub_0806A0A4(Entity* this) { @@ -502,15 +521,15 @@ void sub_0806A144(Entity* this) { MessageNoOverlap(gUnk_08111FD8[dialog], this); } -void Dog_Fusion(Entity* this) { - if (this->action == 0) { +void Dog_Fusion(DogEntity* this) { + if (super->action == 0) { if (sub_08069EF0(this)) { - this->action++; - this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); - InitializeAnimation(this, 0x23); + super->action++; + super->spriteSettings.draw = 1; + SetDefaultPriority(super, PRIO_MESSAGE); + InitializeAnimation(super, 0x23); } } else { - GetNextFrame(this); + GetNextFrame(super); } } diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index aef5ecc4..f6519407 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -1,6 +1,13 @@ -#include "npc.h" +/** + * @file drLeft.c + * @ingroup NPCs + * + * @brief Dr Left NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "item.h" +#include "npc.h" void sub_0806BFD8(Entity* this); @@ -9,7 +16,7 @@ void DrLeft(Entity* this) { if (this->action == 0) { this->action++; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); HandleEntity0x82Actions(this); diff --git a/src/npc/emma.c b/src/npc/emma.c index 0f0f1c36..098d61b7 100644 --- a/src/npc/emma.c +++ b/src/npc/emma.c @@ -1,3 +1,10 @@ +/** + * @file emma.c + * @ingroup NPCs + * + * @brief Emma NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screenTransitions.h" @@ -7,9 +14,9 @@ void Emma(Entity* this) { if (this->action == 0) { this->action++; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } } diff --git a/src/npc/epona.c b/src/npc/epona.c index b06a7777..b467d900 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -1,68 +1,80 @@ -#include "global.h" -#include "sound.h" +/** + * @file epona.c + * @ingroup NPCs + * + * @brief Epona NPC + */ +#define NENT_DEPRECATED #include "entity.h" +#include "functions.h" #include "message.h" #include "npc.h" -#include "functions.h" +#include "sound.h" -void sub_08065A64(Entity* this); -void sub_08065AA4(Entity*); -void sub_080659B8(Entity*); -void sub_080659F0(Entity*); -void sub_08065A00(Entity*); -void sub_08065A10(Entity*); -void sub_08065A34(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unk_69; +} EponaEntity; -void Epona(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void sub_08065A64(EponaEntity* this); +void sub_08065AA4(EponaEntity* this); +void sub_080659B8(EponaEntity* this); +void sub_080659F0(EponaEntity* this); +void sub_08065A00(EponaEntity* this); +void sub_08065A10(EponaEntity* this); +void sub_08065A34(EponaEntity* this); + +void Epona(EponaEntity* this) { + static void (*const actionFuncs[])(EponaEntity*) = { sub_080659B8, sub_080659F0, sub_08065A00, sub_08065A10, sub_08065A34, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); sub_08065A64(this); - sub_0806ED78(this); + sub_0806ED78(super); } -void sub_080659B8(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->animationState = 6; - this->field_0x68.HALF.HI = -1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - InitAnimationForceUpdate(this, this->animationState / 2); +void sub_080659B8(EponaEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + super->animationState = 6; + this->unk_69 = -1; + this->fusionOffer = GetFusionToOffer(super); + InitAnimationForceUpdate(super, super->animationState / 2); } -void sub_080659F0(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_080659F0(EponaEntity* this) { + UpdateAnimationSingleFrame(super); sub_08065AA4(this); } -void sub_08065A00(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_08065A00(EponaEntity* this) { + UpdateAnimationSingleFrame(super); sub_08065AA4(this); } -void sub_08065A10(Entity* this) { +void sub_08065A10(EponaEntity* this) { if ((gMessage.doTextBox & 0x7F) == 0) { - this->action = 1; - InitAnimationForceUpdate(this, this->animationState / 2); + super->action = 1; + InitAnimationForceUpdate(super, super->animationState / 2); } } -void sub_08065A34(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitAnimationForceUpdate(this, this->animationState / 2); +void sub_08065A34(EponaEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitAnimationForceUpdate(super, super->animationState / 2); } } -void sub_08065A50(Entity* this) { +void sub_08065A50(EponaEntity* this) { static const Dialog typeDialogs[] = { { 0, 0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X17), TEXT_INDEX(TEXT_TINGLE, 0x3c) } }, }; - ShowNPCDialogue(this, &typeDialogs[this->type]); + ShowNPCDialogue(super, &typeDialogs[super->type]); } -void sub_08065A64(Entity* this) { +void sub_08065A64(EponaEntity* this) { u32 uVar2; if ((gPlayerState.flags & PL_MINISH) != 0) { @@ -71,43 +83,43 @@ void sub_08065A64(Entity* this) { uVar2 = FALSE; } - if (uVar2 != this->field_0x68.HALF.HI) { + if (uVar2 != this->unk_69) { if (uVar2 == 0) { - AddInteractableWhenBigObject(this); + AddInteractableWhenBigObject(super); } else { - AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO); + AddInteractableAsMinishFuser(super, this->fusionOffer); } } - this->field_0x68.HALF.HI = uVar2; + this->unk_69 = uVar2; } -void sub_08065AA4(Entity* this) { - if (this->interactType != 0) { +void sub_08065AA4(EponaEntity* this) { + if (super->interactType != INTERACTION_NONE) { if (gPlayerState.flags & PL_MINISH) { - if (this->interactType == 2) { - this->action = 4; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 4; + InitializeNPCFusion(super); } else { - this->action = 3; - SetDefaultPriority(this, PRIO_MESSAGE); + super->action = 3; + SetDefaultPriority(super, PRIO_MESSAGE); sub_08065A50(this); } - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { sub_08065A50(this); ResetPlayerAnimationAndAction(); } SoundReq(SFX_VO_EPONA); - this->interactType = 0; + super->interactType = INTERACTION_NONE; } } -void Epona_Fusion(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = 1; - InitAnimationForceUpdate(this, 7); +void Epona_Fusion(EponaEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + InitAnimationForceUpdate(super, 7); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c index 5463c9a8..5ac0328c 100644 --- a/src/npc/ezlo.c +++ b/src/npc/ezlo.c @@ -1,3 +1,10 @@ +/** + * @file ezlo.c + * @ingroup NPCs + * + * @brief Ezlo NPC + */ +#define NENT_DEPRECATED #include "npc.h" const u8 gUnk_08114134[]; @@ -8,7 +15,7 @@ void Ezlo(Entity* this) { if (this->action == 0) { this->action++; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); HandleEntity0x82Actions(this); diff --git a/src/npc/farmers.c b/src/npc/farmers.c index d2c4e2fc..7b9e1036 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -1,7 +1,14 @@ +/** + * @file farmers.c + * @ingroup NPCs + * + * @brief Farmers NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" #include "functions.h" #include "npc.h" +#include "script.h" static const SpriteLoadData gUnk_08113140[] = { { 0xf7, 0x48, 0x4 }, { 0x40f7, 0x48, 0x4 }, { 0, 0, 0 }, { 0xf8, 0x49, 0x4 }, { 0x40f8, 0x49, 0x4 }, { 0, 0, 0 }, diff --git a/src/npc/farore.c b/src/npc/farore.c index c802bf6f..9624b3bc 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -1,30 +1,42 @@ -#include "global.h" +/** + * @file farore.c + * @ingroup NPCs + * + * @brief Farore NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "kinstone.h" -void Farore(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 animIndex; +} FaroreEntity; + +void Farore(FaroreEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = 1; + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - sub_0806F118(this); - this->field_0x68.HALF.LO = this->animIndex; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.LO); + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); } break; } @@ -32,7 +44,7 @@ void Farore(Entity* this) { void Farore_MakeInteractable(Entity* this) { u32 kinstoneId = GetFusionToOffer(this); - if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { + if ((gSave.kinstones.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { kinstoneId = KINSTONE_NONE; } AddInteractableWhenBigFuser(this, kinstoneId); diff --git a/src/npc/festari.c b/src/npc/festari.c index f9e0cb57..9d42eb8c 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -1,79 +1,94 @@ -#include "global.h" +/** + * @file festari.c + * @ingroup NPCs + * + * @brief Festari NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" -void sub_0805FF2C(Entity*, ScriptExecutionContext*); -void sub_0805FE10(Entity* this); -void sub_0805FE48(Entity* this); -void sub_0805FF18(Entity* this); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unused[23]; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; + /*0x84*/ ScriptExecutionContext* context; +} FestariEntity; -void Festari(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void sub_0805FF2C(FestariEntity* this, ScriptExecutionContext* context); +void sub_0805FE10(FestariEntity* this); +void sub_0805FE48(FestariEntity* this); +void sub_0805FF18(FestariEntity* this); + +void Festari(FestariEntity* this) { + static void (*const actionFuncs[])(FestariEntity*) = { sub_0805FE10, sub_0805FE48, sub_0805FF18, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void sub_0805FE10(Entity* this) { - this->action = 1; - this->spriteSettings.draw = TRUE; - SetDefaultPriority(this, PRIO_MESSAGE); - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - sub_0807DD50(this); +void sub_0805FE10(FestariEntity* this) { + super->action = 1; + super->spriteSettings.draw = TRUE; + SetDefaultPriority(super, PRIO_MESSAGE); + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitScriptForNPC(super); } -void sub_0805FE48(Entity* this) { +void sub_0805FE48(FestariEntity* this) { u32 uVar4; - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh); - sub_0805FF2C(this, *(ScriptExecutionContext**)&this->cutsceneBeh); - uVar4 = this->field_0x80.HWORD; + ExecuteScript(super, this->context); + sub_0805FF2C(this, this->context); + uVar4 = this->unk_80; if (uVar4 < 8) { - if ((this->field_0x82.HWORD & 1) != 0) { - uVar4 = (uVar4 & 0xfc) + (this->subtimer >> 1); + if ((this->unk_82 & 1) != 0) { + uVar4 = (uVar4 & 0xfc) + (super->subtimer >> 1); } else { - uVar4 = (uVar4 & 0xfc) + (this->animationState >> 1); - this->subtimer = this->animationState; + uVar4 = (uVar4 & 0xfc) + (super->animationState >> 1); + super->subtimer = super->animationState; } } - if (uVar4 != this->animIndex) { - InitAnimationForceUpdate(this, uVar4); + if (uVar4 != super->animIndex) { + InitAnimationForceUpdate(super, uVar4); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); - if (this->frame & ANIM_DONE) { - switch (this->animIndex) { + if (super->frame & ANIM_DONE) { + switch (super->animIndex) { case 8: case 10: case 11: case 12: - this->field_0x80.HWORD = 0; + this->unk_80 = 0; break; } } - if ((this->field_0x82.HWORD & (~this->field_0x82.HWORD + 1)) == 2) { - sub_0806ED78(this); + if ((this->unk_82 & (~this->unk_82 + 1)) == 2) { + sub_0806ED78(super); } } } -void sub_0805FF18(Entity* this) { - if (UpdateFuseInteraction(this)) { - this->action = 1; +void sub_0805FF18(FestariEntity* this) { + if (UpdateFuseInteraction(super)) { + super->action = 1; } } -void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) { +void sub_0805FF2C(FestariEntity* this, ScriptExecutionContext* context) { u32 actions; u32 bit; @@ -86,35 +101,35 @@ void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) { actions ^= bit; switch (bit) { case 4: - this->field_0x80.HWORD = 9; + this->unk_80 = 9; break; case 0x200000: - this->field_0x80.HWORD = 10; + this->unk_80 = 10; break; case 0x400000: - if (this->animationState == 2) { - this->field_0x80.HWORD = 0xb; + if (super->animationState == 2) { + this->unk_80 = 0xb; } else { - this->field_0x80.HWORD = 0xc; + this->unk_80 = 0xc; } break; case 0x100000: - this->field_0x80.HWORD = 8; + this->unk_80 = 8; break; } } } - HandlePostScriptActions(this, context); + HandlePostScriptActions(super, context); } -void Festari_Fusion(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); - InitAnimationForceUpdate(this, 8); +void Festari_Fusion(FestariEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + SetDefaultPriority(super, PRIO_MESSAGE); + InitAnimationForceUpdate(super, 8); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index b002d976..7943e305 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -1,3 +1,10 @@ +/** + * @file forestMinish.c + * @ingroup NPCs + * + * @brief Forest Minish NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "kinstone.h" @@ -5,6 +12,15 @@ #include "object.h" #include "playeritem.h" #include "structures.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; + /*0x6a*/ u8 unused[22]; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; + /*0x84*/ ScriptExecutionContext* context; +} ForestMinishEntity; const FrameStruct gUnk_08109C98[] = { { 36, 26 }, { 37, 26 }, { 38, 26 }, { 39, 155 }, { 40, 155 }, { 41, 155 }, { 42, 155 }, { 43, 152 }, @@ -499,44 +515,45 @@ const u16 gUnk_0810A362[] = { TEXT_INDEX(TEXT_BELARI, 0x8), }; -static void sub_080600F0(Entity* this); +static void sub_080600F0(ForestMinishEntity* this); +extern void sub_08060158(ForestMinishEntity* this); -void ForestMinish(Entity* this) { - switch (this->action) { +void ForestMinish(ForestMinishEntity* this) { + switch (super->action) { case 0: - if (LoadExtraSpriteData(this, gUnk_0810A348)) { - this->action = 1; - this->spriteSettings.draw = TRUE; - this->field_0x68.HALF.HI = this->animationState = this->timer << 1; - this->timer = 0; - SetDefaultPriority(this, PRIO_MESSAGE); - StartCutscene(this, (u16*)gUnk_08109D18[this->type2]); - sub_0807DD50(this); + if (LoadExtraSpriteData(super, gUnk_0810A348)) { + super->action = 1; + super->spriteSettings.draw = TRUE; + this->animIndex = super->animationState = super->timer << 1; + super->timer = 0; + SetDefaultPriority(super, PRIO_MESSAGE); + StartCutscene(super, (u16*)gUnk_08109D18[super->type2]); + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - if (this->frameDuration != 0xf0) { + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + if (super->frameDuration != 0xf0) { sub_080600F0(this); } } break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } } } -void ForestMinish_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void ForestMinish_MakeInteractable(ForestMinishEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void ForestMinish_Head(Entity* this) { @@ -555,64 +572,64 @@ void ForestMinish_Head(Entity* this) { sub_0807000C(this); } -static void sub_080600F0(Entity* this) { +static void sub_080600F0(ForestMinishEntity* this) { u32 uVar1; u32 uVar2; - uVar2 = this->field_0x80.HWORD; - if (this->field_0x80.HWORD < 8) { - if ((this->field_0x82.HWORD & 1) != 0) { - uVar2 = (uVar2 & 0xfc) + (this->subtimer >> 1); + uVar2 = this->unk_80; + if (this->unk_80 < 8) { + if ((this->unk_82 & 1) != 0) { + uVar2 = (uVar2 & 0xfc) + (super->subtimer >> 1); } else { - uVar2 = (uVar2 & 0xfc) + (this->animationState >> 1); - this->subtimer = this->animationState; + uVar2 = (uVar2 & 0xfc) + (super->animationState >> 1); + super->subtimer = super->animationState; } } - if (uVar2 != this->animIndex) { - InitAnimationForceUpdate(this, uVar2); + if (uVar2 != super->animIndex) { + InitAnimationForceUpdate(super, uVar2); } - if ((this->field_0x82.HWORD & 4) != 0) { + if ((this->unk_82 & 4) != 0) { uVar1 = 2; } else { uVar1 = 1; } - sub_080042BA(this, uVar1); + sub_080042BA(super, uVar1); } -void sub_0806014C(Entity* this) { - this->timer = 0; +void sub_0806014C(ForestMinishEntity* this) { + super->timer = 0; sub_08060158(this); } -void sub_08060158(Entity* this) { +void sub_08060158(ForestMinishEntity* this) { int index; const FrameStruct* idx3; u8 tmp1, tmp2; - if (this->timer) { - this->timer--; + if (super->timer) { + super->timer--; } else { - this->timer = 2; - index = GetFacingDirectionInRectRadius(this, 0x20, 0x20); + super->timer = 2; + index = GetFacingDirectionInRectRadius(super, 0x20, 0x20); if (index < 0) { - int state = this->field_0x68.HALF.HI; - this->animationState = state; + int state = this->animIndex; + super->animationState = state; index = state * 4; } - idx3 = gUnk_08109C98 + (this->animationState / 2) * 0x10 + (index >> 1); + idx3 = gUnk_08109C98 + (super->animationState / 2) * 0x10 + (index >> 1); tmp1 = idx3->frame; tmp2 = idx3->frameIndex; if (tmp2 & 0x80) { - this->animationState = sub_0806F5B0(index); + super->animationState = GetAnimationStateForDirection8(index); } tmp2 &= ~0x80; - this->frame = tmp1; - this->frameIndex = tmp2; - this->frameSpriteSettings = 1; - this->animIndex = 0; - this->frameDuration = 0xf0; + super->frame = tmp1; + super->frameIndex = tmp2; + super->frameSpriteSettings = 1; + super->animIndex = 0; + super->frameDuration = 0xf0; } } @@ -706,13 +723,13 @@ void sub_08060318(void) { } void sub_08060340(void) { - gSave.timers[1] = gSave.unk50; + gSave.drug_kill_count = gSave.enemies_killed; } u32 sub_08060354(void) { s32 iVar2; - iVar2 = gSave.unk50 - gSave.timers[1]; + iVar2 = gSave.enemies_killed - gSave.drug_kill_count; if (CheckGlobalFlag(DRUG_1) == 0) { if (4 < iVar2) { return 0x8444; diff --git a/src/npc/fusionMenuNPC.c b/src/npc/fusionMenuNPC.c index 01f5c111..01d970e3 100644 --- a/src/npc/fusionMenuNPC.c +++ b/src/npc/fusionMenuNPC.c @@ -1,4 +1,12 @@ -#include "global.h" +/** + * @file fusionMenuNPC.c + * @ingroup NPCs + * + * @brief Fusion Menu NPC + * + * Representation for the NPCs in the fusion menu. + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/gentari.c b/src/npc/gentari.c index d2d36028..e8621c42 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -1,30 +1,42 @@ -#include "global.h" +/** + * @file gentari.c + * @ingroup NPCs + * + * @brief Gentari NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" -void Gentari(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} GentariEntity; + +void Gentari(GentariEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = TRUE; - SetDefaultPriority(this, PRIO_MESSAGE); - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = TRUE; + SetDefaultPriority(super, PRIO_MESSAGE); + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } } } diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 2fe80a97..56597734 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -1,47 +1,60 @@ +/** + * @file ghostBrothers.c + * @ingroup NPCs + * + * @brief Ghost Brothers NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" -#include "save.h" -#include "screen.h" #include "message.h" #include "npc.h" +#include "save.h" +#include "screen.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unused[3]; + /*0x6c*/ const u16* unk_6c; +} GhostBrothersEntity; extern u32 gSpriteAnimations_GhostBrothers[]; -void sub_08065C0C(Entity* this); -void sub_08065BF4(Entity* this); -void sub_08065EBC(Entity* this); -void sub_08065D18(Entity* this); -void sub_08065D74(Entity* this); -void sub_08065DB8(Entity* this); -void sub_08065D18(Entity* this); -void sub_08065EDC(Entity* this); -void sub_08065F20(Entity* this); +void sub_08065C0C(GhostBrothersEntity* this); +void sub_08065BF4(GhostBrothersEntity* this); +void sub_08065EBC(GhostBrothersEntity* this); +void sub_08065D18(GhostBrothersEntity* this); +void sub_08065D74(GhostBrothersEntity* this); +void sub_08065DB8(GhostBrothersEntity* this); +void sub_08065EDC(GhostBrothersEntity* this); +void sub_08065F20(GhostBrothersEntity* this); -void GhostBrothers(Entity* this) { +void GhostBrothers(GhostBrothersEntity* this) { static const s8 gUnk_0811015C[8] = { -14, -16, -18, -20, -22, -20, -18, -16 }; - static EntityAction* const actionFuncs[] = { + static void (*const actionFuncs[])(GhostBrothersEntity*) = { sub_08065BF4, sub_08065BF4, sub_08065BF4, sub_08065BF4, sub_08065EBC, sub_08065EBC, }; - if (this->flags & ENT_SCRIPTED) { + if (super->flags & ENT_SCRIPTED) { sub_08065C0C(this); } else { - actionFuncs[this->type](this); + actionFuncs[super->type](this); - if (this->type < 3) { + if (super->type < 3) { const s8* ptr = gUnk_0811015C; - u32 subtimer = this->subtimer++; - this->z.HALF_U.HI = *(ptr + (((subtimer << 0x18) >> 0x1b) & 0x7)); + u32 subtimer = super->subtimer++; + super->z.HALF_U.HI = *(ptr + (((subtimer << 0x18) >> 0x1b) & 0x7)); } } } -void sub_08065BF4(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void sub_08065BF4(GhostBrothersEntity* this) { + static void (*const actionFuncs[])(GhostBrothersEntity*) = { sub_08065D18, sub_08065D74, sub_08065DB8, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } static const u16 gUnk_08110188[] = { 0x1000, 0x4, 0xf01, 0x4, 0xe02, 0x4, 0xd03, 0x4, 0xc04, 0x8, 0xd03, 0x4, @@ -55,139 +68,140 @@ static const u16 gUnk_0811022E[] = { 0x10, 0x2, 0x10f, 0x2, 0x20e, 0x2, 0x30d, 0x60a, 0x2, 0x709, 0x2, 0x808, 0x2, 0x907, 0x2, 0xa06, 0x2, 0xb05, 0x2, 0xc04, 0x2, 0xd03, 0x2, 0xe02, 0x2, 0xf01, 0x2, 0x1000, 0x2, 0xffff }; -void sub_08065C0C(Entity* this) { - u16* puVar3; +void sub_08065C0C(GhostBrothersEntity* this) { + const u16* puVar3; - switch (this->action) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = 1; + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this) == 0) { + if (UpdateFuseInteraction(super) == 0) { return; } - this->action = 1; + super->action = 1; break; case 3: - if (--this->timer != 0) { + if (--super->timer != 0) { return; } - puVar3 = *(u16**)&this->field_0x6c.HWORD; + puVar3 = this->unk_6c; if (*puVar3 != 0xffff) { gScreen.controls.alphaBlend = *puVar3; - this->timer = (u8) * (++puVar3); - *(u16**)&this->field_0x6c = ++puVar3; + super->timer = (u8) * (++puVar3); + this->unk_6c = ++puVar3; return; } - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; - this->action = 1; + super->action = 1; break; } } -void sub_08065CCC(Entity* this) { - this->action = 3; - this->timer = 30; - this->spriteRendering.alphaBlend = 1; - *(const u16**)&this->field_0x6c = gUnk_0811022E; +void sub_08065CCC(GhostBrothersEntity* this) { + super->action = 3; + super->timer = 30; + super->spriteRendering.alphaBlend = 1; + this->unk_6c = gUnk_0811022E; gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x10; } -void GhostBrothers_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void GhostBrothers_MakeInteractable(GhostBrothersEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } -void sub_08065D18(Entity* this) { - this->action = 1; - this->timer = 30; - this->subtimer = 0; - this->spriteSettings.draw = 1; - this->spriteRendering.alphaBlend = 1; - *(const u16**)&this->field_0x6c = gUnk_08110188; - SetDefaultPriority(this, PRIO_MESSAGE); - InitAnimationForceUpdate(this, 2); +void sub_08065D18(GhostBrothersEntity* this) { + super->action = 1; + super->timer = 30; + super->subtimer = 0; + super->spriteSettings.draw = 1; + super->spriteRendering.alphaBlend = 1; + this->unk_6c = gUnk_08110188; + SetDefaultPriority(super, PRIO_MESSAGE); + InitAnimationForceUpdate(super, 2); gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; } -void sub_08065D74(Entity* this) { - u16* ptr; - if (--this->timer) { +void sub_08065D74(GhostBrothersEntity* this) { + const u16* ptr; + if (--super->timer) { return; } - ptr = *(u16**)&this->field_0x6c; + ptr = this->unk_6c; if (*ptr != 0xffff) { gScreen.controls.alphaBlend = *ptr; - this->timer = *(ptr + 1); - *(u32*)&this->field_0x6c = (u32)(ptr + 2); + super->timer = *(ptr + 1); + this->unk_6c = (ptr + 2); } else { - this->action++; + super->action++; MessageFromTarget(0); } } -void sub_08065DB8(Entity* this) { - switch (this->subAction) { +void sub_08065DB8(GhostBrothersEntity* this) { + switch (super->subAction) { case 0: { if ((gMessage.doTextBox & 0x7f) == 0) { - this->subAction++; - this->timer = 60; - InitAnimationForceUpdate(this, 4); + super->subAction++; + super->timer = 60; + InitAnimationForceUpdate(super, 4); } break; } case 1: { - if (--this->timer == 0) { - this->subAction++; - this->timer = 180; + if (--super->timer == 0) { + super->subAction++; + super->timer = 180; gUnk_02018EB0.unk_1++; - InitAnimationForceUpdate(this, 2); + InitAnimationForceUpdate(super, 2); } break; } case 2: break; case 3: { - if (--this->timer == 0) { + if (--super->timer == 0) { MessageFromTarget(0); - this->subAction++; + super->subAction++; } break; } case 4: { if ((gMessage.doTextBox & 0x7f) == 0) { - this->subAction++; - this->timer = 30; - *(const u16**)&this->field_0x6c = gUnk_0811022E; + super->subAction++; + super->timer = 30; + this->unk_6c = gUnk_0811022E; } break; } default: { - if (--this->timer == 0) { - u16* puVar3 = *(u16**)&this->field_0x6c.HWORD; + if (--super->timer == 0) { + const u16* puVar3 = this->unk_6c; if (*puVar3 != 0xffff) { gScreen.controls.alphaBlend = *puVar3; - this->timer = (u8) * (puVar3 + 1); - *(u16**)&this->field_0x6c = (puVar3 + 2); + super->timer = (u8) * (puVar3 + 1); + this->unk_6c = (puVar3 + 2); } else { gUnk_02018EB0.unk_0++; DeleteThisEntity(); @@ -197,43 +211,43 @@ void sub_08065DB8(Entity* this) { } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void sub_08065EBC(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void sub_08065EBC(GhostBrothersEntity* this) { + static void (*const actionFuncs[])(GhostBrothersEntity*) = { sub_08065D18, sub_08065EDC, sub_08065F20, }; - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](this); + sub_0806ED78(super); } -void sub_08065EDC(Entity* this) { - if (--this->timer == 0) { - u16* puVar3 = *(u16**)&this->field_0x6c.HWORD; +void sub_08065EDC(GhostBrothersEntity* this) { + if (--super->timer == 0) { + const u16* puVar3 = this->unk_6c; if (*puVar3 != 0xffff) { gScreen.controls.alphaBlend = *puVar3; - this->timer = (u8) * (++puVar3); - *(u16**)&this->field_0x6c = (++puVar3); + super->timer = (u8) * (++puVar3); + this->unk_6c = (++puVar3); } else { - this->action++; - AddInteractableWhenBigObject(this); + super->action++; + AddInteractableWhenBigObject(super); } } } -void sub_08065F20(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->interactType != 0) { - this->interactType = 0; +void sub_08065F20(GhostBrothersEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; MessageFromTarget(0); - this->animIndex++; - if (gSpriteAnimations_GhostBrothers[this->animIndex] == 0) { - this->animIndex = 0; + super->animIndex++; + if (gSpriteAnimations_GhostBrothers[super->animIndex] == 0) { + super->animIndex = 0; } - InitAnimationForceUpdate(this, this->animIndex); + InitAnimationForceUpdate(super, super->animIndex); } } diff --git a/src/npc/gina.c b/src/npc/gina.c index 0095f7b3..8933653f 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -1,31 +1,43 @@ -#include "global.h" +/** + * @file gina.c + * @ingroup NPCs + * + * @brief Gina NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "npc.h" +#include "player.h" -void Gina(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} GinaEntity; + +void Gina(GinaEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; + super->action = 1; + super->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - sub_0807DD50(this); + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; #if defined(USA) || defined(DEMO_USA) SetLocalFlag(KS_B15); #endif diff --git a/src/npc/gorman.c b/src/npc/gorman.c index b7d13050..4f46912c 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -1,8 +1,21 @@ +/** + * @file gorman.c + * @ingroup NPCs + * + * @brief Gorman NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "npc.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ s8 unk_69; +} GormanEntity; + void sub_080697A4(Entity* this); -void sub_08069838(Entity* this); +void sub_08069838(GormanEntity* this); void sub_08069888(Entity* this); const SpriteLoadData gUnk_08111C3C[] = { @@ -53,11 +66,11 @@ const u8 gUnk_08111CB8[] = { 0, }; -void Gorman(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { +void Gorman(GormanEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_08069838(this); } else { - sub_080697A4(this); + sub_080697A4(super); } } @@ -88,26 +101,26 @@ void sub_080697EC(Entity* this) { this->subtimer--; } } - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; sub_08069888(this); } } -void sub_08069838(Entity* this) { - if (this->action == 0) { - if (!LoadExtraSpriteData(this, gUnk_08111C3C)) { +void sub_08069838(GormanEntity* this) { + if (super->action == 0) { + if (!LoadExtraSpriteData(super, gUnk_08111C3C)) { return; } - this->action++; - this->field_0x68.HALF.LO = 0; - this->field_0x68.HALF.HI = 0; - sub_0807DD64(this); + super->action++; + this->unk_68 = 0; + this->unk_69 = 0; + sub_0807DD64(super); } - sub_0807DD94(this, NULL); - if (this->interactType != 0) { - this->interactType = 0; - sub_08069888(this); + ExecuteScriptAndHandleAnimation(super, NULL); + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; + sub_08069888(super); } } @@ -132,56 +145,56 @@ void sub_08069888(Entity* this) { MessageNoOverlap(gUnk_08111C50[index], this); } -void sub_0806991C(Entity* this, ScriptExecutionContext* context) { +void sub_0806991C(GormanEntity* this, ScriptExecutionContext* context) { u32 tmp; const Coords* ptr; - this->field_0x68.HALF.LO = (Random() & 0x1f) + 0x3c; - ptr = &gUnk_08111C5C[*(s8*)&this->field_0x68.HALF.HI]; + this->unk_68 = (Random() & 0x1f) + 0x3c; + ptr = &gUnk_08111C5C[this->unk_69]; context->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x; context->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y; context->unk_19 = 8; context->postScriptActions |= 2; context->condition = 0; - tmp = CalculateDirectionFromOffsets(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI); - this->direction = tmp; - this->animationState = (this->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c]; + tmp = CalculateDirectionFromOffsets(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI); + super->direction = tmp; + super->animationState = (super->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c]; gActiveScriptInfo.flags |= 1; } -void sub_080699AC(Entity* this, ScriptExecutionContext* context) { +void sub_080699AC(GormanEntity* this, ScriptExecutionContext* context) { u32 tmp; const Coords* ptr; - this->field_0x68.HALF.LO = (Random() & 0x1f) + 0x3c; - ptr = &gUnk_08111C84[*(s8*)&this->field_0x68.HALF.HI]; + this->unk_68 = (Random() & 0x1f) + 0x3c; + ptr = &gUnk_08111C84[this->unk_69]; context->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x; context->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y; context->unk_19 = 8; context->postScriptActions |= 2; context->condition = 0; - tmp = CalculateDirectionFromOffsets(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI); - this->direction = tmp; - this->animationState = (this->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c]; + tmp = CalculateDirectionFromOffsets(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI); + super->direction = tmp; + super->animationState = (super->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c]; gActiveScriptInfo.flags |= 1; } -void sub_08069A3C(Entity* this) { - this->field_0x68.HALF.HI = gUnk_08111C9C[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2]; +void sub_08069A3C(GormanEntity* this) { + this->unk_69 = gUnk_08111C9C[(Random() & 1) + this->unk_69 * 2]; } -void sub_08069A60(Entity* this) { - this->field_0x68.HALF.HI = gUnk_08111CA8[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2]; +void sub_08069A60(GormanEntity* this) { + this->unk_69 = gUnk_08111CA8[(Random() & 1) + this->unk_69 * 2]; } -void sub_08069A84(Entity* this) { - this->field_0x68.HALF.HI = gUnk_08111CB4[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2]; +void sub_08069A84(GormanEntity* this) { + this->unk_69 = gUnk_08111CB4[(Random() & 1) + this->unk_69 * 2]; } -void sub_08069AA8(Entity* this) { - this->field_0x68.HALF.HI = gUnk_08111CB8[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2]; +void sub_08069AA8(GormanEntity* this) { + this->unk_69 = gUnk_08111CB8[(Random() & 1) + this->unk_69 * 2]; } -void sub_08069ACC(Entity* this, ScriptExecutionContext* context) { - if (--this->field_0x68.HALF.LO * 0x1000000 < 1) { +void sub_08069ACC(GormanEntity* this, ScriptExecutionContext* context) { + if (--this->unk_68 * 0x1000000 < 1) { context->condition = 1; } else { context->condition = 0; diff --git a/src/npc/goron.c b/src/npc/goron.c index ce2fb731..6ed59d26 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -1,3 +1,10 @@ +/** + * @file goron.c + * @ingroup NPCs + * + * @brief Goron NPC + */ +#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" @@ -5,27 +12,34 @@ #include "message.h" #include "npc.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[24]; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; +} GoronEntity; + void sub_08069310(Entity*); void sub_08069328(Entity*); void sub_08069390(Entity*); -void sub_080693C4(Entity*); -void sub_080693D0(Entity*); +void sub_080693C4(GoronEntity*); +void sub_080693D0(GoronEntity*); -void Goron(Entity* this) { +void Goron(GoronEntity* this) { static void (*const actionFuncs[])(Entity*) = { sub_08069310, sub_08069328, sub_08069390, }; - static void (*const scriptedActionFuncs[])(Entity*) = { + static void (*const scriptedActionFuncs[])(GoronEntity*) = { sub_080693C4, sub_080693D0, }; - if (this->flags & ENT_SCRIPTED) { - scriptedActionFuncs[this->action](this); + if (super->flags & ENT_SCRIPTED) { + scriptedActionFuncs[super->action](this); } else { - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](super); + sub_0806ED78(super); } } @@ -48,7 +62,7 @@ void sub_08069328(Entity* this) { if (this->animIndex != this->animationState) { InitAnimationForceUpdate(this, this->animationState); } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; RequestPriority(this); InitAnimationForceUpdate(this, 8); @@ -60,31 +74,31 @@ void sub_08069390(Entity* this) { UpdateAnimationSingleFrame(this); if ((gMessage.doTextBox & 0x7F) == 0) { this->action = 1; - this->interactType = 0; + this->interactType = INTERACTION_NONE; RevokePriority(this); InitAnimationForceUpdate(this, this->animationState); } } -void sub_080693C4(Entity* this) { - this->action = 1; - sub_0807DD50(this); +void sub_080693C4(GoronEntity* this) { + super->action = 1; + InitScriptForNPC(super); } void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65); -void sub_080693D0(Entity* this) { - sub_0807DD94(this, NULL); - if (this->animIndex == 8) { - bool32 createFx65 = (this->field_0x82.HWORD & 0xF) != 0; +void sub_080693D0(GoronEntity* this) { + ExecuteScriptAndHandleAnimation(super, NULL); + if (super->animIndex == 8) { + bool32 createFx65 = (this->unk_82 & 0xF) != 0; - if (this->frame == 1) { - this->frame = 0; - sub_08069428(this, Q_16_16(-8.0), createFx65); + if (super->frame == 1) { + super->frame = 0; + sub_08069428(super, Q_16_16(-8.0), createFx65); } - if (this->frame == 2) { - this->frame = 0; - sub_08069428(this, Q_16_16(8.0), createFx65); + if (super->frame == 2) { + super->frame = 0; + sub_08069428(super, Q_16_16(8.0), createFx65); } } } @@ -154,14 +168,14 @@ void sub_080694D8(Entity* this) { ShowNPCDialogue(this, &gUnk_08111A94[this->type]); } -void sub_080694EC(Entity* this) { +void sub_080694EC(GoronEntity* this) { u32 anim; - this->animationState = 4; + super->animationState = 4; anim = 2; if (!CheckKinstoneFused(KINSTONE_2F)) anim = 8; - InitAnimationForceUpdate(this, anim); - this->field_0x80.HWORD = anim; + InitAnimationForceUpdate(super, anim); + this->unk_80 = anim; } void Goron_Fusion(Entity* this) { diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index a26eb4b1..24bb04e7 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -1,11 +1,17 @@ -#include "global.h" +/** + * @file goronMerchant.c + * @ingroup NPCs + * + * @brief Goron Merchant NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "functions.h" -#include "message.h" #include "flags.h" -#include "save.h" -#include "npc.h" +#include "functions.h" #include "item.h" +#include "message.h" +#include "npc.h" +#include "save.h" static u32 GoronMerchant_GetSalePrice(Entity*); @@ -69,11 +75,11 @@ void sub_0806961C(Entity* this) { void sub_0806963C(Entity* this) { this->action = 1; this->spriteSettings.draw = TRUE; - sub_0807DD50(this); + InitScriptForNPC(this); } void sub_08069654(Entity* this) { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } void sub_08069660(Entity* this) { diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 8a279a06..66d89c93 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -1,109 +1,123 @@ +/** + * @file gregal.c + * @ingroup NPCs + * + * @brief Gregal NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" #include "functions.h" #include "npc.h" +#include "script.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} GregalEntity; static const u32 gUnk_08113D84[] = { 0x100c0200, 0x4, }; -void sub_0806CAF4(Entity*); -void sub_0806CB80(Entity*); -void sub_0806CBB4(Entity*); -void sub_0806CC08(Entity*); +void sub_0806CAF4(GregalEntity*); +void sub_0806CB80(GregalEntity*); +void sub_0806CBB4(GregalEntity*); +void sub_0806CC08(GregalEntity*); -void Gregal(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Gregal(GregalEntity* this) { + static void (*const actionFuncs[])(GregalEntity*) = { sub_0806CAF4, sub_0806CB80, sub_0806CBB4, sub_0806CC08, }; - actionFuncs[this->type](this); + actionFuncs[super->type](this); } -void sub_0806CAF4(Entity* this) { +void sub_0806CAF4(GregalEntity* this) { Entity* npc; - if (this->action == 0) { - this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + if (super->action == 0) { + super->action++; + SetDefaultPriority(super, PRIO_MESSAGE); npc = CreateNPC(GREGAL, 1, 0); if (npc != NULL) { - npc->parent = this; - CopyPosition(this, npc); - SortEntityBelow(this, npc); + npc->parent = super; + CopyPosition(super, npc); + SortEntityBelow(super, npc); } npc = CreateNPC(GREGAL, 2, 0); if (npc != NULL) { - npc->parent = this; - CopyPosition(this, npc); - SortEntityAbove(this, npc); + npc->parent = super; + CopyPosition(super, npc); + SortEntityAbove(super, npc); } - sub_0807DD64(this); - AddInteractableWhenBigObject(this); - SetInteractableObjectCollision(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84); + sub_0807DD64(super); + AddInteractableWhenBigObject(super); + SetInteractableObjectCollision(super, 1, (u8)gUnk_08113D84[1], gUnk_08113D84); } - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - GetNextFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + GetNextFrame(super); } -void sub_0806CB80(Entity* this) { - if (this->action == 0) { - this->action++; - this->animationState = 2; - this->frameIndex = 0; - SetDefaultPriority(this, PRIO_MESSAGE); +void sub_0806CB80(GregalEntity* this) { + if (super->action == 0) { + super->action++; + super->animationState = 2; + super->frameIndex = 0; + SetDefaultPriority(super, PRIO_MESSAGE); } - if (this->parent != NULL) { - this->frameIndex = (this->parent->frame & 3) + 0x21; + if (super->parent != NULL) { + super->frameIndex = (super->parent->frame & 3) + 0x21; } } -void sub_0806CBB4(Entity* this) { - if (this->action == 0) { - this->action++; - this->animationState = 2; - SetDefaultPriority(this, PRIO_MESSAGE); - InitializeAnimation(this, 0x11); +void sub_0806CBB4(GregalEntity* this) { + if (super->action == 0) { + super->action++; + super->animationState = 2; + SetDefaultPriority(super, PRIO_MESSAGE); + InitializeAnimation(super, 0x11); } - GetNextFrame(this); - if (this->parent != NULL) { - this->spriteSettings.draw = 0; - if ((this->parent->frame & 4) != 0) { - this->spriteSettings.draw = 1; + GetNextFrame(super); + if (super->parent != NULL) { + super->spriteSettings.draw = 0; + if ((super->parent->frame & 4) != 0) { + super->spriteSettings.draw = 1; } } } -void sub_0806CC08(Entity* this) { - switch (this->action) { +void sub_0806CC08(GregalEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD64(this); + super->action = 1; + super->spriteSettings.draw = 1; + SetDefaultPriority(super, PRIO_MESSAGE); + sub_0807DD64(super); case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - GetNextFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + GetNextFrame(super); } break; case 2: - if (UpdateFuseInteraction(this) == 0) { + if (UpdateFuseInteraction(super) == 0) { return; } - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.HI); + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); break; } } @@ -154,9 +168,9 @@ void sub_0806CD4C(Entity* this) { ChangeObjPalette(this, 0x110); } -void Gregal_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Gregal_MakeInteractable(GregalEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Gregal_Fusion(Entity* this) { diff --git a/src/npc/guard.c b/src/npc/guard.c index 834c2f1b..cb1b7060 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -1,13 +1,28 @@ -#include "global.h" +/** + * @file guard.c + * @ingroup NPCs + * + * @brief Guard NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "flags.h" +#include "functions.h" #include "message.h" +#include "npc.h" +#include "player.h" +#include "projectile.h" #include "room.h" #include "script.h" -#include "functions.h" -#include "npc.h" -#include "projectile.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u16 unk_6a; + /*0x6c*/ u8 unused[4]; + /*0x70*/ s8 unk_70; + /*0x71*/ u8 unk_71; +} GuardEntity; typedef struct { u32 unk; @@ -22,7 +37,6 @@ typedef struct { extern void sub_08063D24(Entity*); extern void sub_08064428(Entity*); void sub_08063DC8(Entity*); -void sub_08063F20(Entity*); // TODO guardWithSpear rodata before this const Dialog gUnk_0810CF4C[] = { @@ -240,10 +254,10 @@ const SpriteLoadData gUnk_0810F524[] = { { 55, 43, 4 }, { 6199, 43, 4 }, { 22583, 43, 4 }, { 0, 0, 0 }, { 4, 43, 4 }, { 16388, 43, 4 }, { 8196, 43, 4 }, { 0, 0, 0 }, }; -void sub_08063E90(Entity*); -void sub_08063F20(Entity*); -void sub_08063F78(Entity*); -void (*const gUnk_0810F544[])(Entity*) = { +void sub_08063E90(GuardEntity*); +void sub_08063F20(GuardEntity*); +void sub_08063F78(GuardEntity*); +void (*const gUnk_0810F544[])(GuardEntity*) = { sub_08063E90, sub_08063F20, sub_08063F78, @@ -261,11 +275,11 @@ void (*const gUnk_0810F550[])(Entity*) = { extern void* gUnk_0810F6BC[]; // TODO find out type of second param for sub_0806EE04 -void Guard(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { - gUnk_0810F544[this->action](this); +void Guard(GuardEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { + gUnk_0810F544[super->action](this); } else { - sub_08063D24(this); + sub_08063D24(super); } } @@ -306,7 +320,7 @@ void sub_08063DC8(Entity* this) { if (this->type == 0xff) { this->action = 2; this->timer = 30; - this->animationState = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); + this->animationState = GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)); InitAnimationForceUpdate(this, this->animationState + 4); } else { sub_0806EE20(this); @@ -316,10 +330,10 @@ void sub_08063DC8(Entity* this) { } else { GetNextFrame(this); } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 3; - this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + this->interactType = INTERACTION_NONE; + InitializeAnimation(this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity))); sub_08064428(this); } } @@ -338,53 +352,54 @@ void sub_08063E6C(Entity* this) { } } -void sub_08063E90(Entity* this) { +void sub_08063E90(GuardEntity* this) { u32 idx; u32 unk; - idx = (this->id ^ 0x15) ? 1 : 0; - if (!LoadExtraSpriteData(this, &gUnk_0810F524[idx * 4])) + idx = (super->id ^ 0x15) ? 1 : 0; + if (!LoadExtraSpriteData(super, &gUnk_0810F524[idx * 4])) return; - this->action++; - if (this->timer) { - this->field_0x70.BYTES.byte0 = 8; + super->action++; + if (super->timer) { + this->unk_70 = 8; } else { - this->field_0x70.BYTES.byte0 = 0; + this->unk_70 = 0; } - this->timer = 0; + super->timer = 0; - unk = sub_0805ACC0(this); + unk = sub_0805ACC0(super); if (unk == 0) { - this->field_0x68.HWORD = this->x.HALF.HI; - this->field_0x6a.HWORD = this->y.HALF.HI; + this->unk_68 = super->x.HALF.HI; + this->unk_6a = super->y.HALF.HI; } else { - this->field_0x68.HWORD = unk >> 0x10; - this->field_0x6a.HWORD = unk; + this->unk_68 = unk >> 0x10; + this->unk_6a = unk; } - this->field_0x70.BYTES.byte1 = 0; - this->collisionLayer = 1; - UpdateSpriteForCollisionLayer(this); - sub_0807DD64(this); + this->unk_71 = 0; + super->collisionLayer = 1; + UpdateSpriteForCollisionLayer(super); + sub_0807DD64(super); sub_08063F20(this); } -void sub_08063F20(Entity* this) { - ExecuteScriptForEntity(this, 0); - HandleEntity0x82Actions(this); - GetNextFrame(this); - if (this->interactType != 0) { - this->action++; - this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + *(s8*)&this->field_0x70); - sub_08064428(this); +void sub_08063F20(GuardEntity* this) { + ExecuteScriptForEntity(super, 0); + HandleEntity0x82Actions(super); + GetNextFrame(super); + if (super->interactType != INTERACTION_NONE) { + super->action++; + super->interactType = INTERACTION_NONE; + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + this->unk_70); + sub_08064428(super); } } -void sub_08063F78(Entity* this) { +void sub_08063F78(GuardEntity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { - this->action = this->action - 1; - InitializeAnimation(this, (this->animationState >> 1) + 4 + *(s8*)&this->field_0x70); + super->action = super->action - 1; + InitializeAnimation(super, (super->animationState >> 1) + 4 + this->unk_70); } } diff --git a/src/npc/guardWithSpear.c b/src/npc/guardWithSpear.c index f74b97ce..52f03587 100644 --- a/src/npc/guardWithSpear.c +++ b/src/npc/guardWithSpear.c @@ -1,20 +1,26 @@ +/** + * @file guardWithSpear.c + * @ingroup NPCs + * + * @brief Guard with Spear NPC + */ #define NENT_DEPRECATED #include "entity.h" -#include "script.h" -#include "player.h" -#include "npc.h" #include "functions.h" -#include "object.h" #include "item.h" +#include "npc.h" +#include "object.h" +#include "player.h" +#include "script.h" typedef struct { - Entity base; - s16 unk68; - s16 unk6a; - s16 unk6c; - s16 unk6e; - s8 unk70; - s8 unk71; + /*0x00*/ Entity base; + /*0x68*/ s16 unk_68; + /*0x6a*/ s16 unk_6a; + /*0x6c*/ s16 unk_6c; + /*0x6e*/ s16 unk_6e; + /*0x70*/ s8 unk_70; + /*0x71*/ s8 unk_71; } GuardWithSpearEntity; extern Dialog gUnk_0810CF4C[]; @@ -53,34 +59,34 @@ void sub_0806407C(GuardWithSpearEntity* this, ScriptExecutionContext* context) { } super->direction = dir; - super->animationState = sub_0806F5B0(dir); + super->animationState = GetAnimationStateForDirection8(dir); super->speed = 0x80; } uVar7 = super->animationState >> 1; if (uVar7 + 4 != super->animIndex) { - InitializeAnimation(super, uVar7 + 4 + this->unk70); + InitializeAnimation(super, uVar7 + 4 + this->unk_70); } ProcessMovement0(super); - x = super->x.HALF.HI - this->unk68; + x = super->x.HALF.HI - this->unk_68; if (0x10 < x) { - super->x.HALF.HI = this->unk68 + 0x10; + super->x.HALF.HI = this->unk_68 + 0x10; context->unk_12 = 1; } if (x < -0x10) { - super->x.HALF.HI = this->unk68 + -0x10; + super->x.HALF.HI = this->unk_68 + -0x10; context->unk_12 = 1; } - y = super->y.HALF.HI - this->unk6a; + y = super->y.HALF.HI - this->unk_6a; if (0x10 < y) { - super->y.HALF.HI = this->unk6a + 0x10; + super->y.HALF.HI = this->unk_6a + 0x10; context->unk_12 = 1; } if (y < -0x10) { - super->y.HALF.HI = this->unk6a + -0x10; + super->y.HALF.HI = this->unk_6a + -0x10; context->unk_12 = 1; } @@ -102,8 +108,8 @@ void sub_08064198(GuardWithSpearEntity* this) { u32 animIndex; u32 animationState; - if (this->unk71 > 0) { - this->unk71--; + if (this->unk_71 > 0) { + this->unk_71--; } yDiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; @@ -129,17 +135,18 @@ void sub_08064198(GuardWithSpearEntity* this) { if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) { CreateDustSmall(super); } - this->unk71 = 10; - animationState = super->animationState = sub_0806F5B0(super->direction); - animIndex = (animationState >> 1) + 4 + this->unk70; + this->unk_71 = 10; + animationState = super->animationState = GetAnimationStateForDirection8(super->direction); + animIndex = (animationState >> 1) + 4 + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); } } } - if (this->unk71 == 0) { - animationState = super->animationState = sub_0806F5B0(GetFacingDirection(super, &gPlayerEntity)); - animIndex = (animationState >> 1) + this->unk70; + if (this->unk_71 == 0) { + animationState = super->animationState = + GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity)); + animIndex = (animationState >> 1) + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); } @@ -158,8 +165,8 @@ void sub_080642B8(GuardWithSpearEntity* this) { u32 animIndex; u32 animationState; - if (this->unk71 > 0) { - this->unk71--; + if (this->unk_71 > 0) { + this->unk_71--; } yDiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; @@ -185,17 +192,18 @@ void sub_080642B8(GuardWithSpearEntity* this) { if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) { CreateDustSmall(super); } - this->unk71 = 10; - animationState = super->animationState = sub_0806F5B0(super->direction); - animIndex = (animationState >> 1) + 4 + this->unk70; + this->unk_71 = 10; + animationState = super->animationState = GetAnimationStateForDirection8(super->direction); + animIndex = (animationState >> 1) + 4 + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); } } } - if (this->unk71 == 0) { - animationState = super->animationState = sub_0806F5B0(GetFacingDirection(super, &gPlayerEntity)); - animIndex = (animationState >> 1) + this->unk70; + if (this->unk_71 == 0) { + animationState = super->animationState = + GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity)); + animIndex = (animationState >> 1) + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); } diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index 1c45bbf3..93cb3c36 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -1,47 +1,60 @@ +/** + * @file hurdyGurdyMan.c + * @ingroup NPCs + * + * @brief Hurdy Gurdy Man NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" -#include "save.h" #include "npc.h" +#include "save.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unk_69; +} HurdyGurdyManEntity; static const SpriteLoadData gUnk_081144F0[] = { { 0x163, 0x59, 0x4 }, { 0x4163, 0x59, 0x4 }, { 0, 0, 0 } }; extern u16* gUnk_08001A7C[]; -void HurdyGurdyMan(Entity* this) { +void HurdyGurdyMan(HurdyGurdyManEntity* this) { u32 index; u16* pointerToArray; - switch (this->action) { + switch (super->action) { case 0: - if (LoadExtraSpriteData(this, gUnk_081144F0)) { - this->action = 1; - this->field_0x68.HALF.HI = 0; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + if (LoadExtraSpriteData(super, gUnk_081144F0)) { + super->action = 1; + this->unk_69 = 0; + SetDefaultPriority(super, PRIO_MESSAGE); + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - index = GetFuserId(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->unk_69 = super->animIndex; + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + index = GetFuserId(super); pointerToArray = gUnk_08001A7C[index]; - if (this->field_0x68.HALF.LO == 0x32) { + if (this->fusionOffer == 0x32) { pointerToArray = pointerToArray + 3; } - sub_0801DFB4(this, *pointerToArray, pointerToArray[1], (u32)pointerToArray[2]); + InitializeFuseInfo(super, *pointerToArray, pointerToArray[1], (u32)pointerToArray[2]); gPlayerState.controlMode = CONTROL_DISABLED; } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if ((UpdateFuseInteraction(this) != 0)) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + if ((UpdateFuseInteraction(super) != 0)) { + super->action = 1; + InitializeAnimation(super, this->unk_69); } break; } @@ -100,9 +113,9 @@ void sub_0806E418(Entity* this) { ShowNPCDialogue(this, &dialogs[tmp]); } -void HurdyGurdyMan_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void HurdyGurdyMan_MakeInteractable(HurdyGurdyManEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void HurdyGurdyMan_Fusion(Entity* this) { diff --git a/src/npc/kid.c b/src/npc/kid.c index b2666464..7576c8a9 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -1,8 +1,29 @@ +/** + * @file kid.c + * @ingroup NPCs + * + * @brief Kid NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "npc.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69; + /*0x6a*/ u8 fusionOffer; + /*0x6b*/ u8 unk_6b; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u16 unk_6e; + /*0x70*/ u8 unused1[16]; + /*0x80*/ u16 unk_80; + /*0x82*/ u8 unused2[2]; + /*0x84*/ ScriptExecutionContext* context; +} KidEntity; + const SpriteLoadData gUnk_0810BD7C[] = { { 58, 59, 4 }, { 10298, 59, 4 }, @@ -73,13 +94,12 @@ const u16 gUnk_0810BDE8[][2] = { { TEXT_INDEX(TEXT_EMPTY, 0x1), TEXT_INDEX(TEXT_EMPTY, 0x1), } }; -void sub_080620F4(Entity*); -void sub_08062130(Entity*); -void sub_08062194(Entity*); -void (*const gUnk_0810BE0C[])(Entity*) = { sub_080620F4, sub_08062130, sub_08062194 }; +void sub_080620F4(KidEntity*); +void sub_08062130(KidEntity*); +void sub_08062194(KidEntity*); +void (*const gUnk_0810BE0C[])(KidEntity*) = { sub_080620F4, sub_08062130, sub_08062194 }; extern s32 sub_080041E8(s32 x1, s32 y1, s32 x2, s32 y2); -void sub_08062194(Entity*); const Dialog gUnk_0810BE10[] = { { 0, 0, DIALOG_NORMAL, 1, { 0, TEXT_INDEX(TEXT_FESTIVAL, 0xf) } }, { 0, 0, DIALOG_NORMAL, 1, { 0, TEXT_INDEX(TEXT_TOWN4, 0x33) } }, @@ -179,10 +199,10 @@ const FrameStruct gUnk_0810C0A0[] = { { 120, 83 }, { 128, 15 }, { 131, 102 }, { 128, 15 }, { 139, 111 }, { 128, 15 }, }; -void sub_080621AC(Entity*); -void sub_080622F4(Entity*); -void sub_0806265C(Entity*, ScriptExecutionContext*); -void sub_0806252C(Entity*); +void sub_080621AC(KidEntity* this); +void sub_080622F4(KidEntity* this); +void sub_0806265C(Entity* this, ScriptExecutionContext* context); +void sub_0806252C(Entity* this); typedef union { struct { @@ -198,114 +218,115 @@ typedef union { #define KID_HEAP_COUNT 0x14 typedef KidHeapItem KidHeap[KID_HEAP_COUNT]; -#define KID_HEAP ((KidHeapItem*)this->myHeap) +#define KID_HEAP ((KidHeapItem*)super->myHeap) -void Kid(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { +void Kid(KidEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_080621AC(this); } else { - gUnk_0810BE0C[this->action](this); + gUnk_0810BE0C[super->action](this); } } -void sub_080620F4(Entity* this) { - if (LoadExtraSpriteData(this, gUnk_0810BDC4[this->type])) { - this->animationState = 4; - this->field_0x68.HALF.LO = 0; - this->action = 1; - InitAnimationForceUpdate(this, 2); - AddInteractableWhenBigObject(this); +void sub_080620F4(KidEntity* this) { + if (LoadExtraSpriteData(super, gUnk_0810BDC4[super->type])) { + super->animationState = 4; + this->unk_68 = 0; + super->action = 1; + InitAnimationForceUpdate(super, 2); + AddInteractableWhenBigObject(super); } } -void sub_08062130(Entity* this) { - if (this->interactType != 0) { - this->action = 2; - InitAnimationForceUpdate(this, GetAnimationState(this)); +void sub_08062130(KidEntity* this) { + if (super->interactType != INTERACTION_NONE) { + super->action = 2; + InitAnimationForceUpdate(super, GetAnimationState(super)); } - if (this->subtimer++ >= 0x79) { - this->subtimer = 0; - this->timer = (this->timer + 1) & 7; - if (this->type == 6) { - this->timer = this->timer + 16; + if (super->subtimer++ >= 0x79) { + super->subtimer = 0; + super->timer = (super->timer + 1) & 7; + if (super->type == 6) { + super->timer = super->timer + 16; } - InitAnimationForceUpdate(this, this->timer); + InitAnimationForceUpdate(super, super->timer); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } - sub_0806ED78(this); + sub_0806ED78(super); } -void sub_08062194(Entity* this) { +void sub_08062194(KidEntity* this) { MessageFromTarget(0); - this->action = 1; - this->interactType = 0; + super->action = 1; + super->interactType = INTERACTION_NONE; } -void sub_080621AC(Entity* this) { +void sub_080621AC(KidEntity* this) { u32 tmp; - switch (this->action) { + switch (super->action) { case 0: - if (LoadExtraSpriteData(this, gUnk_0810BDC4[this->type])) { - this->action = 1; - this->animationState = this->timer; - this->timer = 0; - this->field_0x68.HALF.LO = 0; - this->field_0x68.HALF.HI = 0; - this->field_0x6a.HALF.HI = 0xff; - tmp = sub_0805ACC0(this); + if (LoadExtraSpriteData(super, gUnk_0810BDC4[super->type])) { + super->action = 1; + super->animationState = super->timer; + super->timer = 0; + this->unk_68 = 0; + this->unk_69 = 0; + this->unk_6b = 0xff; + tmp = sub_0805ACC0(super); if (tmp == 0) { - this->field_0x6c.HWORD = this->x.HALF.HI; - this->field_0x6e.HWORD = this->y.HALF.HI; + this->unk_6c = super->x.HALF.HI; + this->unk_6e = super->y.HALF.HI; } else { - this->field_0x6c.HWORD = tmp >> 0x10; - this->field_0x6e.HWORD = tmp; + this->unk_6c = tmp >> 0x10; + this->unk_6e = tmp; } - sub_0807DD50(this); + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 3; - this->interactType = 0; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 3; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); } else { - if ((s8)this->field_0x68.HALF.LO != 0) { - if (this->interactType != 0) { - this->action = 2; - this->interactType = 0; + if ((s8)this->unk_68 != 0) { + if (super->interactType != INTERACTION_NONE) { + super->action = 2; + super->interactType = INTERACTION_NONE; } else { sub_080622F4(this); return; } } else { - sub_0807DD94(this, NULL); - if (this->interactType != 0) { - this->action = 2; - this->interactType = 0; + ExecuteScriptAndHandleAnimation(super, NULL); + if (super->interactType != INTERACTION_NONE) { + super->action = 2; + super->interactType = INTERACTION_NONE; } else { return; } } - sub_0806265C(this, *(ScriptExecutionContext**)&this->cutsceneBeh); - tmp = this->animIndex; + sub_0806265C(super, this->context); + tmp = super->animIndex; } - this->field_0x6a.HALF.HI = this->animIndex; - if (this->animIndex < 8) { - InitializeAnimation(this, (this->animIndex & 0xfffffffc) + - sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + this->unk_6b = super->animIndex; + if (super->animIndex < 8) { + InitializeAnimation(super, + (super->animIndex & 0xfffffffc) + + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } break; case 2: - GetNextFrame(this); + GetNextFrame(super); if ((gMessage.doTextBox & 0x7f) == 0) { - this->action = 1; + super->action = 1; } break; case 3: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } break; default: @@ -321,7 +342,7 @@ void sub_080621AC(Entity* this) { heapPtr--; \ } -void sub_080622F4(Entity* this) { +void sub_080622F4(KidEntity* this) { s32 dx; s32 dy; s32 dist; @@ -341,10 +362,10 @@ void sub_080622F4(Entity* this) { item.FIELDS.animationState = gPlayerEntity.animationState; item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; - heapPtr = this->myHeap; + heapPtr = super->myHeap; if (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16) { - dx = this->x.HALF.HI - gPlayerEntity.x.HALF.HI; - dy = this->y.HALF.HI - gPlayerEntity.y.HALF.HI; + dx = super->x.HALF.HI - gPlayerEntity.x.HALF.HI; + dy = super->y.HALF.HI - gPlayerEntity.y.HALF.HI; if (dx < 0) dx = -dx; @@ -352,11 +373,11 @@ void sub_080622F4(Entity* this) { dy = -dy; if (dx > 120 || dy > 80) { - this->field_0x68.HALF.LO = 0; + this->unk_68 = 0; return; } - sub_0806252C(this); + sub_0806252C(super); } animIndex = 0; @@ -367,8 +388,8 @@ void sub_080622F4(Entity* this) { heapPtr[0] = item; animIndex = 0x4; - if ((s8)this->field_0x68.HALF.HI > 0) { - this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1; + if ((s8)this->unk_69 > 0) { + this->unk_69 = this->unk_69 - 1; } } else { heapPtr += KID_HEAP_COUNT - 1; @@ -388,40 +409,40 @@ void sub_080622F4(Entity* this) { } heapPtr = KID_HEAP; heapPtr += +KID_HEAP_COUNT - 1; - this->x.HALF.HI = heapPtr->FIELDS.x; - this->y.HALF.HI = heapPtr->FIELDS.y; - this->z.HALF.HI = heapPtr->FIELDS.z; - this->animationState = heapPtr->FIELDS.animationState; - this->collisionLayer = heapPtr->FIELDS.collisionLayer; + super->x.HALF.HI = heapPtr->FIELDS.x; + super->y.HALF.HI = heapPtr->FIELDS.y; + super->z.HALF.HI = heapPtr->FIELDS.z; + super->animationState = heapPtr->FIELDS.animationState; + super->collisionLayer = heapPtr->FIELDS.collisionLayer; - if (((s8)this->field_0x68.HALF.HI) > 0) { - this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1; + if (((s8)this->unk_69) > 0) { + this->unk_69 = this->unk_69 - 1; } animIndexTmp = animIndex; - animIndex += this->animationState >> 1; - if (this->type == OBJECT) { + animIndex += super->animationState >> 1; + if (super->type == OBJECT) { animIndex += 0x10; } - if (!(animIndex == this->animIndex || (animIndexTmp == 0 && ((s8)this->field_0x68.HALF.HI) > 0))) { - InitAnimationForceUpdate(this, animIndex); - this->field_0x68.HALF.HI = 0x1e; + if (!(animIndex == super->animIndex || (animIndexTmp == 0 && ((s8)this->unk_69) > 0))) { + InitAnimationForceUpdate(super, animIndex); + this->unk_69 = 0x1e; } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } - sub_0800451C(this); + sub_0800451C(super); return; } -void sub_08062500(Entity* this) { - this->myHeap = zMalloc(sizeof(KidHeap)); - if (this->myHeap != NULL) { - this->field_0x68.HALF.LO = 1; - RemoveInteractableObject(this); - this->hitbox = NULL; - sub_0806252C(this); +void sub_08062500(KidEntity* this) { + super->myHeap = zMalloc(sizeof(KidHeap)); + if (super->myHeap != NULL) { + this->unk_68 = 1; + RemoveInteractableObject(super); + super->hitbox = NULL; + sub_0806252C(super); } } @@ -638,7 +659,7 @@ void Kid_Head(Entity* this) { } } -void sub_08062948(Entity* this, ScriptExecutionContext* context) { +void sub_08062948(KidEntity* this, ScriptExecutionContext* context) { s32 bVar1; u16 uVar2; u32 uVar3; @@ -648,7 +669,7 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) { context->unk_18++; context->unk_12 = (Random() & 0x3f) + 0x20; uVar3 = Random() & 0x18; - switch (this->direction) { + switch (super->direction) { case 0: if (uVar3 == 0x10) { uVar3 = 8; @@ -670,32 +691,32 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) { } } - this->direction = (u8)uVar3; - this->animationState = sub_0806F5B0(uVar3); - this->speed = 0x80; + super->direction = (u8)uVar3; + super->animationState = GetAnimationStateForDirection8(uVar3); + super->speed = 0x80; } - uVar3 = (this->animationState >> 1) + 4; - if (uVar3 != this->animIndex) { - InitializeAnimation(this, uVar3); - this->field_0x80.HWORD = (u16)this->animIndex; + uVar3 = (super->animationState >> 1) + 4; + if (uVar3 != super->animIndex) { + InitializeAnimation(super, uVar3); + this->unk_80 = (u16)super->animIndex; } - ProcessMovement0(this); - iVar4 = this->x.HALF.HI - (s16)this->field_0x6c.HWORD; + ProcessMovement0(super); + iVar4 = super->x.HALF.HI - (s16)this->unk_6c; if (0x10 < iVar4) { - this->x.HALF.HI = this->field_0x6c.HWORD + 0x10; + super->x.HALF.HI = this->unk_6c + 0x10; context->unk_12 = 1; } if (iVar4 < -0x10) { - this->x.HALF.HI = this->field_0x6c.HWORD - 0x10; + super->x.HALF.HI = this->unk_6c - 0x10; context->unk_12 = 1; } - iVar4 = this->y.HALF.HI - (s16)this->field_0x6e.HWORD; + iVar4 = super->y.HALF.HI - (s16)this->unk_6e; if (0x10 < iVar4) { - this->y.HALF.HI = this->field_0x6e.HWORD + 0x10; + super->y.HALF.HI = this->unk_6e + 0x10; context->unk_12 = 1; } if (iVar4 < -0x10) { - this->y.HALF.HI = this->field_0x6e.HWORD - 0x10; + super->y.HALF.HI = this->unk_6e - 0x10; context->unk_12 = 1; } if (--context->unk_12 != 0) { @@ -703,9 +724,9 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) { } } -void Kid_MakeInteractable(Entity* this, ScriptExecutionContext* context) { - this->field_0x6a.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x6a.HALF.LO); +void Kid_MakeInteractable(KidEntity* this, ScriptExecutionContext* context) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Kid_Fusion(Entity* this) { diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index 3bdf60a2..d6496e15 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -1,93 +1,105 @@ +/** + * @file kingDaltus.c + * @ingroup NPCs + * + * @brief King Daltus NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" #include "functions.h" -#include "npc.h" #include "item.h" +#include "npc.h" +#include "script.h" -void sub_08066654(Entity*); -void sub_08066688(Entity*); -void sub_080666DC(Entity*); -void sub_080666E4(Entity*); -void sub_0806670C(Entity*); -void sub_08066718(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} KingDaltusEntity; -void KingDaltus(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void sub_08066654(KingDaltusEntity*); +void sub_08066688(KingDaltusEntity*); +void sub_080666DC(KingDaltusEntity*); +void sub_080666E4(KingDaltusEntity*); +void sub_0806670C(KingDaltusEntity*); +void sub_08066718(KingDaltusEntity*); + +void KingDaltus(KingDaltusEntity* this) { + static void (*const actionFuncs[])(KingDaltusEntity*) = { sub_08066654, sub_08066688, sub_080666DC, }; - static void (*const scriptedActionFuncs[])(Entity*) = { + static void (*const scriptedActionFuncs[])(KingDaltusEntity*) = { sub_080666E4, sub_0806670C, sub_08066718, }; - if ((this->flags & ENT_SCRIPTED) != 0) { - if (this->interactType == 2) { - this->interactType = 0; - this->action = 2; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if ((super->flags & ENT_SCRIPTED) != 0) { + if (super->interactType == INTERACTION_FUSE) { + super->interactType = INTERACTION_NONE; + super->action = 2; + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } - scriptedActionFuncs[this->action](this); + scriptedActionFuncs[super->action](this); } else { - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](this); + sub_0806ED78(super); } } -void sub_08066654(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - InitAnimationForceUpdate(this, 2); +void sub_08066654(KingDaltusEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitAnimationForceUpdate(super, 2); } -void sub_08066688(Entity* this) { - s32 tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28); +void sub_08066688(KingDaltusEntity* this) { + s32 tmp = GetAnimationStateInRectRadius(super, 0x28, 0x28); if (tmp < 0) { tmp = 2; } else { - if (this->subtimer == 0) { - this->subtimer = 16; + if (super->subtimer == 0) { + super->subtimer = 16; } else { - this->subtimer--; - tmp = this->animIndex; + super->subtimer--; + tmp = super->animIndex; } } - if (sub_0806F078(this, tmp) == 0) { - UpdateAnimationSingleFrame(this); + if (sub_0806F078(super, tmp) == 0) { + UpdateAnimationSingleFrame(super); } - if (this->interactType != 0) { - this->action = 2; - this->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->action = 2; + super->interactType = INTERACTION_NONE; } } -void sub_080666DC(Entity* this) { - this->action = 1; +void sub_080666DC(KingDaltusEntity* this) { + super->action = 1; } -void sub_080666E4(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_0807DD50(this); +void sub_080666E4(KingDaltusEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + this->fusionOffer = GetFusionToOffer(super); + InitScriptForNPC(super); } -void sub_0806670C(Entity* this) { - sub_0807DD94(this, NULL); +void sub_0806670C(KingDaltusEntity* this) { + ExecuteScriptAndHandleAnimation(super, NULL); } -void sub_08066718(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; +void sub_08066718(KingDaltusEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } } -void KingDaltus_MakeInteractable(Entity* this) { - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void KingDaltus_MakeInteractable(KingDaltusEntity* this) { + AddInteractableWhenBigFuser(super, this->fusionOffer); } void sub_0806673C(Entity* this) { diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index c09d7de0..880441c8 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -1,4 +1,10 @@ -#include "global.h" +/** + * @file kingGustaf.c + * @ingroup NPCs + * + * @brief King Gustaf NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screen.h" @@ -11,13 +17,13 @@ void KingGustaf(Entity* this) { this->spriteRendering.alphaBlend = 1; this->collisionLayer = 2; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; this->speed = 0x1000; this->zVelocity = 0; } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); speed = 0x100; speed *= this->speed; speed += this->zVelocity; diff --git a/src/npc/librari.c b/src/npc/librari.c index e725b669..f1feaf98 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -1,33 +1,44 @@ -#include "global.h" +/** + * @file librari.c + * @ingroup NPCs + * + * @brief Librari NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "npc.h" #include "item.h" +#include "npc.h" -void Librari(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} LibrariEntity; + +void Librari(LibrariEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = TRUE; - this->animationState = this->timer; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = TRUE; + super->animationState = super->timer; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + SetDefaultPriority(super, PRIO_MESSAGE); + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - UpdateAnimationSingleFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + UpdateAnimationSingleFrame(super); } break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } } } diff --git a/src/npc/librarians.c b/src/npc/librarians.c index 1a58777d..86558d16 100644 --- a/src/npc/librarians.c +++ b/src/npc/librarians.c @@ -1,10 +1,17 @@ +/** + * @file librarians.c + * @ingroup NPCs + * + * @brief Librarians NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" -#include "functions.h" #include "flags.h" -#include "message.h" -#include "sound.h" +#include "functions.h" #include "item.h" +#include "message.h" +#include "script.h" +#include "sound.h" extern void sub_08095BE0(Entity*, u32); @@ -13,7 +20,7 @@ extern const u8 gUnk_08114F30[]; void Librarians(Entity* this) { if (this->action == 0) { this->action = 1; - sub_0807DD50(this); + InitScriptForNPC(this); this->spriteRendering.b3 = gUnk_08114F30[this->spriteRendering.b3]; } ExecuteScriptForEntity(this, NULL); diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c index 5c92eefc..cde3c646 100644 --- a/src/npc/mailbox.c +++ b/src/npc/mailbox.c @@ -1,7 +1,13 @@ -#include "global.h" +/** + * @file mailbox.c + * @ingroup NPCs + * + * @brief Mailbox NPC + */ +#define NENT_DEPRECATED +#include "effects.h" #include "entity.h" #include "message.h" -#include "effects.h" #include "npc.h" void sub_08063280(Entity*); @@ -32,7 +38,7 @@ void sub_08063210(Entity* this) { void sub_08063220(Entity* this) { u8 bVar1; - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; bVar1 = 8; } else { diff --git a/src/npc/malon.c b/src/npc/malon.c index 1ab967c0..6e75d865 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -1,30 +1,41 @@ -#include "global.h" +/** + * @file malon.c + * @ingroup NPCs + * + * @brief Malon NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" #include "npc.h" +#include "script.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} MalonEntity; void sub_08065864(Entity* this); void sub_08065880(Entity* this); -void sub_08065888(Entity* this); -void sub_080658BC(Entity* this); -void sub_08065900(Entity* this); +void sub_08065888(MalonEntity* this); +void sub_080658BC(MalonEntity* this); +void sub_08065900(MalonEntity* this); -void Malon(Entity* this) { +void Malon(MalonEntity* this) { static void (*const actionFuncs[])(Entity * this) = { sub_08065864, sub_08065880, }; - static void (*const scriptedActionFuncs[])(Entity * this) = { + static void (*const scriptedActionFuncs[])(MalonEntity * this) = { sub_08065888, sub_080658BC, sub_08065900, }; - if (this->flags & ENT_SCRIPTED) { - scriptedActionFuncs[this->action](this); + if (super->flags & ENT_SCRIPTED) { + scriptedActionFuncs[super->action](this); } else { - actionFuncs[this->action](this); - if (this->action != 0) { - sub_0806ED78(this); + actionFuncs[super->action](super); + if (super->action != 0) { + sub_0806ED78(super); } } } @@ -39,29 +50,29 @@ void sub_08065880(Entity* this) { UpdateAnimationSingleFrame(this); } -void sub_08065888(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->animationState = 4; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - sub_0807DD50(this); +void sub_08065888(MalonEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + super->animationState = 4; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitScriptForNPC(super); } -void sub_080658BC(Entity* this) { - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); +void sub_080658BC(MalonEntity* this) { + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } } -void sub_08065900(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; +void sub_08065900(MalonEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } } diff --git a/src/npc/mama.c b/src/npc/mama.c index 0e2b7620..8590e994 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -1,7 +1,20 @@ +/** + * @file mama.c + * @ingroup NPCs + * + * @brief Mama NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" -#include "save.h" #include "npc.h" +#include "save.h" +#include "script.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} MamaEntity; static const SpriteLoadData gUnk_08113754[] = { { 0x101, 0x4e, 0x4 }, @@ -11,35 +24,35 @@ static const SpriteLoadData gUnk_08113754[] = { bool32 sub_0806C454(Entity* this); -void Mama(Entity* this) { - switch (this->action) { +void Mama(MamaEntity* this) { + switch (super->action) { case 0: - if (sub_0806C454(this) != 0) { - this->action = 1; - this->spriteSettings.draw = 1; - this->animationState = this->timer; - this->field_0x68.HALF.HI = 0; - sub_0807DD50(this); + if (sub_0806C454(super) != 0) { + super->action = 1; + super->spriteSettings.draw = 1; + super->animationState = super->timer; + this->animIndex = 0; + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - GetNextFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + GetNextFrame(super); } break; case 2: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitializeAnimation(super, this->animIndex); } break; } @@ -92,9 +105,9 @@ void sub_0806C4DC(Entity* this) { ShowNPCDialogue(this, &dialogs[gSave.global_progress]); } -void Mama_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Mama_MakeInteractable(MamaEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Mama_Fusion(Entity* this) { diff --git a/src/npc/marcy.c b/src/npc/marcy.c index 57f979dd..d30ef441 100644 --- a/src/npc/marcy.c +++ b/src/npc/marcy.c @@ -1,8 +1,15 @@ +/** + * @file marcy.c + * @ingroup NPCs + * + * @brief Marcy NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "functions.h" #include "flags.h" -#include "message.h" +#include "functions.h" #include "item.h" +#include "message.h" void Marcy(Entity* this) { if (this->action == 0) { @@ -10,7 +17,7 @@ void Marcy(Entity* this) { SetDefaultPriority(this, PRIO_MESSAGE); sub_0807DD64(this); } - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } void sub_08062D18(Entity* this, ScriptExecutionContext* context) { diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index e5e5cad3..b817987d 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -1,38 +1,51 @@ -#include "global.h" +/** + * @file mayorHagen.c + * @ingroup NPCs + * + * @brief Mayor Hagen NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "flags.h" -#include "npc.h" #include "item.h" +#include "npc.h" +#include "player.h" -void MayorHagen(Entity* this) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} MayorHagenEntity; + +void MayorHagen(MayorHagenEntity* this) { u32 v; - switch (this->action) { + switch (super->action) { case 0: - this->action = 1; - this->field_0x68.HALF.HI = 0; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + super->action = 1; + this->animIndex = 0; + this->fusionOffer = GetFusionToOffer(super); + SetDefaultPriority(super, PRIO_MESSAGE); + InitScriptForNPC(super); break; case 1: - v = this->interactType; - if (v == 2) { - this->action = v; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitAnimationForceUpdate(this, 4 + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + v = super->interactType; + if (v == INTERACTION_FUSE) { + super->action = v; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + 4 + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); break; } - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - UpdateAnimationSingleFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + UpdateAnimationSingleFrame(super); break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.HI); + if (UpdateFuseInteraction(super)) { + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); } } } diff --git a/src/npc/melari.c b/src/npc/melari.c index 59760a78..22f303f4 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -1,5 +1,17 @@ -#include "npc.h" +/** + * @file melari.c + * @ingroup NPCs + * + * @brief Melari NPC + */ +#define NENT_DEPRECATED #include "item.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} MelariEntity; void sub_08068780(Entity*); void sub_08068708(Entity*); @@ -47,8 +59,8 @@ void sub_08068730(Entity* this) { this->subtimer--; } } - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; MessageFromTarget(this->timer + TEXT_INDEX(TEXT_MINISH2, 0x0)); } } @@ -67,13 +79,13 @@ void sub_08068780(Entity* this) { this->spriteSettings.draw = TRUE; this->animationState = this->type; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); break; case 1: - if (this->interactType == 2) { + if (this->interactType == INTERACTION_FUSE) { this->action = 2; - this->interactType = 0; - sub_0806F118(this); + this->interactType = INTERACTION_NONE; + InitializeNPCFusion(this); } else { ExecuteScriptForEntity(this, NULL); HandleEntity0x82Actions(this); @@ -100,9 +112,9 @@ void sub_08068780(Entity* this) { } } -void Melari_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Melari_MakeInteractable(MelariEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Melari_Head(Entity* this) { @@ -136,7 +148,7 @@ void sub_08068910(Entity* this) { iVar1 = 0x10; } else { } - iVar1 = sub_0806F5A4(iVar1); + iVar1 = GetAnimationStateForDirection4(iVar1); InitializeAnimation(this, (this->animIndex & -0x4) + iVar1); } } diff --git a/src/npc/milkCart.c b/src/npc/milkCart.c index 5736b5b6..37b7f54d 100644 --- a/src/npc/milkCart.c +++ b/src/npc/milkCart.c @@ -1,3 +1,10 @@ +/** + * @file milkCart.c + * @ingroup NPCs + * + * @brief Milk Cart NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c index 921452de..2306f107 100644 --- a/src/npc/minishEzlo.c +++ b/src/npc/minishEzlo.c @@ -1,16 +1,22 @@ +/** + * @file minishEzlo.c + * @ingroup NPCs + * + * @brief Minish Ezlo NPC + */ #define NENT_DEPRECATED #include "entity.h" -#include "sound.h" -#include "script.h" #include "npc.h" +#include "script.h" +#include "sound.h" typedef struct { - Entity base; - u32 filler; - union SplitWord field_0x6c; - u32 field_0x70; - u8 filler2[0xC]; - s16 field_0x80; + /*0x00*/ Entity base; + /*0x68*/ u32 filler; + /*0x6c*/ union SplitWord field_0x6c; + /*0x70*/ u32 field_0x70; + /*0x74*/ u8 filler2[0xC]; + /*0x80*/ s16 field_0x80; } MinishEzloEntity; extern void sub_0806FF10(Entity* this, u32 param_2, u32 param_3); @@ -28,7 +34,7 @@ void MinishEzlo(Entity* this) { this->action++; this->animationState = this->timer * 2; SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); HandleEntity0x82Actions(this); diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index fe5806c1..9c0454a5 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -1,25 +1,37 @@ +/** + * @file ministerPotho.c + * @ingroup NPCs + * + * @brief Minister Potho NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" +#include "item.h" #include "message.h" #include "npc.h" -#include "item.h" -void sub_08066864(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} MinisterPothoEntity; + +void sub_08066864(MinisterPothoEntity*); void sub_080667E4(Entity*); void sub_08066808(Entity*); void sub_0806685C(Entity*); -void MinisterPotho(Entity* this) { +void MinisterPotho(MinisterPothoEntity* this) { static void (*const actionFuncs[])(Entity*) = { sub_080667E4, sub_08066808, sub_0806685C, }; - if ((this->flags & ENT_SCRIPTED) != 0) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_08066864(this); } else { - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](super); + sub_0806ED78(super); } } @@ -45,9 +57,9 @@ void sub_08066808(Entity* this) { if (sub_0806F078(this, tmp) == 0) { UpdateAnimationSingleFrame(this); } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; - this->interactType = 0; + this->interactType = INTERACTION_NONE; } } @@ -55,27 +67,28 @@ void sub_0806685C(Entity* this) { this->action = 1; } -void sub_08066864(Entity* this) { - switch (this->action) { +void sub_08066864(MinisterPothoEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = 1; + this->fusionOffer = GetFusionToOffer(super); + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } break; } diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c index 7aa448f1..2aa0e0b3 100644 --- a/src/npc/moblinLady.c +++ b/src/npc/moblinLady.c @@ -1,11 +1,18 @@ +/** + * @file moblinLady.c + * @ingroup NPCs + * + * @brief Moblin Lady NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" void MoblinLady(Entity* this) { if (this->action == 0) { this->action++; - sub_0807DD50(this); + InitScriptForNPC(this); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } } diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index bfa0e17c..15aa1d06 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -1,10 +1,23 @@ +/** + * @file mountainMinish.c + * @ingroup NPCs + * + * @brief Mountain Minish NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" -#include "functions.h" -#include "message.h" #include "flags.h" -#include "npc.h" +#include "functions.h" #include "item.h" +#include "message.h" +#include "npc.h" +#include "script.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} MountainMinishEntity; const u8 gUnk_08111284[][0x20] = { { 0x8, 0x1, 0x9, 0x1, 0xa, 0x1, 0xb, 0x83, 0xc, 0x83, 0xd, 0x83, 0xe, 0x83, 0xf, 0x80, @@ -34,21 +47,21 @@ const SpriteLoadData gUnk_08111358[] = { { 0x0, 0x0, 0x0 }, }; -void sub_08067EF0(Entity*); +void sub_08067EF0(MountainMinishEntity*); void sub_08068190(Entity*); void sub_08067E60(Entity*); void sub_08067E88(Entity*); void sub_08067EE8(Entity*); -void MountainMinish(Entity* this) { +void MountainMinish(MountainMinishEntity* this) { static void (*const MountainMinish_Actions[])(Entity*) = { sub_08067E60, sub_08067E88, sub_08067EE8, }; - if ((this->flags & ENT_SCRIPTED) == 0) { - MountainMinish_Actions[this->action](this); - sub_0806ED78(this); + if ((super->flags & ENT_SCRIPTED) == 0) { + MountainMinish_Actions[super->action](super); + sub_0806ED78(super); } else { sub_08067EF0(this); } @@ -79,8 +92,8 @@ void sub_08067E88(Entity* this) { if (sub_0806F078(this, tmp) == 0) { GetNextFrame(this); } - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; this->action = 2; MessageFromTarget(this->timer + TEXT_INDEX(TEXT_MINISH2, 0x0)); } @@ -90,7 +103,7 @@ void sub_08067EE8(Entity* this) { this->action = 1; } -void sub_08067EF0(Entity* this) { +void sub_08067EF0(MountainMinishEntity* this) { static const u16 gUnk_08111374[] = { SFX_HAMMER1, SFX_HAMMER2, @@ -104,84 +117,85 @@ void sub_08067EF0(Entity* this) { }; Entity* fxEnt; - switch (this->action) { + switch (super->action) { case 0: - if (!LoadExtraSpriteData(this, gUnk_08111358)) { + if (!LoadExtraSpriteData(super, gUnk_08111358)) { return; } - this->action = 1; - this->spriteSettings.draw = 1; - this->animationState = this->type; - this->field_0x68.HALF.HI = 0; - SetDefaultPriority(this, 2); - sub_0807DD50(this); - InitializeAnimation(this, gUnk_08111304[this->type2]); + super->action = 1; + super->spriteSettings.draw = 1; + super->animationState = super->type; + this->animIndex = 0; + SetDefaultPriority(super, 2); + InitScriptForNPC(super); + InitializeAnimation(super, gUnk_08111304[super->type2]); break; case 1: - if (this->interactType == 2) { - this->action = 3; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 3; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, 0); - HandleEntity0x82Actions(this); - if ((this->type2 == 3) && (this->interactType != 0)) { - this->action = 2; - this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_08068190(this); + ExecuteScriptForEntity(super, 0); + HandleEntity0x82Actions(super); + if ((super->type2 == 3) && (super->interactType != INTERACTION_NONE)) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + sub_08068190(super); } } break; case 2: if ((gMessage.doTextBox & 0x7f) != 0) break; - this->action = 1; - InitializeAnimation(this, (this->animationState >> 1) + 4); + super->action = 1; + InitializeAnimation(super, (super->animationState >> 1) + 4); break; case 3: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitializeAnimation(super, this->animIndex); } } - if (this->frameDuration != 0xff) { - GetNextFrame(this); + if (super->frameDuration != 0xff) { + GetNextFrame(super); } - if ((this->frameSpriteSettings & 1) != 0) { - this->frameSpriteSettings &= 0xfe; - if (CheckOnScreen(this) == 0) { + if ((super->frameSpriteSettings & 1) != 0) { + super->frameSpriteSettings &= 0xfe; + if (CheckOnScreen(super) == 0) { SoundReq(gUnk_0811137A[((s32)Random()) % 3]); } else { EnqueueSFX(gUnk_08111374[((s32)Random()) % 3]); } } - if ((this->frameSpriteSettings & 2) != 0) { - this->frameSpriteSettings &= ~2; - fxEnt = CreateFx(this, FX_ROCK, 0); + if ((super->frameSpriteSettings & 2) != 0) { + super->frameSpriteSettings &= ~2; + fxEnt = CreateFx(super, FX_ROCK, 0); if (fxEnt != NULL) { - PositionRelative(this, fxEnt, 0, Q_16_16(-24)); + PositionRelative(super, fxEnt, 0, Q_16_16(-24)); } } - if ((this->frameSpriteSettings & 4) != 0) { - this->frameSpriteSettings &= 0xfb; - fxEnt = CreateFx(this, FX_STARS2, 0x20); + if ((super->frameSpriteSettings & 4) != 0) { + super->frameSpriteSettings &= 0xfb; + fxEnt = CreateFx(super, FX_STARS2, 0x20); if (fxEnt != NULL) { - PositionRelative(this, fxEnt, Q_16_16(-20), Q_16_16(-10)); + PositionRelative(super, fxEnt, Q_16_16(-20), Q_16_16(-10)); } } - if ((this->frameSpriteSettings & 8) != 0) { - this->frameSpriteSettings &= 0xf7; - this->frameDuration += Random() & 0x1f; + if ((super->frameSpriteSettings & 8) != 0) { + super->frameSpriteSettings &= 0xf7; + super->frameDuration += Random() & 0x1f; } } -void MountainMinish_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void MountainMinish_MakeInteractable(MountainMinishEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void sub_0806811C(Entity* this) { @@ -205,7 +219,7 @@ void sub_0806811C(Entity* this) { bVar1 = ptr[0]; bVar2 = ptr[1]; if ((bVar2 & 0x80) != 0) { - this->animationState = sub_0806F5B0(iVar4); + this->animationState = GetAnimationStateForDirection8(iVar4); } this->frame = bVar1 | 0x40; this->frameIndex = bVar2 & 0x7f; @@ -224,7 +238,7 @@ void sub_08068190(Entity* this) { } uVar2 = 0; - if (CheckLocalFlag(0x7e)) { + if (CheckLocalFlag(OYAKATA_DEMO)) { uVar2 = 1; } if (GetInventoryValue(ITEM_FIRE_ELEMENT) != 0) { diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index a93b7258..afe2d86f 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -1,10 +1,24 @@ -#include "global.h" + +/** + * @file mutoh.c + * @ingroup NPCs + * + * @brief Mutoh NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "flags.h" +#include "item.h" #include "message.h" #include "npc.h" -#include "item.h" +#include "player.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unused[27]; + /*0x84*/ ScriptExecutionContext* context; +} MutohEntity; static const SpriteLoadData gUnk_08110C00[] = { { 0x51, 0x3e, 0x4 }, @@ -12,33 +26,34 @@ static const SpriteLoadData gUnk_08110C00[] = { { 0, 0, 0 }, }; -void Mutoh(Entity* this) { - if (*(u32*)&this->cutsceneBeh == 0) { +void Mutoh(MutohEntity* this) { + if (this->context == NULL) { DeleteThisEntity(); } - switch (this->action) { + switch (super->action) { case 0: - if (LoadExtraSpriteData(this, gUnk_08110C00)) { - this->action = 1; - this->spriteSettings.draw = TRUE; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + if (LoadExtraSpriteData(super, gUnk_08110C00)) { + super->action = 1; + super->spriteSettings.draw = TRUE; + SetDefaultPriority(super, PRIO_MESSAGE); + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } } } @@ -82,9 +97,9 @@ void sub_080670E4(Entity* this) { ShowNPCDialogue(this, &dialogs[gSave.global_progress]); } -void Mutoh_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Mutoh_MakeInteractable(MutohEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Mutoh_Fusion(Entity* this) { diff --git a/src/npc/nayru.c b/src/npc/nayru.c index b9ea0df4..4b8bd979 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -1,30 +1,42 @@ -#include "global.h" +/** + * @file nayru.c + * @ingroup NPCs + * + * @brief Nayru NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "npc.h" #include "kinstone.h" +#include "npc.h" -void Nayru(Entity* this) { - switch (this->action) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 animIndex; +} NayruEntity; + +void Nayru(NayruEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = 1; + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - sub_0806F118(this); - this->field_0x68.HALF.LO = this->animIndex; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.LO); + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); } break; } @@ -32,7 +44,7 @@ void Nayru(Entity* this) { void Nayru_MakeInteractable(Entity* this) { u32 kinstoneId = GetFusionToOffer(this); - if ((gSave.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { + if ((gSave.kinstones.fuserProgress[GetFuserId(this)] != 0) && (gSave.global_progress < 7)) { kinstoneId = KINSTONE_NONE; } AddInteractableWhenBigFuser(this, kinstoneId); diff --git a/src/npc/npc23.c b/src/npc/npc23.c index a07b14b1..e3dab558 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -1,124 +1,140 @@ +/** + * @file npc23.c + * @ingroup NPCs + * + * @brief NPC 23 + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" -#include "structures.h" #include "functions.h" #include "message.h" #include "npc.h" +#include "player.h" +#include "structures.h" -bool32 sub_0806650C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[22]; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} NPC23Entity; -void sub_08066490(Entity*, Entity*); +bool32 sub_0806650C(NPC23Entity*); + +void sub_08066490(NPC23Entity*, Entity*); void sub_08066570(Entity* this); -void sub_080662F8(Entity* this); -void sub_08066358(Entity* this); -void nullsub_110(Entity* this); -void sub_080663D4(Entity* this); -void sub_0806643C(Entity* this); -void sub_08066474(Entity* this); +void sub_080662F8(NPC23Entity* this); +void sub_08066358(NPC23Entity* this); +void nullsub_110(NPC23Entity* this); +void sub_080663D4(NPC23Entity* this); +void sub_0806643C(NPC23Entity* this); +void sub_08066474(NPC23Entity* this); -void NPC23(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void NPC23(NPC23Entity* this) { + static void (*const actionFuncs[])(NPC23Entity*) = { sub_080662F8, sub_08066358, nullsub_110, sub_080663D4, sub_0806643C, sub_08066474, }; - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](this); + sub_0806ED78(super); } -void sub_080662F8(Entity* this) { - this->action = 1; - this->subAction = 0; - this->spriteSettings.draw = 1; - this->animationState = this->type << 1; - InitializeAnimation(this, this->type); - this->field_0x7c.HALF.HI = this->x.HALF.HI; - this->field_0x80.HWORD = this->y.HALF.HI; - this->field_0x86.HWORD = 0; - this->field_0x82.HWORD = this->timer; - this->parent = &gPlayerEntity; - this->cutsceneBeh.HWORD = 0; - sub_08066490(this, this->parent); - AddInteractableWhenBigObject(this); +void sub_080662F8(NPC23Entity* this) { + super->action = 1; + super->subAction = 0; + super->spriteSettings.draw = 1; + super->animationState = super->type << 1; + InitializeAnimation(super, super->type); + this->unk_7e = super->x.HALF.HI; + this->unk_80 = super->y.HALF.HI; + this->unk_86 = 0; + this->unk_82 = super->timer; + super->parent = &gPlayerEntity; + this->unk_84 = 0; + sub_08066490(this, super->parent); + AddInteractableWhenBigObject(super); } -void sub_08066358(Entity* this) { - if (this->interactType != 0) { - this->interactType = 0; +void sub_08066358(NPC23Entity* this) { + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; MessageFromTarget(0); - if ((this->type2 & 0x10) != 0) { - this->action = 3; - this->subAction = 0; - if ((this->field_0x7c.HALF_U.HI - this->x.HALF.HI) > 8) { - this->direction = 8; + if ((super->type2 & 0x10) != 0) { + super->action = 3; + super->subAction = 0; + if ((this->unk_7e - super->x.HALF.HI) > 8) { + super->direction = 8; } else { - this->direction = 0x18; + super->direction = 0x18; } - this->speed = 0x80; - this->cutsceneBeh.HWORD = 1; + super->speed = 0x80; + this->unk_84 = 1; gPauseMenuOptions.disabled = 1; - RemoveInteractableObject(this); + RemoveInteractableObject(super); } } else { - sub_08066490(this, this->parent); + sub_08066490(this, super->parent); } - GetNextFrame(this); - sub_08066570(this); + GetNextFrame(super); + sub_08066570(super); } -void nullsub_110(Entity* this) { +void nullsub_110(NPC23Entity* this) { } -void sub_080663D4(Entity* this) { - if (this->x.HALF.HI == this->field_0x7c.HALF_U.HI - 8) { +void sub_080663D4(NPC23Entity* this) { + if (super->x.HALF.HI == this->unk_7e - 8) { if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { - this->action = 4; - this->direction = 0; - this->speed = 0; - this->cutsceneBeh.HWORD = 0; - InitializeAnimation(this, 2); + super->action = 4; + super->direction = 0; + super->speed = 0; + this->unk_84 = 0; + InitializeAnimation(super, 2); } } else { - if (this->subAction == 0) { - InitializeAnimation(this, (this->direction >> 3) + 4); - this->subAction = this->subAction + 1; + if (super->subAction == 0) { + InitializeAnimation(super, (super->direction >> 3) + 4); + super->subAction = super->subAction + 1; } - ProcessMovement0(this); + ProcessMovement0(super); } sub_08078B48(); - GetNextFrame(this); + GetNextFrame(super); } -void sub_0806643C(Entity* this) { - bool32 tmp = sub_0806650C(this); - if (tmp == FALSE) { - this->action = 5; +void sub_0806643C(NPC23Entity* this) { + if (!sub_0806650C(this)) { + super->action = 5; gRoomControls.camera_target = NULL; sub_08078AC0(0x40, 0, 0); gPlayerEntity.animationState = 0; gPlayerEntity.direction = 0; } - GetNextFrame(this); + GetNextFrame(super); } -void sub_08066474(Entity* this) { +void sub_08066474(NPC23Entity* this) { if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { gPauseMenuOptions.disabled = 0; } } -NONMATCH("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* this, Entity* entity)) { +void sub_08066490(NPC23Entity* this, Entity* entity) { u32 uVar1; u32 uVar2; u32 uVar3; u32 uVar4; - if ((this->type2 & 0x10) != 0) { - this->field_0x86.HWORD = this->x.HALF.HI; - uVar2 = this->field_0x7c.HALF_U.HI; - uVar3 = uVar2 + this->field_0x82.HWORD; - uVar4 = uVar2 - this->field_0x82.HWORD; + if ((super->type2 & 0x10) != 0) { + this->unk_86 = super->x.HALF.HI; + uVar2 = this->unk_7e; + uVar3 = uVar2 + this->unk_82; + uVar4 = uVar2 - this->unk_82; if (((entity->x.HALF.HI < (int)uVar3) && (entity->x.HALF.HI > (int)uVar4))) { - uVar2 = entity->x.HALF.HI; + uVar2 += (entity->x.HALF.HI - uVar2); } else { if (entity->x.HALF.HI >= (int)uVar3) { uVar2 = uVar3; @@ -127,35 +143,34 @@ NONMATCH("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* th } } - if (this->field_0x86.HWORD == uVar2) { - if (this->cutsceneBeh.HWORD == 1) { - this->cutsceneBeh.HWORD = 0; - InitializeAnimation(this, 2); + if (this->unk_86 == uVar2) { + if (this->unk_84 == 1) { + this->unk_84 = 0; + InitializeAnimation(super, 2); } } else { - this->x.HALF.HI = (short)uVar2; - if (this->cutsceneBeh.HWORD == 0) { - this->cutsceneBeh.HWORD = 1; - InitializeAnimation(this, 6); + super->x.HALF.HI = (short)uVar2; + if (this->unk_84 == 0) { + this->unk_84 = 1; + InitializeAnimation(super, 6); } } } } -END_NONMATCH -bool32 sub_0806650C(Entity* this) { +bool32 sub_0806650C(NPC23Entity* this) { u32 dir = 0; s32 px = gPlayerEntity.x.HALF_U.HI; s32 px2 = px; s32 py = gPlayerEntity.y.HALF_U.HI; - if (py < this->field_0x80.HWORD + 16) { + if (py < this->unk_80 + 16) { dir = 4; } else { - if (px < this->field_0x7c.HALF_U.HI + 2) { + if (px < this->unk_7e + 2) { dir = 2; } - if (px2 > this->field_0x7c.HALF_U.HI + 6) { + if (px2 > this->unk_7e + 6) { dir = 6; } if (dir == 0) { @@ -190,12 +205,12 @@ void sub_08066570(Entity* this) { direction = GetFacingDirection(this, &gPlayerEntity); cond = TRUE; - dir2 = (direction & 0x18); - dir1 = (this->direction & 0x18); - tmp = 0x18; + dir2 = (direction & DirectionWest); + dir1 = (this->direction & DirectionWest); + tmp = DirectionWest; if (dir1 == dir2) { - dir1 = (direction + 5) & 7; - dir2 = (this->direction + 5) & 7; + dir1 = (direction + 5) & (0x3 | DirectionNorthEast); + dir2 = (this->direction + 5) & (0x3 | DirectionNorthEast); if (dir2 < 3 && dir1 < 3) { cond = FALSE; } diff --git a/src/npc/npc26.c b/src/npc/npc26.c index fddbf460..6d5a3221 100644 --- a/src/npc/npc26.c +++ b/src/npc/npc26.c @@ -1,4 +1,10 @@ -#include "global.h" +/** + * @file npc26.c + * @ingroup NPCs + * + * @brief NPC 26 + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" @@ -40,9 +46,9 @@ static void sub_080669DC(Entity* this) { if (sVar2 == 0) { UpdateAnimationSingleFrame(this); } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; - this->interactType = 0; + this->interactType = INTERACTION_NONE; } } @@ -53,11 +59,11 @@ static void sub_08066A30(Entity* this) { static void sub_08066A38(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; - sub_0807DD50(this); + InitScriptForNPC(this); } static void sub_08066A50(Entity* this) { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } static void (*const gUnk_081106D4[])(Entity*) = { sub_080669B8, sub_080669DC, sub_08066A30 }; diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index a111f45e..766c9810 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -1,3 +1,10 @@ +/** + * @file npc4E.c + * @ingroup NPCs + * + * @brief NPC 4E + */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -12,6 +19,12 @@ #include "sound.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69; +} NPC4EEntity; + typedef struct { Rect customHitbox; u8 interactDirections; @@ -38,9 +51,9 @@ void NPC4E(Entity* this) { this->action = 1; this->spriteSettings.draw = 4; this->hitbox = (Hitbox*)&gHitbox_2; - sub_0807DD50(this); + InitScriptForNPC(this); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } } @@ -132,17 +145,19 @@ void NPC4E_IsEveryPinwheelActivated(Entity* this, ScriptExecutionContext* contex } void sub_0806DB84(Entity* this, ScriptExecutionContext* context) { - Entity* ent; + GenericEntity* ent; this->hitbox = (Hitbox*)&gUnk_08114154; - ent = CreateObject(MINISH_VILLAGE_OBJECT, 4, 0); + ent = (GenericEntity*)CreateObject(MINISH_VILLAGE_OBJECT, 4, 0); if (ent != NULL) { - PositionRelative(this, ent, Q_16_16(-8.0), 0); - *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_MinishVillageObjectLeftStoneOpening); + PositionRelative(this, &ent->base, Q_16_16(-8.0), 0); + *(ScriptExecutionContext**)&ent->cutsceneBeh = + StartCutscene(&ent->base, &script_MinishVillageObjectLeftStoneOpening); } - ent = CreateObject(MINISH_VILLAGE_OBJECT, 5, 0); + ent = (GenericEntity*)CreateObject(MINISH_VILLAGE_OBJECT, 5, 0); if (ent != NULL) { - PositionRelative(this, ent, Q_16_16(8.0), 0); - *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_MinishVillageObjectRightStoneOpening); + PositionRelative(this, &ent->base, Q_16_16(8.0), 0); + *(ScriptExecutionContext**)&ent->cutsceneBeh = + StartCutscene(&ent->base, &script_MinishVillageObjectRightStoneOpening); } } @@ -171,14 +186,14 @@ Item NPC4E_GetItemWithSwordUpgraded(Item itemId) { return itemId; } -void NPC4E_SaveEquippedItems(Entity* this) { - this->field_0x68.HALF.LO = gSave.stats.itemButtons[SLOT_A]; - this->field_0x68.HALF.HI = gSave.stats.itemButtons[SLOT_B]; +void NPC4E_SaveEquippedItems(NPC4EEntity* this) { + this->unk_68 = gSave.stats.itemButtons[SLOT_A]; + this->unk_69 = gSave.stats.itemButtons[SLOT_B]; } -void NPC4E_RestoreEquippedItems(Entity* this) { - ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.LO), EQUIP_SLOT_A); - ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.HI), EQUIP_SLOT_B); +void NPC4E_RestoreEquippedItems(NPC4EEntity* this) { + ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->unk_68), EQUIP_SLOT_A); + ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->unk_69), EQUIP_SLOT_B); } void sub_0806DC7C(void) { diff --git a/src/npc/npc4F.c b/src/npc/npc4F.c index 69cee66d..baaf9e4e 100644 --- a/src/npc/npc4F.c +++ b/src/npc/npc4F.c @@ -1,3 +1,10 @@ +/** + * @file npc4F.c + * @ingroup NPCs + * + * @brief NPC 4F + */ +#define NENT_DEPRECATED #include "npc.h" void NPC4F(Entity* this) { diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 032b7ad1..0f9535d0 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -1,3 +1,10 @@ +/** + * @file npc5.c + * @ingroup NPCs + * + * @brief NPC 5 + */ +#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" @@ -5,6 +12,18 @@ #include "npc.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16* unk_68; + /*0x6c*/ u8 unk_6c; + /*0x6d*/ u8 unused1; + /*0x6e*/ u16 unk_6e; + /*0x70*/ u8 unused2[4]; + /*0x74*/ u16 unk_74; + /*0x76*/ u8 unused3[2]; + /*0x78*/ Entity* unk_78; +} NPC5Entity; + typedef struct { u8 unk_0; // u8 u8 unk_0b; // u8 @@ -18,34 +37,34 @@ typedef struct { u16 unk_8; // u16 } UnkHeap; -void sub_08060E70(Entity*, u32); +void sub_08060E70(NPC5Entity*, u32); -u32 sub_08061230(Entity*); +u32 sub_08061230(NPC5Entity*); u32 sub_08060F80(Entity*); -void sub_08060EDC(Entity*); -void sub_08061090(Entity*, u32, u32); +void sub_08060EDC(NPC5Entity*); +void sub_08061090(NPC5Entity*, u32, u32); bool32 sub_08060FD0(Entity*, u32, u32); -void sub_08061464(Entity*, u32, u32); -void sub_08061120(Entity*, u32, u32, u32); -bool32 sub_08061170(Entity*); +void sub_08061464(NPC5Entity*, u32, u32); +void sub_08061120(NPC5Entity*, u32, u32, u32); +bool32 sub_08061170(NPC5Entity*); -void sub_08061358(Entity*); +void sub_08061358(NPC5Entity*); void sub_08060E94(Entity*); -void sub_08060A00(Entity*); -void sub_08061AA0(Entity*); -void sub_08061AA8(Entity*); -void sub_08061B58(Entity*); -void sub_08060AE0(Entity*); -void sub_08060B5C(Entity*); -void sub_08060BA0(Entity*); -void sub_08060D78(Entity*); -void sub_08060DD0(Entity*); -void sub_08060DF4(Entity*); -void sub_08060DFC(Entity*); -void sub_08060E34(Entity*); -void sub_08061ACC(Entity*); -void sub_08061B18(Entity*); +void sub_08060A00(NPC5Entity*); +void sub_08061AA0(NPC5Entity*); +void sub_08061AA8(NPC5Entity*); +void sub_08061B58(NPC5Entity*); +void sub_08060AE0(NPC5Entity*); +void sub_08060B5C(NPC5Entity*); +void sub_08060BA0(NPC5Entity*); +void sub_08060D78(NPC5Entity*); +void sub_08060DD0(NPC5Entity*); +void sub_08060DF4(NPC5Entity*); +void sub_08060DFC(NPC5Entity*); +void sub_08060E34(NPC5Entity*); +void sub_08061ACC(NPC5Entity*); +void sub_08061B18(NPC5Entity*); u32 PointInsideRadius(s32, s32, s32); @@ -53,14 +72,14 @@ u32 sub_080611D4(Entity*); extern u32 sub_08079FD4(Entity*, u32); extern void sub_08016AD2(Entity*); -bool32 sub_08061630(Entity*, s32, s32, s32); -bool32 sub_08061720(Entity*, s32, s32, s32); -bool32 sub_080616A8(Entity*, s32, s32, s32); -bool32 sub_08061798(Entity*, s32, s32, s32); -bool32 sub_08061888(Entity*, s32, s32, s32); -bool32 sub_08061978(Entity*, s32, s32, s32); -bool32 sub_08061810(Entity*, s32, s32, s32); -bool32 sub_08061900(Entity*, s32, s32, s32); +bool32 sub_08061630(NPC5Entity*, s32, s32, s32); +bool32 sub_08061720(NPC5Entity*, s32, s32, s32); +bool32 sub_080616A8(NPC5Entity*, s32, s32, s32); +bool32 sub_08061798(NPC5Entity*, s32, s32, s32); +bool32 sub_08061888(NPC5Entity*, s32, s32, s32); +bool32 sub_08061978(NPC5Entity*, s32, s32, s32); +bool32 sub_08061810(NPC5Entity*, s32, s32, s32); +bool32 sub_08061900(NPC5Entity*, s32, s32, s32); bool32 sub_08061A74(u8*, s32, s32, s32); @@ -70,7 +89,7 @@ bool32 sub_080619F0(u8*, s32, s32, s32); bool32 sub_08061A48(u8*, s32, s32, s32); -void sub_08061AFC(Entity*); +void sub_08061AFC(NPC5Entity*); extern u16* gUnk_0810B660[8]; @@ -87,119 +106,120 @@ void CreateZeldaFollower(void) { } // UNUSED zelda follower, probably because it was too resource heavy -void NPC5(Entity* this) { - static void (*const gUnk_0810AC1C[])(Entity*) = { +void NPC5(NPC5Entity* this) { + static void (*const gUnk_0810AC1C[])(NPC5Entity*) = { sub_08060A00, sub_08061AA0, sub_08061AA8, sub_08061B58, }; - gUnk_0810AC1C[this->type](this); + gUnk_0810AC1C[super->type](this); } -void sub_08060A00(Entity* this) { - static void (*const Npc5_Actions[])(Entity*) = { +void sub_08060A00(NPC5Entity* this) { + static void (*const Npc5_Actions[])(NPC5Entity*) = { sub_08060AE0, sub_08060B5C, sub_08060BA0, sub_08060D78, sub_08060DD0, sub_08060DF4, sub_08060DFC, sub_08060E34, }; u32 tmp; if ((gPlayerState.jump_status & 0x80) != 0) { - if (this->action != 0) { - if (((((UnkHeap*)this->myHeap)->unk_0) & 4) == 0) { - ((UnkHeap*)this->myHeap)->unk_0 |= 4; - ((UnkHeap*)this->myHeap)->unk_5 = (gPlayerEntity.x.HALF.HI & 0xfff0) + 8; - ((UnkHeap*)this->myHeap)->unk_6 = (gPlayerEntity.y.HALF.HI & 0xfff0) + 8; + if (super->action != 0) { + if (((((UnkHeap*)super->myHeap)->unk_0) & 4) == 0) { + ((UnkHeap*)super->myHeap)->unk_0 |= 4; + ((UnkHeap*)super->myHeap)->unk_5 = (gPlayerEntity.x.HALF.HI & 0xfff0) + 8; + ((UnkHeap*)super->myHeap)->unk_6 = (gPlayerEntity.y.HALF.HI & 0xfff0) + 8; } } } - if ((this->action == 0) || (this->spriteSettings.draw != 0)) { - Npc5_Actions[this->action](this); + if ((super->action == 0) || (super->spriteSettings.draw != 0)) { + Npc5_Actions[super->action](this); } - if (this->action != 0) { - ((UnkHeap*)this->myHeap)->unk_1 = gPlayerEntity.x.HALF.HI; - ((UnkHeap*)this->myHeap)->unk_2 = gPlayerEntity.y.HALF.HI; + if (super->action != 0) { + ((UnkHeap*)super->myHeap)->unk_1 = gPlayerEntity.x.HALF.HI; + ((UnkHeap*)super->myHeap)->unk_2 = gPlayerEntity.y.HALF.HI; } - if (this->field_0x74.HWORD != gRoomControls.room) { - this->field_0x74.HWORD = gRoomControls.room; - CopyPosition(&gPlayerEntity, this); - this->action = 1; - this->spriteSettings.draw = 1; - this->speed = 0x120; + if (this->unk_74 != gRoomControls.room) { + this->unk_74 = gRoomControls.room; + CopyPosition(&gPlayerEntity, super); + super->action = 1; + super->spriteSettings.draw = 1; + super->speed = 0x120; tmp = gRoomControls.scroll_direction; - this->animationState = tmp * 2; - InitAnimationForceUpdate(this, tmp << 0x19 >> 0x19); // TODO some conversion between u8 and u32? - this->frameDuration = (Random() & 0x7f) + 0x80; - ((UnkHeap*)this->myHeap)->unk_0 &= 0xfb; + super->animationState = tmp * 2; + InitAnimationForceUpdate(super, tmp << 0x19 >> 0x19); // TODO some conversion between u8 and u32? + super->frameDuration = (Random() & 0x7f) + 0x80; + ((UnkHeap*)super->myHeap)->unk_0 &= 0xfb; } } -void sub_08060AE0(Entity* this) { +void sub_08060AE0(NPC5Entity* this) { UnkHeap* heapObj; Entity* otherNpc; heapObj = (UnkHeap*)zMalloc(0x14); // TODO UnkHeap struct should have size 0x14? if (heapObj != NULL) { - this->myHeap = (u32*)heapObj; + super->myHeap = (u32*)heapObj; heapObj->unk_0b = 0x20; - this->action = 1; - COLLISION_ON(this); - this->animationState &= 3; - this->collisionFlags = 7; - this->hurtType = 0x48; - this->hitType = 0x49; - this->flags2 = 3; - this->hitbox = (Hitbox*)&gHitbox_0; - this->followerFlag &= 0xfe; - this->field_0x6c.HALF.LO = 0xff; - sub_08060E70(this, this->animationState); + super->action = 1; + COLLISION_ON(super); + super->animationState &= 3; + super->collisionFlags = 7; + super->hurtType = 0x48; + super->hitType = 0x49; + super->flags2 = 3; + super->hitbox = (Hitbox*)&gHitbox_0; + super->followerFlag &= 0xfe; + this->unk_6c = 0xff; + sub_08060E70(this, super->animationState); otherNpc = CreateNPC(NPC_UNK_5, 2, 0); if (otherNpc != NULL) { - otherNpc->parent = this; - *(Entity**)&this->field_0x78 = otherNpc; + otherNpc->parent = super; + this->unk_78 = otherNpc; } } } -void sub_08060B5C(Entity* this) { +void sub_08060B5C(NPC5Entity* this) { if (sub_08061230(this) == 0) { - if ((sub_08060F80(this) == 0) && - (((GetFacingDirection(this, &gPlayerEntity) + (this->animationState * -4) + 4) & 0x1f)) < 9) { - this->action = 2; - this->subtimer = 0; + if ((sub_08060F80(super) == 0) && + (((GetFacingDirection(super, &gPlayerEntity) + (super->animationState * -4) + 4) & 0x1f)) < 9) { + super->action = 2; + super->subtimer = 0; return; } sub_08060EDC(this); } } -void sub_08060BA0(Entity* this) { +void sub_08060BA0(NPC5Entity* this) { Entity* r5; //! @bug: r5 is uninitialized if (sub_08061230(this) != 0) { return; } - if ((((UnkHeap*)this->myHeap)->unk_0 & 4) != 0) { - if ((((UnkHeap*)this->myHeap)->unk_0 & 8) != 0) { - this->speed = 0x1e0; - sub_08061120(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 0xc); + if ((((UnkHeap*)super->myHeap)->unk_0 & 4) != 0) { + if ((((UnkHeap*)super->myHeap)->unk_0 & 8) != 0) { + super->speed = 0x1e0; + sub_08061120(this, ((UnkHeap*)super->myHeap)->unk_7, ((UnkHeap*)super->myHeap)->unk_8, 0xc); sub_08061170(this); - if (EntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 4) != 0) { - ((UnkHeap*)this->myHeap)->unk_0 &= 0xf7; + if (EntityWithinDistance(super, ((UnkHeap*)super->myHeap)->unk_7, ((UnkHeap*)super->myHeap)->unk_8, 4) != + 0) { + ((UnkHeap*)super->myHeap)->unk_0 &= 0xf7; } } else { - if (sub_08060FD0(this, ((UnkHeap*)this->myHeap)->unk_5, ((UnkHeap*)this->myHeap)->unk_6) != 0) { - if (EntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_5, ((UnkHeap*)this->myHeap)->unk_6, 4) != - 0) { - ((UnkHeap*)this->myHeap)->unk_0 &= 0xfb; - this->action = 5; - this->direction = r5->direction; - this->speed = 0x160; + if (sub_08060FD0(super, ((UnkHeap*)super->myHeap)->unk_5, ((UnkHeap*)super->myHeap)->unk_6) != 0) { + if (EntityWithinDistance(super, ((UnkHeap*)super->myHeap)->unk_5, ((UnkHeap*)super->myHeap)->unk_6, + 4) != 0) { + ((UnkHeap*)super->myHeap)->unk_0 &= 0xfb; + super->action = 5; + super->direction = r5->direction; + super->speed = 0x160; sub_08060E70(this, 8); } else { - this->speed = 0x1e0; + super->speed = 0x1e0; sub_08061120(this, r5->x.HALF.HI, r5->y.HALF.HI, 0xc); sub_08061170(this); } @@ -209,104 +229,104 @@ void sub_08060BA0(Entity* this) { } } else { - if (sub_08060FD0(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI) != 0) { + if (sub_08060FD0(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI) != 0) { sub_08061090(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); sub_08061170(this); - ((UnkHeap*)this->myHeap)->unk_0 &= 0xf5; + ((UnkHeap*)super->myHeap)->unk_0 &= 0xf5; } else { - ((UnkHeap*)this->myHeap) = (UnkHeap*)this->myHeap; - if ((((UnkHeap*)this->myHeap)->unk_0 & 8) != 0) { - this->speed = 0x1e0; - sub_08061120(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 0xc); + ((UnkHeap*)super->myHeap) = (UnkHeap*)super->myHeap; + if ((((UnkHeap*)super->myHeap)->unk_0 & 8) != 0) { + super->speed = 0x1e0; + sub_08061120(this, ((UnkHeap*)super->myHeap)->unk_7, ((UnkHeap*)super->myHeap)->unk_8, 0xc); sub_08061170(this); - if (EntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 4) != - 0) { - ((UnkHeap*)this->myHeap)->unk_0 &= 0xf7; + if (EntityWithinDistance(super, ((UnkHeap*)super->myHeap)->unk_7, ((UnkHeap*)super->myHeap)->unk_8, + 4) != 0) { + ((UnkHeap*)super->myHeap)->unk_0 &= 0xf7; } } else { - if ((((UnkHeap*)this->myHeap)->unk_0 & 2) == 0) { - ((UnkHeap*)this->myHeap)->unk_0 |= 2; - ((UnkHeap*)this->myHeap)->unk_3 = ((UnkHeap*)this->myHeap)->unk_1; - ((UnkHeap*)this->myHeap)->unk_4 = ((UnkHeap*)this->myHeap)->unk_2; + if ((((UnkHeap*)super->myHeap)->unk_0 & 2) == 0) { + ((UnkHeap*)super->myHeap)->unk_0 |= 2; + ((UnkHeap*)super->myHeap)->unk_3 = ((UnkHeap*)super->myHeap)->unk_1; + ((UnkHeap*)super->myHeap)->unk_4 = ((UnkHeap*)super->myHeap)->unk_2; } - if (sub_08060FD0(this, ((UnkHeap*)this->myHeap)->unk_3, ((UnkHeap*)this->myHeap)->unk_4) != 0) { - this->speed = 0x1e0; - sub_08061120(this, ((UnkHeap*)this->myHeap)->unk_3, ((UnkHeap*)this->myHeap)->unk_4, 0xc); + if (sub_08060FD0(super, ((UnkHeap*)super->myHeap)->unk_3, ((UnkHeap*)super->myHeap)->unk_4) != 0) { + super->speed = 0x1e0; + sub_08061120(this, ((UnkHeap*)super->myHeap)->unk_3, ((UnkHeap*)super->myHeap)->unk_4, 0xc); sub_08061170(this); - if (EntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_3, ((UnkHeap*)this->myHeap)->unk_4, + if (EntityWithinDistance(super, ((UnkHeap*)super->myHeap)->unk_3, ((UnkHeap*)super->myHeap)->unk_4, 4) != 0) { - ((UnkHeap*)this->myHeap)->unk_0 &= 0xfd; + ((UnkHeap*)super->myHeap)->unk_0 &= 0xfd; } } else { - ((UnkHeap*)this->myHeap)->unk_0 &= 0xfd; + ((UnkHeap*)super->myHeap)->unk_0 &= 0xfd; sub_08061464(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); } } } } - if (sub_08060F80(this) != 0) { - this->action = 1; - ((UnkHeap*)this->myHeap)->unk_0 &= 0xfb; + if (sub_08060F80(super) != 0) { + super->action = 1; + ((UnkHeap*)super->myHeap)->unk_0 &= 0xfb; sub_08060E70(this, 0); } } -void sub_08060D78(Entity* this) { +void sub_08060D78(NPC5Entity* this) { sub_08061358(this); - if (sub_08060F80(this) != 0) { - if ((u32)this->animIndex - 0x20 < 0x10) { - if ((this->frame & 7) != 0) { - this->frameDuration = 1; - UpdateAnimationSingleFrame(this); + if (sub_08060F80(super) != 0) { + if ((u32)super->animIndex - 0x20 < 0x10) { + if ((super->frame & 7) != 0) { + super->frameDuration = 1; + UpdateAnimationSingleFrame(super); } - this->animationState = this->frame & 0x18; - this->field_0x6c.HALF.LO = 0xff; + super->animationState = super->frame & 0x18; + this->unk_6c = 0xff; } - this->action = 1; + super->action = 1; sub_08060E70(this, 0); } } -void sub_08060DD0(Entity* this) { - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 1; +void sub_08060DD0(NPC5Entity* this) { + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 1; sub_08060E70(this, 0); } } -void sub_08060DF4(Entity* this) { +void sub_08060DF4(NPC5Entity* this) { sub_08061170(this); } -void sub_08060DFC(Entity* this) { +void sub_08060DFC(NPC5Entity* this) { u32 uVar1; - LinearMoveUpdate(this); - sub_08060E94(this); - uVar1 = GravityUpdate(this, Q_8_8(32.0)); + LinearMoveUpdate(super); + sub_08060E94(super); + uVar1 = GravityUpdate(super, Q_8_8(32.0)); if (uVar1 == 0) { - this->action = 7; - this->collisionLayer = 1; - UpdateSpriteForCollisionLayer(this); + super->action = 7; + super->collisionLayer = 1; + UpdateSpriteForCollisionLayer(super); sub_08060E70(this, 0x1c); } } -void sub_08060E34(Entity* this) { - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 2; - this->animationState = DirectionToAnimationState(GetFacingDirection(this, &gPlayerEntity)) * 2; +void sub_08060E34(NPC5Entity* this) { + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 2; + super->animationState = DirectionToAnimationState(GetFacingDirection(super, &gPlayerEntity)) * 2; sub_08060E70(this, 8); } } -void sub_08060E70(Entity* this, u32 param) { - u32 tmp = param + this->animationState / 2; - if (tmp != this->animIndex) { - this->field_0x6c.HALF.LO = param; - InitAnimationForceUpdate(this, tmp); +void sub_08060E70(NPC5Entity* this, u32 param) { + u32 tmp = param + super->animationState / 2; + if (tmp != super->animIndex) { + this->unk_6c = param; + InitAnimationForceUpdate(super, tmp); } } @@ -319,27 +339,27 @@ void sub_08060E94(Entity* this) { } } -void sub_08060EDC(Entity* this) { +void sub_08060EDC(NPC5Entity* this) { s32 tmp; - if (((u32)this->animIndex - 0x20 < 0x10) && ((this->frame & ANIM_DONE) == 0)) { - UpdateAnimationSingleFrame(this); + if (((u32)super->animIndex - 0x20 < 0x10) && ((super->frame & ANIM_DONE) == 0)) { + UpdateAnimationSingleFrame(super); } else { - tmp = GetFacingDirection(this, &gPlayerEntity) + this->animationState * -4; + tmp = GetFacingDirection(super, &gPlayerEntity) + super->animationState * -4; if (((tmp + 3) & 0x1f) >= 7) { if ((tmp & 0x1f) < 0x10) { - InitAnimationForceUpdate(this, this->animationState + 0x20); - this->animationState = (this->animationState + 1) & 7; + InitAnimationForceUpdate(super, super->animationState + 0x20); + super->animationState = (super->animationState + 1) & 7; } else { - InitAnimationForceUpdate(this, this->animationState + 0x28); - this->animationState = (this->animationState - 1) & 7; + InitAnimationForceUpdate(super, super->animationState + 0x28); + super->animationState = (super->animationState - 1) & 7; } } else { - if ((this->animationState & 1) == 0) { - if (((this->frame & ANIM_DONE) != 0) && (0xf >= (u32)this->animIndex - 0x20)) { + if ((super->animationState & 1) == 0) { + if (((super->frame & ANIM_DONE) != 0) && (0xf >= (u32)super->animIndex - 0x20)) { sub_08060E70(this, 0); } else { - sub_08060E94(this); + sub_08060E94(super); } } } @@ -392,27 +412,27 @@ bool32 sub_08060FD0(Entity* this, u32 a, u32 b) { } } -void sub_08061090(Entity* this, u32 a, u32 b) { +void sub_08061090(NPC5Entity* this, u32 a, u32 b) { s32 xDist; s32 yDist; s32 sqrDist; u32 tmp; - xDist = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; - yDist = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; + xDist = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; + yDist = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; sqrDist = (xDist * xDist) + (yDist * yDist); if (sqrDist < 0x900) { - this->speed = 0x120; + super->speed = 0x120; } else { if (sqrDist < 0x1900) { - this->speed = ((sqrDist - 0x900) >> 4) + 0x120; + super->speed = ((sqrDist - 0x900) >> 4) + 0x120; } else { - this->speed = 0x220; + super->speed = 0x220; } } - if (this->speed == 0x120) { + if (super->speed == 0x120) { tmp = 4; - } else if (this->speed < 0x160) { + } else if (super->speed < 0x160) { tmp = 8; } else { tmp = 0xc; @@ -420,31 +440,31 @@ void sub_08061090(Entity* this, u32 a, u32 b) { sub_08061120(this, a, b, tmp); } -void sub_08061120(Entity* this, u32 param_a, u32 param_b, u32 param_c) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, param_a, param_b); - if ((param_c != this->field_0x6c.HALF.LO) || (10 < ((this->direction + this->animationState * -4 + 5) & 0x1f))) { - this->animationState = DirectionRoundUp(this->direction) >> 2; +void sub_08061120(NPC5Entity* this, u32 param_a, u32 param_b, u32 param_c) { + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, param_a, param_b); + if ((param_c != this->unk_6c) || (10 < ((super->direction + super->animationState * -4 + 5) & 0x1f))) { + super->animationState = DirectionRoundUp(super->direction) >> 2; sub_08060E70(this, param_c); } } -bool32 sub_08061170(Entity* this) { +bool32 sub_08061170(NPC5Entity* this) { u32 direction; u32 tmp; - UpdateAnimationSingleFrame(this); - if (ProcessMovement6(this) == 0) { - direction = sub_080611D4(this); + UpdateAnimationSingleFrame(super); + if (ProcessMovement6(super) == 0) { + direction = sub_080611D4(super); if (direction != 0xff) { - this->action = 6; - tmp = (sub_08079FD4(this, 1)); + super->action = 6; + tmp = (sub_08079FD4(super, 1)); tmp <<= 4; tmp -= 4; tmp = tmp << 0xc; - this->zVelocity = tmp; - this->speed = 0x100; - this->direction = direction; - this->animationState = direction >> 2; + super->zVelocity = tmp; + super->speed = 0x100; + super->direction = direction; + super->animationState = direction >> 2; if (tmp >> 0x10 != 0) { sub_08060E70(this, 0x14); } else { @@ -453,7 +473,7 @@ bool32 sub_08061170(Entity* this) { } return FALSE; } else { - sub_08016AD2(this); + sub_08016AD2(super); return TRUE; } } @@ -506,10 +526,10 @@ u32 sub_080611D4(Entity* this) { return 0xff; } -u32 sub_08061230(Entity* this) { - if ((((UnkHeap*)this->myHeap)->unk_0 & 1) == 0) { - if ((this->contactFlags & 0x80) != 0) { - switch (this->contactFlags & 0x7f) { +u32 sub_08061230(NPC5Entity* this) { + if ((((UnkHeap*)super->myHeap)->unk_0 & 1) == 0) { + if ((super->contactFlags & 0x80) != 0) { + switch (super->contactFlags & 0x7f) { case 0: case 1: case 2: @@ -521,176 +541,176 @@ u32 sub_08061230(Entity* this) { case 0x1f: break; default: - ((UnkHeap*)this->myHeap)->unk_0 = ((UnkHeap*)this->myHeap)->unk_0 | 1; - InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x40); + ((UnkHeap*)super->myHeap)->unk_0 = ((UnkHeap*)super->myHeap)->unk_0 | 1; + InitAnimationForceUpdate(super, (super->animationState >> 1) + 0x40); return 1; } } } else { - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) == 0) { + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) == 0) { return 1; } - ((UnkHeap*)this->myHeap)->unk_0 &= 0xfe; - InitAnimationForceUpdate(this, this->field_0x6c.HALF.LO + (this->animationState >> 1)); + ((UnkHeap*)super->myHeap)->unk_0 &= 0xfe; + InitAnimationForceUpdate(super, this->unk_6c + (super->animationState >> 1)); } - this->contactFlags = this->contactFlags & 0x7f; - if (this->iframes != 0) { - this->iframes++; + super->contactFlags = super->contactFlags & 0x7f; + if (super->iframes != 0) { + super->iframes++; } return 0; } -void sub_08061358(Entity* this) { +void sub_08061358(NPC5Entity* this) { static const u8 gUnk_0810AC5D[] = { 0x30, 0x31, 0x38, 0x39, 0x32, 0x33, 0x3a, 0x3b, 0x34, 0x35, 0x3c, 0x3d, 0x36, 0x37, 0x3e, 0x3f, 0x0, 0x0, 0x0, }; u32 uVar2; u32 bVar4; - switch (this->subAction) { + switch (super->subAction) { case 0: - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) == 0) { + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) == 0) { return; } - this->subAction = 1; - this->timer = 15; + super->subAction = 1; + super->timer = 15; sub_08060E70(this, 0); break; case 1: - this->timer--; - if (this->timer != 0) { + super->timer--; + if (super->timer != 0) { return; } uVar2 = Random(); bVar4 = uVar2; if ((uVar2 & 1) == 0) { - this->subAction = 3; - this->timer = (bVar4 & 0x18) + 30; + super->subAction = 3; + super->timer = (bVar4 & 0x18) + 30; sub_08060E70(this, 4); return; } - this->subAction = 2; - InitAnimationForceUpdate(this, gUnk_0810AC5D[(u32)this->animationState * 2 + ((uVar2 >> 4) & 3)]); + super->subAction = 2; + InitAnimationForceUpdate(super, gUnk_0810AC5D[(u32)super->animationState * 2 + ((uVar2 >> 4) & 3)]); break; case 2: - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) == 0) { + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) == 0) { return; } - this->animationState = ((this->frame & 0x18) >> 2); + super->animationState = ((super->frame & 0x18) >> 2); if ((Random() & 1)) { - this->subAction = 3; - this->timer = (bVar4 & 0x18) + 30; + super->subAction = 3; + super->timer = (bVar4 & 0x18) + 30; sub_08060E70(this, 4); return; } - this->subAction = 0; + super->subAction = 0; sub_08060E70(this, 0x10); break; case 3: if (sub_08061170(this) == 0) { - this->subAction = 2; + super->subAction = 2; //! @bug bVar4 (r6) is uninitialized. - InitAnimationForceUpdate(this, gUnk_0810AC5D[this->animationState * 2 + (bVar4 >> 4 & 3)]); + InitAnimationForceUpdate(super, gUnk_0810AC5D[super->animationState * 2 + (bVar4 >> 4 & 3)]); return; } - if (--this->timer != 0) { + if (--super->timer != 0) { return; } - this->subAction = 0; + super->subAction = 0; sub_08060E70(this, 0x10); break; } } -void sub_08061464(Entity* this, u32 param_a, u32 param_b) { +void sub_08061464(NPC5Entity* this, u32 param_a, u32 param_b) { s32 iVar10; s32 iVar9; u32 bVar1; - iVar10 = this->x.HALF.HI; - iVar9 = this->y.HALF.HI; + iVar10 = super->x.HALF.HI; + iVar9 = super->y.HALF.HI; - switch (((CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, param_a, param_b) + 2) & 0x1c) >> 2) { + switch (((CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, param_a, param_b) + 2) & 0x1c) >> 2) { case 0: - this->field_0x6e.HWORD = param_b; - if (this->x.HALF.HI > (s32)param_a) { + this->unk_6e = param_b; + if (super->x.HALF.HI > (s32)param_a) { sub_08061630(this, iVar10, iVar9 + -8, param_a); break; } sub_080616A8(this, iVar10, iVar9 + -8, param_a); break; case 1: - this->field_0x6e.HWORD = param_a; + this->unk_6e = param_a; if (sub_08061720(this, iVar10 + 8, iVar9, param_b) != 0) break; - this->field_0x6e.HWORD = param_b; + this->unk_6e = param_b; sub_080616A8(this, iVar10, iVar9 + -8, param_a); break; case 2: - this->field_0x6e.HWORD = param_a; - if (this->y.HALF.HI > (s32)param_b) { + this->unk_6e = param_a; + if (super->y.HALF.HI > (s32)param_b) { sub_08061720(this, iVar10 + 8, iVar9, param_b); } else { sub_08061798(this, iVar10 + 8, iVar9, param_b); } break; case 3: - this->field_0x6e.HWORD = param_a; + this->unk_6e = param_a; if (sub_08061798(this, iVar10 + 8, iVar9, param_b) != 0) break; - this->field_0x6e.HWORD = param_b; + this->unk_6e = param_b; sub_08061888(this, iVar10, iVar9 + 8, param_a); break; case 4: - this->field_0x6e.HWORD = param_b; - if (this->x.HALF.HI > (s32)param_a) { + this->unk_6e = param_b; + if (super->x.HALF.HI > (s32)param_a) { sub_08061810(this, iVar10, iVar9 + 8, param_a); break; } sub_08061888(this, iVar10, iVar9 + 8, param_a); break; case 5: - this->field_0x6e.HWORD = param_a; + this->unk_6e = param_a; if (sub_08061978(this, iVar10 + -8, iVar9, param_b) != 0) break; - this->field_0x6e.HWORD = param_b; + this->unk_6e = param_b; sub_08061810(this, iVar10, iVar9 + 8, param_a); break; case 6: - this->field_0x6e.HWORD = param_a; - if (this->y.HALF.HI > (s32)param_b) { + this->unk_6e = param_a; + if (super->y.HALF.HI > (s32)param_b) { sub_08061900(this, iVar10 + -8, iVar9, param_b); } else { sub_08061978(this, iVar10 + -8, iVar9, param_b); } break; case 7: - this->field_0x6e.HWORD = param_a; + this->unk_6e = param_a; if (sub_08061900(this, iVar10 + -8, iVar9, param_b) == 0) { - this->field_0x6e.HWORD = param_b; + this->unk_6e = param_b; sub_08061630(this, iVar10, iVar9 + -8, param_a); } } - bVar1 = ((UnkHeap*)this->myHeap)->unk_0 & 8; + bVar1 = ((UnkHeap*)super->myHeap)->unk_0 & 8; if (bVar1 == 0) { - this->action = 3; - this->subAction = bVar1; + super->action = 3; + super->subAction = bVar1; } } -bool32 sub_08061630(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061630(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_y = y; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_08061A74(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = x; - ((UnkHeap*)this->myHeap)->unk_8 = param_y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD >= y) { + ((UnkHeap*)super->myHeap)->unk_7 = x; + ((UnkHeap*)super->myHeap)->unk_8 = param_y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e >= y) { return TRUE; } } @@ -699,15 +719,15 @@ bool32 sub_08061630(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_080616A8(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_080616A8(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_y = y; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_08061A1C(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = x; - ((UnkHeap*)this->myHeap)->unk_8 = param_y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD >= y) { + ((UnkHeap*)super->myHeap)->unk_7 = x; + ((UnkHeap*)super->myHeap)->unk_8 = param_y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e >= y) { return TRUE; } } @@ -716,15 +736,15 @@ bool32 sub_080616A8(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_08061720(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061720(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_x = x; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_080619F0(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = param_x; - ((UnkHeap*)this->myHeap)->unk_8 = y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD <= x) { + ((UnkHeap*)super->myHeap)->unk_7 = param_x; + ((UnkHeap*)super->myHeap)->unk_8 = y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e <= x) { return TRUE; } } @@ -733,15 +753,15 @@ bool32 sub_08061720(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_08061798(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061798(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_x = x; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_08061A48(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = param_x; - ((UnkHeap*)this->myHeap)->unk_8 = y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD <= x) { + ((UnkHeap*)super->myHeap)->unk_7 = param_x; + ((UnkHeap*)super->myHeap)->unk_8 = y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e <= x) { return TRUE; } } @@ -750,15 +770,15 @@ bool32 sub_08061798(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_08061810(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061810(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_y = y; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_08061A74(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = x; - ((UnkHeap*)this->myHeap)->unk_8 = param_y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD <= y) { + ((UnkHeap*)super->myHeap)->unk_7 = x; + ((UnkHeap*)super->myHeap)->unk_8 = param_y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e <= y) { return TRUE; } } @@ -767,15 +787,15 @@ bool32 sub_08061810(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_08061888(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061888(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_y = y; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_08061A1C(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = x; - ((UnkHeap*)this->myHeap)->unk_8 = param_y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD <= y) { + ((UnkHeap*)super->myHeap)->unk_7 = x; + ((UnkHeap*)super->myHeap)->unk_8 = param_y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e <= y) { return TRUE; } } @@ -784,15 +804,15 @@ bool32 sub_08061888(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_08061900(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061900(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_x = x; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_080619F0(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = param_x; - ((UnkHeap*)this->myHeap)->unk_8 = y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD >= x) { + ((UnkHeap*)super->myHeap)->unk_7 = param_x; + ((UnkHeap*)super->myHeap)->unk_8 = y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e >= x) { return TRUE; } } @@ -801,15 +821,15 @@ bool32 sub_08061900(Entity* this, s32 x, s32 y, s32 param) { return FALSE; } -bool32 sub_08061978(Entity* this, s32 x, s32 y, s32 param) { +bool32 sub_08061978(NPC5Entity* this, s32 x, s32 y, s32 param) { u32 param_x = x; - u8* layer = (this->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = (super->collisionLayer == 2) ? gMapTop.collisionData : gMapBottom.collisionData; while (!IsTileCollision(layer, x, y, 6)) { if (sub_08061A48(layer, x, y, param)) { - ((UnkHeap*)this->myHeap)->unk_7 = param_x; - ((UnkHeap*)this->myHeap)->unk_8 = y; - ((UnkHeap*)this->myHeap)->unk_0 |= 8; - if (this->field_0x6e.HWORD >= x) { + ((UnkHeap*)super->myHeap)->unk_7 = param_x; + ((UnkHeap*)super->myHeap)->unk_8 = y; + ((UnkHeap*)super->myHeap)->unk_0 |= 8; + if (this->unk_6e >= x) { return TRUE; } } @@ -858,64 +878,64 @@ bool32 sub_08061A74(u8* layer, s32 x, s32 y, s32 param) { return TRUE; } -void sub_08061AA0(Entity* this) { +void sub_08061AA0(NPC5Entity* this) { DeleteThisEntity(); } -void sub_08061AA8(Entity* this) { - static void (*const gUnk_0810AC70[])(Entity*) = { +void sub_08061AA8(NPC5Entity* this) { + static void (*const gUnk_0810AC70[])(NPC5Entity*) = { sub_08061ACC, sub_08061B18, }; - gUnk_0810AC70[this->action](this); - CopyPosition(this->parent, this); + gUnk_0810AC70[super->action](this); + CopyPosition(super->parent, super); } -void sub_08061ACC(Entity* this) { - this->flags = this->flags | ENT_PERSIST; - this->action = 1; - this->subAction = 0xff; - this->timer = 0; - this->followerFlag = this->followerFlag & 0xfe; - AddInteractableWhenBigObject(this); +void sub_08061ACC(NPC5Entity* this) { + super->flags = super->flags | ENT_PERSIST; + super->action = 1; + super->subAction = 0xff; + super->timer = 0; + super->followerFlag = super->followerFlag & 0xfe; + AddInteractableWhenBigObject(super); sub_08061AFC(this); } -void sub_08061AFC(Entity* this) { +void sub_08061AFC(NPC5Entity* this) { u32 tmp = 0; - if (this->subAction != 0) { - this->subAction = tmp; - *((u16**)&this->field_0x68) = gUnk_0810B660[0]; - this->timer = 0; + if (super->subAction != 0) { + super->subAction = tmp; + this->unk_68 = gUnk_0810B660[0]; + super->timer = 0; } } -void sub_08061B18(Entity* this) { +void sub_08061B18(NPC5Entity* this) { u16* puVar2; - switch (this->interactType) { - case 0: + switch (super->interactType) { + case INTERACTION_NONE: break; - case 1: - this->interactType = 0; + case INTERACTION_TALK: + super->interactType = INTERACTION_NONE; sub_08061AFC(this); - puVar2 = *(u16**)&this->field_0x68; - puVar2 += (this->timer++); + puVar2 = this->unk_68; + puVar2 += (super->timer++); if (puVar2[1] == 0) { - this->timer = 0; + super->timer = 0; } - MessageNoOverlap(puVar2[0], this); + MessageNoOverlap(puVar2[0], super); break; } } -void sub_08061B58(Entity* this) { - if (this->action == 0) { - this->action = 1; - InitAnimationForceUpdate(this, 2); +void sub_08061B58(NPC5Entity* this) { + if (super->action == 0) { + super->action = 1; + InitAnimationForceUpdate(super, 2); } if (gRoomTransition.entity_update_type == 2) { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } - sub_0806FD3C(this); + sub_0806FD3C(super); } diff --git a/src/npc/npc58.c b/src/npc/npc58.c index 0409dc4f..53f841f7 100644 --- a/src/npc/npc58.c +++ b/src/npc/npc58.c @@ -1,41 +1,55 @@ +/** + * @file npc58.c + * @ingroup NPCs + * + * @brief NPC 58 + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ s16 unk_68; + /*0x6a*/ s16 unk_6a; + /*0x6c*/ s16 unk_6c; +} NPC58Entity; + extern void sub_0806FFBC(Entity*, u32, u32, u32); static const SpriteLoadData gUnk_081146D0[] = { { 0, 0x61, 0x4 }, { 0x800, 0x61, 0x4 }, { 0x1000, 0x61, 0x4 }, { 0x1800, 0x61, 0x4 }, { 0, 0, 0 }, }; -void NPC58(Entity* this) { +void NPC58(NPC58Entity* this) { s32 sVar1; s32 uVar2; s32 uVar4; - Entity* entity; + GenericEntity* entity; - if (this->action == 0) { - if (!LoadExtraSpriteData(this, gUnk_081146D0)) { + if (super->action == 0) { + if (!LoadExtraSpriteData(super, gUnk_081146D0)) { return; } - this->action++; - this->spriteSettings.draw = 2; - this->spriteRendering.b3 = 0; - this->spritePriority.b0 = 0; - this->spriteOrientation.flipY = 1; - this->x.HALF.HI = 0x78; - this->y.HALF.HI = 0x10; + super->action++; + super->spriteSettings.draw = 2; + super->spriteRendering.b3 = 0; + super->spritePriority.b0 = 0; + super->spriteOrientation.flipY = 1; + super->x.HALF.HI = 0x78; + super->y.HALF.HI = 0x10; } - entity = this->parent; + entity = (GenericEntity*)super->parent; if (entity != NULL) { sVar1 = *(s16*)&entity->field_0x68.HWORD; uVar2 = (s32)sVar1 / 600; - this->field_0x68.HWORD = uVar2; + this->unk_68 = uVar2; uVar4 = (s32)sVar1 % 600; - this->field_0x6a.HWORD = uVar4 / 0x3c; + this->unk_6a = uVar4 / 0x3c; uVar4 = uVar4 % 0x3c; uVar2 = uVar4 / 6; - this->field_0x6c.HWORD = uVar2; - if (entity->next == NULL) { + this->unk_6c = uVar2; + if (entity->base.next == NULL) { DeleteThisEntity(); } } else { @@ -43,14 +57,14 @@ void NPC58(Entity* this) { } } -void NPC58_Head(Entity* this) { - this->frameIndex = 0xff; - SetExtraSpriteFrame(this, 0, (s16)this->field_0x68.HWORD); - SetExtraSpriteFrame(this, 1, (s16)this->field_0x6a.HWORD); - SetExtraSpriteFrame(this, 2, (s16)this->field_0x6c.HWORD); - SetExtraSpriteFrame(this, 3, 10); - sub_0806FFBC(this, 0, -12, 0); - sub_0806FFBC(this, 1, -4, 0); - sub_0806FFBC(this, 2, 0xc, 0); - sub_0807000C(this); +void NPC58_Head(NPC58Entity* this) { + super->frameIndex = 0xff; + SetExtraSpriteFrame(super, 0, this->unk_68); + SetExtraSpriteFrame(super, 1, this->unk_6a); + SetExtraSpriteFrame(super, 2, this->unk_6c); + SetExtraSpriteFrame(super, 3, 10); + sub_0806FFBC(super, 0, -12, 0); + sub_0806FFBC(super, 1, -4, 0); + sub_0806FFBC(super, 2, 0xc, 0); + sub_0807000C(super); } diff --git a/src/npc/npc9.c b/src/npc/npc9.c index a8361648..6e66716b 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -1,4 +1,10 @@ -#include "global.h" +/** + * @file npc9.c + * @ingroup NPCs + * + * @brief NPC 9 + */ +#define NENT_DEPRECATED #include "entity.h" #include "message.h" #include "npc.h" @@ -27,8 +33,8 @@ void sub_08062AF0(Entity* this) { void sub_08062B14(Entity* this) { GetNextFrame(this); - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; this->action++; InitializeAnimation(this, 1); RequestPriority(this); diff --git a/src/npc/percy.c b/src/npc/percy.c index 21a205f4..5c6108cd 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -1,8 +1,22 @@ -#include "global.h" +/** + * @file percy.c + * @ingroup NPCs + * + * @brief Percy NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "npc.h" #include "functions.h" +#include "item.h" #include "kinstone.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unused[27]; + /*0x84*/ ScriptExecutionContext* context; +} PercyEntity; static const SpriteLoadData gUnk_08112E1C[] = { { 0x30f6, 0x47, 0x4 }, @@ -10,7 +24,7 @@ static const SpriteLoadData gUnk_08112E1C[] = { { 0x1cf6, 0x47, 0x4 }, { 0, 0, 0 }, }; -void sub_0806B41C(Entity*); +void sub_0806B41C(PercyEntity*); void sub_0806B3CC(Entity*); void sub_0806B504(Entity*); void sub_0806B540(Entity*); @@ -26,11 +40,11 @@ void Percy_Head(Entity* this) { sub_0807000C(this); } -void Percy(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { +void Percy(PercyEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_0806B41C(this); } else { - sub_0806B3CC(this); + sub_0806B3CC(super); } } @@ -44,46 +58,47 @@ void sub_0806B3CC(Entity* this) { AddInteractableWhenBigObject(this); } GetNextFrame(this); - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; MessageFromTarget(0); } sub_0806ED78(this); } -void sub_0806B41C(Entity* this) { +void sub_0806B41C(PercyEntity* this) { u16* tmp; u32 idx; - switch (this->action) { + switch (super->action) { case 0: - if (LoadExtraSpriteData(this, gUnk_08112E1C)) { - this->action = 1; - this->spriteSettings.draw = 1; - if (this->type2 == 2) { - CreateFx(this, FX_SWEAT, 0); + if (LoadExtraSpriteData(super, gUnk_08112E1C)) { + super->action = 1; + super->spriteSettings.draw = 1; + if (super->type2 == 2) { + CreateFx(super, FX_SWEAT, 0); } - sub_0807DD50(this); + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); - idx = GetFuserId(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + idx = GetFuserId(super); tmp = gUnk_08001A7C[idx]; - if (this->field_0x68.HALF.LO == 33) + if (this->fusionOffer == 33) tmp += 3; - sub_0801DFB4(this, tmp[0], tmp[1], tmp[2]); + InitializeFuseInfo(super, tmp[0], tmp[1], tmp[2]); gPlayerState.controlMode = CONTROL_DISABLED; } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } break; } @@ -123,7 +138,7 @@ void sub_0806B504(Entity* this) { void sub_0806B540(Entity* this) { ScriptExecutionContext* context; - context = *(ScriptExecutionContext**)&this->cutsceneBeh; + context = ((PercyEntity*)this)->context; switch (context->unk_18) { case 0: MessageNoOverlap(TEXT_INDEX(TEXT_PERCY, 0x12), this); @@ -143,9 +158,9 @@ void sub_0806B540(Entity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { context->unk_18 = 3; if (gSave.stats.hasAllFigurines != 0) { - InitItemGetSequence(0x58, 0, 0); + InitItemGetSequence(ITEM_RUPEE100, 0, 0); } else { - InitItemGetSequence(0x3f, 100, 0); + InitItemGetSequence(ITEM_SHELLS, 100, 0); } SetRoomFlag(0xf); } @@ -161,9 +176,9 @@ void sub_0806B540(Entity* this) { gActiveScriptInfo.commandSize = 0; } -void Percy_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Percy_MakeInteractable(PercyEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Percy_Fusion(Entity* this) { diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 071f5b6e..469dddb5 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -1,29 +1,43 @@ -#include "entity.h" -#include "script.h" -#include "functions.h" -#include "fileselect.h" -#include "screen.h" +/** + * @file phonograph.c + * @ingroup NPCs + * + * @brief Phonograph NPC + */ +#define NENT_DEPRECATED #include "common.h" +#include "entity.h" +#include "fileselect.h" #include "flags.h" +#include "functions.h" #include "message.h" +#include "screen.h" +#include "script.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ s16 unk_68; + /*0x6a*/ s16 unk_6a; + /*0x6c*/ s16 unk_6c; +} PhonographEntity; #ifdef EU -void sub_0806EABC(Entity* this); +void sub_0806EABC(PhonographEntity* this); #else void sub_0806EABC(Entity* this, u32 param); #endif -void Phonograph(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = 1; - this->field_0x68.HWORD = 1; - this->field_0x6a.HWORD = -1; - sub_0807DD64(this); - this->frameIndex = 0; +void Phonograph(PhonographEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + this->unk_68 = 1; + this->unk_6a = -1; + sub_0807DD64(super); + super->frameIndex = 0; } - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); } static const s16 gUnk_081145E4[] = { @@ -36,7 +50,7 @@ static const s16 gUnk_081145E4[] = { }; #ifdef EU -void sub_0806E964(Entity* this, ScriptExecutionContext* context) { +void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) { if (gInput.newKeys & B_BUTTON) { sub_08050384(); return; @@ -44,14 +58,14 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { if (context->unk_18 == 0) { context->unk_18++; - this->field_0x6c.HWORD = 0; + this->unk_6c = 0; sub_0806EABC(this); } - if (gInput.unk4 & 0xc0) { + if (gInput.unk4 & (DPAD_UP | DPAD_DOWN)) { s32 val2, val3; - s32 val = (s16)this->field_0x68.HWORD; - if (gInput.unk4 & 0x40) { + s32 val = this->unk_68; + if (gInput.unk4 & DPAD_UP) { val++; } else { val--; @@ -70,39 +84,39 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { val = val2; } - this->field_0x68.HWORD = val; + this->unk_68 = val; sub_0806EABC(this); - if ((s16)this->field_0x6c.HWORD > 0) { - this->field_0x6c.HWORD--; + if (this->unk_6c > 0) { + this->unk_6c--; } } if (gInput.newKeys & A_BUTTON) { - if ((s16)this->field_0x68.HWORD != (s16)this->field_0x6a.HWORD || (s16)this->field_0x6c.HWORD == 0) { + if (this->unk_68 != this->unk_6a || this->unk_6c == 0) { const s16* ptr2 = gUnk_081145E4; s32 field_0x68; - SoundReq(*(ptr2 + (s16)this->field_0x68.HWORD * 2)); - this->field_0x6a.HWORD = this->field_0x68.HWORD; - field_0x68 = (s16)this->field_0x68.HWORD * 4; + SoundReq(*(ptr2 + this->unk_68 * 2)); + this->unk_6a = this->unk_68; + field_0x68 = this->unk_68 * 4; ptr2++; - this->field_0x6c.HWORD = *(s16*)((((s32)ptr2 + field_0x68))); + this->unk_6c = *(s16*)((((s32)ptr2 + field_0x68))); } else { SoundReq(SONG_STOP_ALL); - this->field_0x6a.HWORD = 0; + this->unk_6a = 0; } } - if ((s16)this->field_0x6c.HWORD > 0) { - if ((s16)-- this->field_0x6c.HWORD <= 0) { - this->field_0x6a.HWORD = 0; - this->field_0x6c.HWORD = 0; + if (this->unk_6c > 0) { + if (--this->unk_6c <= 0) { + this->unk_6a = 0; + this->unk_6c = 0; } } gActiveScriptInfo.commandSize = 0; } #else -void sub_0806E964(Entity* this, ScriptExecutionContext* context) { +void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) { s32 val, val2, val3; if (gInput.newKeys & B_BUTTON) { sub_08050384(); @@ -111,17 +125,17 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { if (context->unk_18 == 0) { context->unk_18++; - this->field_0x6c.HWORD = 0; - sub_0806EABC(this, (s16)this->field_0x68.HWORD); + this->unk_6c = 0; + sub_0806EABC(super, this->unk_68); } val2 = 0x1c; if (CheckGlobalFlag(GAMECLEAR)) { val2 = 0x34; } - val = (s16)this->field_0x68.HWORD; - if (gInput.newKeys & 0xc0) { - if (gInput.newKeys & 0x40) { + val = this->unk_68; + if (gInput.newKeys & (DPAD_UP | DPAD_DOWN)) { + if (gInput.newKeys & DPAD_UP) { val++; } else { val--; @@ -134,8 +148,8 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { if (val > val2) { val = 1; } - } else if (gInput.unk4 & 0xc0) { - if (gInput.unk4 & 0x40) { + } else if (gInput.unk4 & (DPAD_UP | DPAD_DOWN)) { + if (gInput.unk4 & DPAD_UP) { val++; } else { val--; @@ -150,34 +164,34 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) { } } - if (val != (s16)this->field_0x68.HWORD) { - sub_0806EABC(this, val); - if ((s16)this->field_0x6c.HWORD > 0) { - this->field_0x6c.HWORD--; + if (val != this->unk_68) { + sub_0806EABC(super, val); + if (this->unk_6c > 0) { + this->unk_6c--; } } - this->field_0x68.HWORD = val; + this->unk_68 = val; if (gInput.newKeys & A_BUTTON) { - if ((s16)this->field_0x68.HWORD != (s16)this->field_0x6a.HWORD || (s16)this->field_0x6c.HWORD == 0) { + if (this->unk_68 != this->unk_6a || this->unk_6c == 0) { const s16* ptr2 = gUnk_081145E4; s32 field_0x68; - SoundReq(*(ptr2 + (s16)this->field_0x68.HWORD * 2)); - this->field_0x6a.HWORD = this->field_0x68.HWORD; - field_0x68 = (s16)this->field_0x68.HWORD * 4; + SoundReq(*(ptr2 + this->unk_68 * 2)); + this->unk_6a = this->unk_68; + field_0x68 = this->unk_68 * 4; ptr2++; - this->field_0x6c.HWORD = *(s16*)((((s32)ptr2 + field_0x68))); + this->unk_6c = *(s16*)((((s32)ptr2 + field_0x68))); } else { SoundReq(SONG_STOP_ALL); - this->field_0x6a.HWORD = 0; + this->unk_6a = 0; } } - if ((s16)this->field_0x6c.HWORD > 0) { - if ((s16)-- this->field_0x6c.HWORD <= 0) { - this->field_0x6a.HWORD = 0; - this->field_0x6c.HWORD = 0; + if (this->unk_6c > 0) { + if (--this->unk_6c <= 0) { + this->unk_6a = 0; + this->unk_6c = 0; } } @@ -190,9 +204,9 @@ const static Font gUnk_081146B8 = { }; #ifdef EU -void sub_0806EABC(Entity* this) { +void sub_0806EABC(PhonographEntity* this) { sub_08050384(); - sub_08057044((s16)this->field_0x68.HWORD, gUnk_020227E8, 0x202020); + sub_08057044(this->unk_68, gUnk_020227E8, 0x202020); ShowTextBox(0x3302, &gUnk_081146B8); gScreen.bg0.updated = 1; } diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index 80ebfc0a..0bb4742b 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -1,3 +1,9 @@ +/** + * @file picolyteBottle.c + * @ingroup NPCs + * + * @brief Picolyte Bottle NPC + */ #define NENT_DEPRECATED #include "entity.h" #include "functions.h" @@ -11,12 +17,12 @@ #include "structures.h" typedef struct { - Entity base; - Entity* ent1; - Entity* ent2; - Entity* ent3; - u16 unk74; - u16 unk76; + /*0x00*/ Entity base; + /*0x68*/ Entity* ent1; + /*0x6c*/ Entity* ent2; + /*0x70*/ Entity* ent3; + /*0x74*/ u16 unk74; + /*0x76*/ u16 unk76; } PicolyteBottleEntity; void sub_0806E014(PicolyteBottleEntity* this); @@ -60,7 +66,7 @@ void PicolyteBottle_Init(PicolyteBottleEntity* this) { this->unk76 = 10; gRoomTransition.field_0x6 = 10; sub_0806E014(this); - sub_0807DD50(super); + InitScriptForNPC(super); } else { super->hitbox = (Hitbox*)&gHitbox_0; super->collisionLayer = 1; @@ -69,7 +75,7 @@ void PicolyteBottle_Init(PicolyteBottleEntity* this) { } void PicolyteBottle_Action1(PicolyteBottleEntity* this) { - sub_0807DD94(super, 0); + ExecuteScriptAndHandleAnimation(super, NULL); if (super->timer != 0xff) { if (super->damage != 0) { this->ent3->timer++; @@ -84,8 +90,8 @@ void PicolyteBottle_Action1(PicolyteBottleEntity* this) { void PicolyteBottle_Action2(PicolyteBottleEntity* this) { Entity* obj; - if (super->interactType != 0) { - super->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; super->parent->timer = super->type2; super->parent->type2 = super->subtimer; } else { diff --git a/src/npc/pina.c b/src/npc/pina.c index f11cbdd9..cb73eabc 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -1,21 +1,34 @@ +/** + * @file pina.c + * @ingroup NPCs + * + * @brief Pina NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" -#include "save.h" #include "npc.h" #include "object.h" +#include "save.h" -void sub_08063B68(Entity* this); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} PinaEntity; + +void sub_08063B68(PinaEntity* this); void sub_08063A80(Entity* this); void sub_08063A98(Entity* this); void sub_08063AC0(Entity* this); void sub_08063B44(Entity* this); -void Pina(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { +void Pina(PinaEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_08063B68(this); } else { - sub_08063A80(this); + sub_08063A80(super); } } @@ -52,7 +65,7 @@ void sub_08063AC0(Entity* this) { } } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; InitAnimationForceUpdate(this, GetAnimationState(this) + 4); MessageFromTarget(this->timer + TEXT_INDEX(TEXT_EMPTY, 0x01)); @@ -69,32 +82,33 @@ void sub_08063B44(Entity* this) { } } -void sub_08063B68(Entity* this) { - switch (this->action) { +void sub_08063B68(PinaEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.HI = 0; - sub_0807DD64(this); + super->action = 1; + super->spriteSettings.draw = 1; + this->animIndex = 0; + sub_0807DD64(super); case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - UpdateAnimationSingleFrame(this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + UpdateAnimationSingleFrame(super); } break; case 2: - if (UpdateFuseInteraction(this) == 0) { + if (UpdateFuseInteraction(super) == 0) { return; } - this->action = 1; - InitAnimationForceUpdate(this, this->field_0x68.HALF.HI); + super->action = 1; + InitAnimationForceUpdate(super, this->animIndex); break; } } @@ -150,9 +164,9 @@ void sub_08063C90(Entity* this) { ShowNPCDialogue(this, &gUnk_0810CE04[gSave.global_progress]); } -void Pina_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Pina_MakeInteractable(PinaEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Pina_Fusion(Entity* this) { diff --git a/src/npc/pita.c b/src/npc/pita.c index 8414accc..ccf79c69 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -1,33 +1,42 @@ -#include "npc.h" +/** + * @file pita.c + * @ingroup NPCs + * + * @brief Pita NPC + */ +#define NENT_DEPRECATED #include "item.h" +#include "npc.h" -void Pita(Entity* this) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[24]; + /*0x80*/ u16 unk_80; +} PitaEntity; + +void Pita(PitaEntity* this) { static const Hitbox gUnk_0810C428 = { + 0, + 2, + { 0, 0, 0, 0 }, #if EU - 0, - 2, - { 0, 0, 0, 0 }, 6, - 18, #else - 0, - 2, - { 0, 0, 0, 0 }, 10, - 18, #endif + 18, }; - if (this->action == 0) { - this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); - SortEntityAbove(this, this); - this->hitbox = (Hitbox*)&gUnk_0810C428; - sub_0807DD64(this); + if (super->action == 0) { + super->action++; + SetDefaultPriority(super, PRIO_MESSAGE); + SortEntityAbove(super, super); + super->hitbox = (Hitbox*)&gUnk_0810C428; + sub_0807DD64(super); } - sub_0807DD94(this, NULL); - if ((this->frame & 1) != 0) { - InitAnimationForceUpdate(this, (u32)(this->animationState >> 1)); - this->field_0x80.HWORD = this->animIndex; + ExecuteScriptAndHandleAnimation(super, NULL); + if ((super->frame & 1) != 0) { + InitAnimationForceUpdate(super, (u32)(super->animationState >> 1)); + this->unk_80 = super->animIndex; } } diff --git a/src/npc/postman.c b/src/npc/postman.c index 5eb99418..a81c901e 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -1,14 +1,29 @@ -#include "global.h" -#include "sound.h" +/** + * @file postman.c + * @ingroup NPCs + * + * @brief Postman NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" +#include "sound.h" #include "structures.h" -extern void sub_08060528(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ s8 unk_68; + /*0x69*/ s8 unk_69; + /*0x6a*/ s16 unk_6a; + /*0x6c*/ u8 fusionOffer; + /*0x6d*/ u8 unk_6d; +} PostmanEntity; + +extern void sub_08060528(PostmanEntity*); extern void sub_080604DC(Entity*); extern void sub_080606D8(Entity*); -extern void Postman_MakeInteractable(Entity*); +extern void Postman_MakeInteractable(PostmanEntity*); const Coords gUnk_0810A66C[] = { { .HALF = { 0x0, 0x0 } }, { .HALF = { 0x48, 0xa8 } }, { .HALF = { 0x0, 0xf0 } }, @@ -149,11 +164,11 @@ const Rect gUnk_0810AA70[][4] = { }, }; -void Postman(Entity* this) { - if ((this->flags & ENT_SCRIPTED) != 0) { +void Postman(PostmanEntity* this) { + if ((super->flags & ENT_SCRIPTED) != 0) { sub_08060528(this); } else { - gUnk_0810AA24[this->action](this); + gUnk_0810AA24[super->action](super); } } @@ -180,8 +195,8 @@ void sub_0806045C(Entity* this) { UpdateAnimationSingleFrame(this); sub_080604DC(this); switch (this->interactType) { - case 1: - case 2: + case INTERACTION_TALK: + case INTERACTION_FUSE: this->action = 2; MessageFromTarget(0); break; @@ -225,76 +240,78 @@ void sub_080604DC(Entity* this) { } } -void sub_08060528(Entity* this) { - switch (this->action) { +void sub_08060528(PostmanEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = TRUE; - this->field_0x68.HALF.LO = 0; - this->field_0x68.HALF.HI = 0; - this->field_0x6a.HWORD = 0; - this->field_0x6c.HALF.HI = 0; - this->field_0x6c.HALF.LO = GetFusionToOffer(this); - sub_0807DD50(this); + super->action = 1; + super->spriteSettings.draw = TRUE; + this->unk_68 = 0; + this->unk_69 = 0; + this->unk_6a = 0; + this->unk_6d = 0; + this->fusionOffer = GetFusionToOffer(super); + InitScriptForNPC(super); break; case 1: - if (this->interactType == 2) { - this->action = 3; - this->interactType = 0; - sub_0806F118(this); - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + if (super->interactType == INTERACTION_FUSE) { + super->action = 3; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { - if (this->interactType != 0) { - this->action = 2; - this->interactType = 0; - sub_080606D8(this); - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + if (super->interactType != INTERACTION_NONE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + sub_080606D8(super); + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } } break; case 2: - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if ((gMessage.doTextBox & 0x7f) != 0) { break; } - this->action = 1; + super->action = 1; break; case 3: - UpdateAnimationSingleFrame(this); - if (!UpdateFuseInteraction(this)) { + UpdateAnimationSingleFrame(super); + if (!UpdateFuseInteraction(super)) { break; } - this->action = 1; + super->action = 1; } - sub_080604DC(this); - if (0 < (s16)this->field_0x6a.HWORD) { - if ((s16)this->field_0x6a.HWORD > 0x12b) { - this->field_0x6a.HWORD = 0; - this->zVelocity = Q_16_16(2.0); - this->field_0x6c.HALF.HI = 1; - RemoveInteractableObject(this); + sub_080604DC(super); + if (0 < (s16)this->unk_6a) { + if ((s16)this->unk_6a > 0x12b) { + this->unk_6a = 0; + super->zVelocity = Q_16_16(2.0); + this->unk_6d = 1; + RemoveInteractableObject(super); EnqueueSFX(SFX_PLY_JUMP); } else { - this->field_0x6a.HWORD--; + this->unk_6a--; } } - GravityUpdate(this, Q_8_8(24.0)); - if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) { - this->field_0x6c.HALF.HI = 0; + GravityUpdate(super, Q_8_8(24.0)); + if (((this->unk_6d != 0) && (super->zVelocity == 0)) && super->z.WORD == 0) { + this->unk_6d = 0; Postman_MakeInteractable(this); } - if (this->z.WORD >= 0 && - ((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) { - sub_0806ED78(this); + if (super->z.WORD >= 0 && + ((gPlayerEntity.collisionLayer == 0 || (super->collisionLayer == gPlayerEntity.collisionLayer)))) { + sub_0806ED78(super); } - sub_0800451C(this); + sub_0800451C(super); } -void Postman_MakeInteractable(Entity* this) { - this->field_0x6c.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x6c.HALF.LO); +void Postman_MakeInteractable(PostmanEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void sub_080606D8(Entity* this) { @@ -307,21 +324,21 @@ void sub_080606D8(Entity* this) { ShowNPCDialogue(this, &gUnk_0810AA30[index]); } -void sub_08060700(Entity* entity, ScriptExecutionContext* context) { - const s8* var0 = gUnk_0810A918[(s8)entity->field_0x68.HALF.LO]; - const Coords* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]]; +void sub_08060700(PostmanEntity* this, ScriptExecutionContext* context) { + const s8* var0 = gUnk_0810A918[(s8)this->unk_68]; + const Coords* coords = &gUnk_0810A66C[var0[(s8)this->unk_69]]; u32 x = coords->HALF.x + gRoomControls.origin_x; u32 y = coords->HALF.y + gRoomControls.origin_y; - LookAt(entity, context, x, y); + LookAt(super, context, x, y); gActiveScriptInfo.flags |= 1; } -void sub_0806075C(Entity* this) { - this->field_0x68.HALF.LO = 0xb; - this->field_0x68.HALF.HI = 0xff; +void sub_0806075C(PostmanEntity* this) { + this->unk_68 = 0xb; + this->unk_69 = 0xff; } -void sub_0806076C(Entity* this, ScriptExecutionContext* context) { +void sub_0806076C(PostmanEntity* this, ScriptExecutionContext* context) { s32 cVar2; int iVar4; u32 uVar6; @@ -330,15 +347,15 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) { const Coords* ptr; const s8* pbVar10; - if (this->z.WORD < 0) { + if (super->z.WORD < 0) { gActiveScriptInfo.commandSize = 0; return; } - this->field_0x68.HALF.HI++; - this->collisionLayer = 1; + this->unk_69++; + super->collisionLayer = 1; Postman_MakeInteractable(this); - pbVar10 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO]; - pbVar10 += (s8)this->field_0x68.HALF.HI; + pbVar10 = gUnk_0810A918[this->unk_68]; + pbVar10 += this->unk_69; do { switch ((s8)(pbVar10[0] + 5)) { case 5: @@ -346,21 +363,21 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) { uVar9 = pbVar10[0]; pbVar10++; iVar4 = (s32)Random() % uVar9; - this->field_0x68.HALF.LO = pbVar10[iVar4]; - this->field_0x68.HALF.HI = 0; + this->unk_68 = pbVar10[iVar4]; + this->unk_69 = 0; return; case 4: - this->field_0x6a.HWORD = 300; + this->unk_6a = 300; break; case 3: - this->collisionLayer = 1; + super->collisionLayer = 1; break; case 2: - this->collisionLayer = 2; + super->collisionLayer = 2; break; case 1: context->wait = 0x1e; - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; break; case 0: pbVar10++; @@ -368,40 +385,40 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) { local_24 = ((s32)Random()) % uVar9; for (uVar6 = 0; uVar6 < uVar9; uVar6++) { - this->field_0x68.HALF.LO = pbVar10[local_24]; - cVar2 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO][0]; + this->unk_68 = pbVar10[local_24]; + cVar2 = gUnk_0810A918[this->unk_68][0]; ptr = &gUnk_0810A66C[cVar2]; - this->x.HALF_U.HI = gRoomControls.origin_x + ptr->HALF.x; - this->y.HALF_U.HI = gRoomControls.origin_y + ptr->HALF.y; - if (CheckOnScreen(this) == 0) + super->x.HALF_U.HI = gRoomControls.origin_x + ptr->HALF.x; + super->y.HALF_U.HI = gRoomControls.origin_y + ptr->HALF.y; + if (CheckOnScreen(super) == 0) break; local_24 = (s32)(local_24 + 1) % uVar9; } - this->field_0x68.HALF.HI = 0; + this->unk_69 = 0; return; default: return; } - this->field_0x68.HALF.HI++; + this->unk_69++; pbVar10++; } while (TRUE); } -void sub_080608E4(Entity* this, ScriptExecutionContext* context) { +void sub_080608E4(PostmanEntity* this, ScriptExecutionContext* context) { context->condition = 0; - if (this->z.WORD >= 0) { - if ((this->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) && - (this->collisionLayer != 2 || gPlayerEntity.collisionLayer != 1)) { - const Rect* ptr = &gUnk_0810AA70[context->intVariable][this->animationState >> 1]; - u32 x = this->x.HALF.HI + ptr->x; - u32 y = this->y.HALF.HI + ptr->y; + if (super->z.WORD >= 0) { + if ((super->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) && + (super->collisionLayer != 2 || gPlayerEntity.collisionLayer != 1)) { + const Rect* ptr = &gUnk_0810AA70[context->intVariable][super->animationState >> 1]; + u32 x = super->x.HALF.HI + ptr->x; + u32 y = super->y.HALF.HI + ptr->y; x = gPlayerEntity.x.HALF.HI - x; y = gPlayerEntity.y.HALF.HI - y; x += ptr->width; y += ptr->height; if (ptr->width * 2 > x && ptr->height * 2 > y) { context->condition = 1; - this->field_0x6a.HWORD += 2; + this->unk_6a += 2; } } } diff --git a/src/npc/rem.c b/src/npc/rem.c index 01db2ab1..5470b36b 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -1,6 +1,24 @@ +/** + * @file rem.c + * @ingroup NPCs + * + * @brief Rem NPC + */ +#define NENT_DEPRECATED #include "functions.h" -#include "npc.h" #include "item.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69; + /*0x6a*/ u16 unk_6a; + /*0x6c*/ u8 unused1[20]; + /*0x80*/ u16 unk_80; + /*0x82*/ u8 unused2[2]; + /*0x84*/ ScriptExecutionContext* context; +} RemEntity; extern void sub_0806A8C8(Entity*); @@ -8,259 +26,259 @@ extern void script_Rem; extern void DeleteThoughtBubble(Entity* this, ScriptExecutionContext* context); -void sub_0806A9B0(Entity*, ScriptExecutionContext*); +void sub_0806A9B0(RemEntity*, ScriptExecutionContext*); void sub_0806A914(Entity* this); -void sub_0806a370(Entity* this); -void sub_0806A5E8(Entity* this); -void sub_0806A630(Entity* this); -void sub_0806A674(Entity* this); -void sub_0806A830(Entity* this); -void sub_0806A890(Entity* this); +void sub_0806a370(RemEntity* this); +void sub_0806A5E8(RemEntity* this); +void sub_0806A630(RemEntity* this); +void sub_0806A674(RemEntity* this); +void sub_0806A830(RemEntity* this); +void sub_0806A890(RemEntity* this); -void sub_0806A3D8(Entity* this); -void sub_0806A410(Entity* this); -void sub_0806A458(Entity* this); -void sub_0806A4CC(Entity* this); -void sub_0806A550(Entity* this); -void nullsub_503(Entity* this); -void sub_0806A5C0(Entity* this); +void sub_0806A3D8(RemEntity* this); +void sub_0806A410(RemEntity* this); +void sub_0806A458(RemEntity* this); +void sub_0806A4CC(RemEntity* this); +void sub_0806A550(RemEntity* this); +void nullsub_503(RemEntity* this); +void sub_0806A5C0(RemEntity* this); -void Rem(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { +void Rem(RemEntity* this) { + static void (*const typeFuncs[])(RemEntity*) = { sub_0806a370, sub_0806A5E8, sub_0806A630, sub_0806A674, sub_0806A830, sub_0806A890, }; - typeFuncs[this->type](this); + typeFuncs[super->type](this); } -void sub_0806a370(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void sub_0806a370(RemEntity* this) { + static void (*const actionFuncs[])(RemEntity*) = { sub_0806A3D8, sub_0806A410, sub_0806A458, sub_0806A4CC, sub_0806A550, nullsub_503, sub_0806A5C0, }; - actionFuncs[this->action](this); - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - UpdateAnimationSingleFrame(this); - sub_0806ED78(this); - if (this->animIndex == 0xf) { - if (this->frame == 1) { - this->frame = 0; + actionFuncs[super->action](this); + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + UpdateAnimationSingleFrame(super); + sub_0806ED78(super); + if (super->animIndex == 0xf) { + if (super->frame == 1) { + super->frame = 0; SoundReq(SFX_218); } - if (this->frame == 2) { - this->frame = 0; + if (super->frame == 2) { + super->frame = 0; SoundReq(SFX_219); } } } -void sub_0806A3D8(Entity* this) { - this->action = 1; - this->timer = 180; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0806A8C8(this); - *(ScriptExecutionContext**)&this->cutsceneBeh = StartCutscene(this, &script_Rem); - sub_0807DD94(this, NULL); +void sub_0806A3D8(RemEntity* this) { + super->action = 1; + super->timer = 180; + SetDefaultPriority(super, PRIO_MESSAGE); + sub_0806A8C8(super); + this->context = StartCutscene(super, &script_Rem); + ExecuteScriptAndHandleAnimation(super, NULL); } -void sub_0806A410(Entity* this) { - switch (this->subAction) { +void sub_0806A410(RemEntity* this) { + switch (super->subAction) { case 0: - if (--this->timer == 0) { - this->subAction++; - InitializeAnimation(this, 8); + if (--super->timer == 0) { + super->subAction++; + InitializeAnimation(super, 8); } break; case 1: - if (((this->frame & ANIM_DONE) != 0)) { - sub_0806A9B0(this, *(ScriptExecutionContext**)&this->cutsceneBeh); + if (((super->frame & ANIM_DONE) != 0)) { + sub_0806A9B0(this, this->context); } break; } } -void sub_0806A458(Entity* this) { - switch (this->subAction) { +void sub_0806A458(RemEntity* this) { + switch (super->subAction) { case 0: - if (--this->timer == 0) { - this->subAction++; + if (--super->timer == 0) { + super->subAction++; } break; case 1: - if ((this->frame & ANIM_DONE) != 0) { - this->subAction = 2; - InitializeAnimation(this, 10); + if ((super->frame & ANIM_DONE) != 0) { + super->subAction = 2; + InitializeAnimation(super, 10); ClearLocalFlag(0x62); } break; case 2: - if (((this->frame & ANIM_DONE) != 0)) { - this->action = 1; - this->subAction = 0; - this->timer = 60; - InitializeAnimation(this, 2); + if (((super->frame & ANIM_DONE) != 0)) { + super->action = 1; + super->subAction = 0; + super->timer = 60; + InitializeAnimation(super, 2); } break; } } -void sub_0806A4CC(Entity* this) { - switch (this->subAction) { +void sub_0806A4CC(RemEntity* this) { + switch (super->subAction) { case 0: - if ((this->frame & ANIM_DONE) != 0) { - if ((u8)(this->animIndex - 8) < 2) { - this->subAction = 1; - this->field_0x6a.HWORD = 1; - InitializeAnimation(this, 10); + if ((super->frame & ANIM_DONE) != 0) { + if ((u8)(super->animIndex - 8) < 2) { + super->subAction = 1; + this->unk_6a = 1; + InitializeAnimation(super, 10); } else { - this->subAction = 2; - this->field_0x6a.HWORD = 0; - InitializeAnimation(this, GetAnimationState(this)); + super->subAction = 2; + this->unk_6a = 0; + InitializeAnimation(super, GetAnimationState(super)); } break; case 1: - if ((this->frame & ANIM_DONE) != 0) { - this->subAction = 2; - InitializeAnimation(this, GetAnimationState(this)); + if ((super->frame & ANIM_DONE) != 0) { + super->subAction = 2; + InitializeAnimation(super, GetAnimationState(super)); } break; default: - this->timer = 180; + super->timer = 180; break; } } } -void sub_0806A550(Entity* this) { - if (this->subAction == 0) { - this->subAction = 1; - InitializeAnimation(this, 0xc); +void sub_0806A550(RemEntity* this) { + if (super->subAction == 0) { + super->subAction = 1; + InitializeAnimation(super, 0xc); } else { - if (this->frame == 1) { - this->frame = 0; + if (super->frame == 1) { + super->frame = 0; InitScreenShake(8, 2); gActiveScriptInfo.syncFlags |= 0x100; SoundReq(SFX_CHEST_OPEN); } - if ((this->frame & ANIM_DONE) != 0) { - this->action = 5; - this->subAction = 0; - InitializeAnimation(this, 0xd); - sub_0806A914(this); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 5; + super->subAction = 0; + InitializeAnimation(super, 0xd); + sub_0806A914(super); } } } -void nullsub_503(Entity* this) { +void nullsub_503(RemEntity* this) { } -void sub_0806A5C0(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - InitializeAnimation(this, (Random() & 3) + 4); +void sub_0806A5C0(RemEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + InitializeAnimation(super, (Random() & 3) + 4); } } -void sub_0806A5E8(Entity* this) { - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 0x10); - this->timer = (Random() & 0x3f) + 60; +void sub_0806A5E8(RemEntity* this) { + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 0x10); + super->timer = (Random() & 0x3f) + 60; } - this->timer--; - if (this->timer == 0) { - this->timer = (Random() & 0x3f) + 120; + super->timer--; + if (super->timer == 0) { + super->timer = (Random() & 0x3f) + 120; SoundReq(SFX_REM_SLEEP); } - GetNextFrame(this); + GetNextFrame(super); } -void sub_0806A630(Entity* this) { - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 0x12); +void sub_0806A630(RemEntity* this) { + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 0x12); } if ((gActiveScriptInfo.syncFlags & 0x100) != 0) { - GetNextFrame(this); + GetNextFrame(super); } - if (this->frame == 1) { - this->frame = 0; + if (super->frame == 1) { + super->frame = 0; SoundReq(SFX_SECRET); } } -void sub_0806A674(Entity* this) { +void sub_0806A674(RemEntity* this) { static const u8 gUnk_08112294[] = { 0, -1, 0, 1, 0, -1, 0, 1 }; u32 rand; u8 auStack16[8]; memcpy(auStack16, &gUnk_08112294, 8); - switch (this->action) { + switch (super->action) { case 0: - this->action = 1; - this->spritePriority.b0 = 6; - InitializeAnimation(this, 0x13); + super->action = 1; + super->spritePriority.b0 = 6; + InitializeAnimation(super, 0x13); break; case 1: if ((gActiveScriptInfo.syncFlags & 0x100) != 0) { - this->action = 2; - this->spriteOffsetY = 0; - this->spriteOffsetX = 0; + super->action = 2; + super->spriteOffsetY = 0; + super->spriteOffsetX = 0; } else { - if (this->parent->animIndex == 9) { - this->spritePriority.b0 = 3; + if (super->parent->animIndex == 9) { + super->spritePriority.b0 = 3; - if (this->timer == 0) { + if (super->timer == 0) { rand = Random(); - this->timer = rand & 7; - this->field_0x68.HALF.LO = auStack16[rand >> 8 & 7]; + super->timer = rand & 7; + this->unk_68 = auStack16[rand >> 8 & 7]; } else if ((gRoomTransition.frameCount & 3U) == 0) { - this->timer--; - if ((s8)this->spriteOffsetX < 1) { - this->field_0x68.HALF.LO = 1; + super->timer--; + if ((s8)super->spriteOffsetX < 1) { + this->unk_68 = 1; } - if (0xf < (s8)this->spriteOffsetX) { - this->field_0x68.HALF.LO = -1; + if (0xf < (s8)super->spriteOffsetX) { + this->unk_68 = -1; } - this->spriteOffsetX += this->field_0x68.HALF.LO; + super->spriteOffsetX += this->unk_68; } - if (this->subtimer == 0) { + if (super->subtimer == 0) { rand = Random(); - this->subtimer = rand & 7; - this->field_0x68.HALF.HI = auStack16[rand >> 8 & 7]; + super->subtimer = rand & 7; + this->unk_69 = auStack16[rand >> 8 & 7]; } else if (((u32)gRoomTransition.frameCount >> 4 & 3) == 0) { - this->subtimer--; - if (-1 < this->spriteOffsetY) { - this->field_0x68.HALF.HI = -1; + super->subtimer--; + if (-1 < super->spriteOffsetY) { + this->unk_69 = -1; } - if (this->spriteOffsetY <= -8) { - this->field_0x68.HALF.HI = 1; + if (super->spriteOffsetY <= -8) { + this->unk_69 = 1; } - this->spriteOffsetY += this->field_0x68.HALF.HI; + super->spriteOffsetY += this->unk_69; } } else { - this->spritePriority.b0 = 6; - if ((s8)this->spriteOffsetX != 0) { - if (0 < (s8)this->spriteOffsetX) { - this->spriteOffsetX--; + super->spritePriority.b0 = 6; + if ((s8)super->spriteOffsetX != 0) { + if (0 < (s8)super->spriteOffsetX) { + super->spriteOffsetX--; } - if ((s8)this->spriteOffsetX < 0) { - this->spriteOffsetX++; + if ((s8)super->spriteOffsetX < 0) { + super->spriteOffsetX++; } } - if (this->spriteOffsetY != 0) { - if (0 < this->spriteOffsetY) { - this->spriteOffsetY--; + if (super->spriteOffsetY != 0) { + if (0 < super->spriteOffsetY) { + super->spriteOffsetY--; } - if (this->spriteOffsetY < 0) { - this->spriteOffsetY++; + if (super->spriteOffsetY < 0) { + super->spriteOffsetY++; } } } @@ -268,40 +286,40 @@ void sub_0806A674(Entity* this) { break; case 2: - GetNextFrame(this); + GetNextFrame(super); break; } } -void sub_0806A830(Entity* this) { +void sub_0806A830(RemEntity* this) { Entity* npc; - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 0x14); - SetDefaultPriority(this, PRIO_MESSAGE); + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 0x14); + SetDefaultPriority(super, PRIO_MESSAGE); } if ((gActiveScriptInfo.syncFlags & 0x200) != 0) { DeleteThisEntity(); } - GetNextFrame(this); - if (this->frame == 1) { - this->frame = 0; + GetNextFrame(super); + if (super->frame == 1) { + super->frame = 0; npc = CreateNPC(REM, 5, 0); if (npc != NULL) { - PositionEntityOnTop(this, npc); + PositionEntityOnTop(super, npc); } } } -void sub_0806A890(Entity* this) { - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 0x15); - SetDefaultPriority(this, PRIO_MESSAGE); +void sub_0806A890(RemEntity* this) { + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 0x15); + SetDefaultPriority(super, PRIO_MESSAGE); } - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } @@ -342,13 +360,13 @@ void sub_0806A958(Entity* this) { void sub_0806A96C(Entity* this, ScriptExecutionContext* context) { context->condition = 0; - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { if (this->action != 3) { this->action = 3; this->subAction = 0; } else { if (this->subAction > 1) { - this->interactType = 0; + this->interactType = INTERACTION_NONE; context->condition = 1; gActiveScriptInfo.flags |= 1; } @@ -356,13 +374,13 @@ void sub_0806A96C(Entity* this, ScriptExecutionContext* context) { } } -void sub_0806A9B0(Entity* this, ScriptExecutionContext* context) { +void sub_0806A9B0(RemEntity* this, ScriptExecutionContext* context) { static const u8 gUnk_081122A0[] = { 60, 100, 200, 60, 100, 200, 80, 80 }; - this->action = 2; - this->subAction = 0; - this->timer = gUnk_081122A0[Random() & 7]; - this->field_0x80.HWORD = 9; - InitializeAnimation(this, 9); + super->action = 2; + super->subAction = 0; + super->timer = gUnk_081122A0[Random() & 7]; + this->unk_80 = 9; + InitializeAnimation(super, 9); SetLocalFlag(NPC37_REM_SLEEP); } @@ -378,16 +396,16 @@ void sub_0806AA10(Entity* this) { sub_0806A914(this); } -void sub_0806AA18(Entity* this) { +void sub_0806AA18(RemEntity* this) { u32 index; - if (this->field_0x6a.HWORD != 0) { + if (this->unk_6a != 0) { index = TEXT_INDEX(TEXT_REM, 0x8); } else if ((gRoomTransition.frameCount & 1) == 0) { index = TEXT_INDEX(TEXT_REM, 0x7); } else { index = TEXT_INDEX(TEXT_REM, 0xd); } - MessageNoOverlap(index, this); + MessageNoOverlap(index, super); } void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { diff --git a/src/npc/simon.c b/src/npc/simon.c index 954f45a4..163b12c1 100644 --- a/src/npc/simon.c +++ b/src/npc/simon.c @@ -1,3 +1,10 @@ +/** + * @file simon.c + * @ingroup NPCs + * + * @brief Simon NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -17,9 +24,9 @@ typedef struct { void Simon(Entity* this) { if (this->action == 0) { this->action++; - sub_0807DD50(this); + InitScriptForNPC(this); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } } diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index c5f63d07..f16d0ea0 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -1,6 +1,21 @@ +/** + * @file sittingPerson.c + * @ingroup NPCs + * + * @brief Sitting Person NPC + */ +#define NENT_DEPRECATED #include "npc.h" #include "functions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; + /*0x6a*/ u8 unused[26]; + /*0x84*/ u32* unk_84; +} SittingPersonEntity; + const SpriteLoadData gUnk_0810CB78[] = { { 63, 61, 4 }, { 8255, 61, 4 }, { 0, 0, 0 }, { 62, 61, 4 }, { 8255, 61, 4 }, { 0, 0, 0 }, { 64, 61, 4 }, { 8254, 61, 4 }, { 0, 0, 0 }, { 64, 61, 4 }, { 8256, 61, 4 }, { 0, 0, 0 }, @@ -10,10 +25,10 @@ const FrameStruct gUnk_0810CBC0[] = { { 4, 0 }, { 0, 0 }, { 12, 0 }, { 0, 0 }, { 20, 0 }, { 0, 0 }, { 28, 1 }, { 0, 0 }, { 36, 1 }, { 0, 0 }, { 44, 0 }, { 0, 0 }, }; -void SittingPersion_Init(Entity*); -void sub_080637B8(Entity*); -void sub_08063830(Entity*); -void (*const SittingPersion_Actions[])(Entity*) = { +void SittingPersion_Init(SittingPersonEntity*); +void sub_080637B8(SittingPersonEntity*); +void sub_08063830(SittingPersonEntity*); +void (*const SittingPersion_Actions[])(SittingPersonEntity*) = { SittingPersion_Init, sub_080637B8, sub_08063830, @@ -106,55 +121,55 @@ const u8 gUnk_0810CD88[][4] = { }; extern void sub_08096208(Entity*, u32); -void sub_080637B8(Entity* this); +void sub_080637B8(SittingPersonEntity* this); -void SittingPerson(Entity* this) { - SittingPersion_Actions[this->action](this); +void SittingPerson(SittingPersonEntity* this) { + SittingPersion_Actions[super->action](this); } -void SittingPersion_Init(Entity* this) { - if (LoadExtraSpriteData(this, &gUnk_0810CB78[this->type * 3])) { - this->action = 1; - this->spriteSettings.flipX = this->timer; +void SittingPersion_Init(SittingPersonEntity* this) { + if (LoadExtraSpriteData(super, &gUnk_0810CB78[super->type * 3])) { + super->action = 1; + super->spriteSettings.flipX = super->timer; - if (this->spriteSettings.flipX == 0) { - this->animationState = 6; + if (super->spriteSettings.flipX == 0) { + super->animationState = 6; } else { - this->animationState = 2; + super->animationState = 2; } - this->timer = this->animationState; - this->field_0x68.HALF.HI = 0; - sub_0807DD50(this); + super->timer = super->animationState; + this->animIndex = 0; + InitScriptForNPC(super); sub_080637B8(this); } } -void sub_080637B8(Entity* this) { +void sub_080637B8(SittingPersonEntity* this) { u32 tmp; - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - tmp = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); - tmp += this->spriteSettings.flipX ? 4 : 0; - InitializeAnimation(this, tmp); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + tmp = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + tmp += super->spriteSettings.flipX ? 4 : 0; + InitializeAnimation(super, tmp); + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - if (this->frameDuration == 0xfe) { - this->frameDuration = (Random() & 0x1f) + 0x1e; + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + if (super->frameDuration == 0xfe) { + super->frameDuration = (Random() & 0x1f) + 0x1e; } - GetNextFrame(this); + GetNextFrame(super); } } -void sub_08063830(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); +void sub_08063830(SittingPersonEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitializeAnimation(super, this->animIndex); } } @@ -182,7 +197,7 @@ void sub_0806387C(Entity* this) { if (CheckLocalFlag(SHOP05_OPEN) == 0) { r5 = 0; for (r4 = 1; r4 <= 0x82; r4++) { - if (ReadBit(&gSave.stats.filler4[4], r4)) { + if (ReadBit(gSave.figurines, r4)) { r5++; } } @@ -210,7 +225,7 @@ void sub_0806390C(Entity* this) { if (CheckLocalFlag(MACHI_MES_60) == 0) { r5 = 0; SetLocalFlag(MACHI_MES_60); - (*(u32**)&this->cutsceneBeh)[0x5] = 1; + ((SittingPersonEntity*)this)->unk_84[5] = 1; } MessageNoOverlap(gUnk_0810CC04[r5], this); @@ -235,9 +250,9 @@ void SittingPerson_Head(Entity* this) { sub_0807000C(this); } -void SittingPerson_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void SittingPerson_MakeInteractable(SittingPersonEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void SittingPerson_Fusion(Entity* this) { diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 5bbe8040..99566202 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -1,11 +1,17 @@ -#include "global.h" +/** + * @file smallTownMinish.c + * @ingroup NPCs + * + * @brief Small Town Minish NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" -#include "script.h" -#include "save.h" -#include "npc.h" #include "functions.h" #include "item.h" +#include "npc.h" +#include "player.h" +#include "save.h" +#include "script.h" void SmallTownMinish(Entity* this) { static const Hitbox gUnk_081142FC = { -2, 1, { 0, 0, 0, 0 }, 6, 6 }; @@ -13,10 +19,10 @@ void SmallTownMinish(Entity* this) { if (this->action == 0) { this->action++; this->hitbox = (Hitbox*)&gUnk_081142FC; - sub_0807DD50(this); + InitScriptForNPC(this); SetInteractableObjectCollision(this, 1, 0, &gUnk_08114304); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } if ((gPlayerState.flags & PL_MINISH) != 0) { this->spriteSettings.draw = 1; diff --git a/src/npc/smith.c b/src/npc/smith.c index bc5df016..61303812 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -1,5 +1,19 @@ -#include "npc.h" +/** + * @file smith.c + * @ingroup NPCs + * + * @brief Smith NPC + */ +#define NENT_DEPRECATED #include "functions.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unused[23]; + /*0x80*/ u16 unk_80; +} SmithEntity; static const SpriteLoadData gUnk_08110354[] = { { 0x4d, 0x38, 0x4 }, @@ -7,22 +21,22 @@ static const SpriteLoadData gUnk_08110354[] = { { 0, 0, 0 }, }; -void sub_080660EC(Entity*); -void sub_08066118(Entity*); -void sub_08066170(Entity*); -void sub_08066178(Entity*); -void sub_080661B0(Entity*); -void sub_080661BC(Entity*); -void sub_08066200(Entity*); -void sub_08066218(Entity*); +void sub_080660EC(SmithEntity*); +void sub_08066118(SmithEntity*); +void sub_08066170(SmithEntity*); +void sub_08066178(SmithEntity*); +void sub_080661B0(SmithEntity*); +void sub_080661BC(SmithEntity*); +void sub_08066200(SmithEntity*); +void sub_08066218(SmithEntity*); -void Smith(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Smith(SmithEntity* this) { + static void (*const actionFuncs[])(SmithEntity*) = { sub_080660EC, sub_08066118, sub_08066170, }; - static void (*const scriptedActionFuncs[])(Entity*) = { + static void (*const scriptedActionFuncs[])(SmithEntity*) = { sub_08066178, sub_080661B0, sub_080661BC, sub_08066200, sub_08066218, }; static const u16 gUnk_08110380[] = { @@ -30,28 +44,28 @@ void Smith(Entity* this) { }; u32 index; - if ((this->flags & ENT_SCRIPTED) != 0) { - if (this->interactType == 2) { - this->action = 4; - this->interactType = 0; - index = (this->animIndex == 0xc) ? 8 : 0; - index += sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); - InitAnimationForceUpdate(this, index); - sub_0806F118(this); + if ((super->flags & ENT_SCRIPTED) != 0) { + if (super->interactType == INTERACTION_FUSE) { + super->action = 4; + super->interactType = INTERACTION_NONE; + index = (super->animIndex == 0xc) ? 8 : 0; + index += GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + InitAnimationForceUpdate(super, index); + InitializeNPCFusion(super); } - scriptedActionFuncs[this->action](this); + scriptedActionFuncs[super->action](this); } else { - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](this); + sub_0806ED78(super); } - if (this->animIndex == 0xc) { - this->spritePriority.b1 = 0; + if (super->animIndex == 0xc) { + super->spritePriority.b1 = 0; } else { - this->spritePriority.b1 = 1; + super->spritePriority.b1 = 1; } - if ((this->frame & 1) != 0) { - this->frame &= 0xfe; - CreateFx(this, FX_STARS2, 0x20); + if ((super->frame & 1) != 0) { + super->frame &= 0xfe; + CreateFx(super, FX_STARS2, 0x20); SoundReq(gUnk_08110380[(Random() & 7)]); } } @@ -70,75 +84,75 @@ void Smith_Head(Entity* this) { sub_0807000C(this); } -void sub_080660EC(Entity* this) { - if (LoadExtraSpriteData(this, gUnk_08110354)) { - this->action = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - InitAnimationForceUpdate(this, 2); +void sub_080660EC(SmithEntity* this) { + if (LoadExtraSpriteData(super, gUnk_08110354)) { + super->action = 1; + this->fusionOffer = GetFusionToOffer(super); + InitAnimationForceUpdate(super, 2); } } -void sub_08066118(Entity* this) { +void sub_08066118(SmithEntity* this) { s32 uVar1; - uVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28); + uVar1 = GetAnimationStateInRectRadius(super, 0x28, 0x28); if (uVar1 < 0) { uVar1 = 2; } else { - if (this->subtimer == 0) { - this->subtimer = 16; + if (super->subtimer == 0) { + super->subtimer = 16; } else { - --this->subtimer; - uVar1 = this->animIndex; + --super->subtimer; + uVar1 = super->animIndex; } } - if (sub_0806F078(this, uVar1) == 0) { - UpdateAnimationSingleFrame(this); + if (sub_0806F078(super, uVar1) == 0) { + UpdateAnimationSingleFrame(super); } - if (this->interactType != 0) { - this->action = 2; + if (super->interactType != INTERACTION_NONE) { + super->action = 2; MessageFromTarget(0); } } -void sub_08066170(Entity* this) { - this->action = 1; +void sub_08066170(SmithEntity* this) { + super->action = 1; } -void sub_08066178(Entity* this) { - if (LoadExtraSpriteData(this, gUnk_08110354)) { - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_0807DD50(this); +void sub_08066178(SmithEntity* this) { + if (LoadExtraSpriteData(super, gUnk_08110354)) { + super->action = 1; + super->spriteSettings.draw = 1; + this->fusionOffer = GetFusionToOffer(super); + InitScriptForNPC(super); } } -void sub_080661B0(Entity* this) { - sub_0807DD94(this, NULL); +void sub_080661B0(SmithEntity* this) { + ExecuteScriptAndHandleAnimation(super, NULL); } -void sub_080661BC(Entity* this) { - if (this->animIndex == 0xc) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { - this->field_0x80.HWORD = GetAnimationState(this) + 8; - InitAnimationForceUpdate(this, this->field_0x80.HWORD); +void sub_080661BC(SmithEntity* this) { + if (super->animIndex == 0xc) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { + this->unk_80 = GetAnimationState(super) + 8; + InitAnimationForceUpdate(super, this->unk_80); } } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } } -void sub_08066200(Entity* this) { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - UpdateAnimationSingleFrame(this); +void sub_08066200(SmithEntity* this) { + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + UpdateAnimationSingleFrame(super); } -void sub_08066218(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; +void sub_08066218(SmithEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; } } @@ -210,8 +224,8 @@ void Smith_ChangeInteractableHitbox(Entity* this) { SetInteractableObjectCollision(this, 1, 0, &gUnk_081103E0); } -void Smith_MakeInteractable(Entity* this) { - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Smith_MakeInteractable(SmithEntity* this) { + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Smith_Fusion(Entity* this) { diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 0ac805ec..380e5be4 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -1,10 +1,16 @@ -#include "global.h" -#include "entity.h" -#include "message.h" -#include "functions.h" +/** + * @file stamp.c + * @ingroup NPCs + * + * @brief Stamp NPC + */ +#define NENT_DEPRECATED #include "effects.h" -#include "npc.h" +#include "entity.h" +#include "functions.h" #include "kinstone.h" +#include "message.h" +#include "npc.h" void sub_08062CA4(Entity*); void sub_08062BD4(Entity*); @@ -13,7 +19,7 @@ void sub_08062C24(Entity*); void sub_08062C54(Entity*); void sub_08062C7C(Entity*); -void Stamp(Entity* ent) { +void Stamp(Entity* this) { static void (*const actionFuncs[4])(Entity*) = { sub_08062BD4, sub_08062BF8, @@ -24,62 +30,62 @@ void Stamp(Entity* ent) { sub_08062C7C, sub_08062CA4, }; - if ((ent->flags & ENT_SCRIPTED) != 0) { - scriptedActionFuncs[ent->action](ent); + if ((this->flags & ENT_SCRIPTED) != 0) { + scriptedActionFuncs[this->action](this); } else { - actionFuncs[ent->action](ent); + actionFuncs[this->action](this); } } -void sub_08062BD4(Entity* ent) { - ent->action = 1; - ent->spriteSettings.draw = 1; - InitializeAnimation(ent, 0); - AddInteractableWhenBigObject(ent); +void sub_08062BD4(Entity* this) { + this->action = 1; + this->spriteSettings.draw = 1; + InitializeAnimation(this, 0); + AddInteractableWhenBigObject(this); } -void sub_08062BF8(Entity* ent) { - GetNextFrame(ent); - if (ent->interactType != 0) { - ent->interactType = 0; - ent->action++; - RequestPriority(ent); +void sub_08062BF8(Entity* this) { + GetNextFrame(this); + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; + this->action++; + RequestPriority(this); } - sub_0806ED78(ent); + sub_0806ED78(this); } -void sub_08062C24(Entity* ent) { - GetNextFrame(ent); - if ((ent->frame & 128) != 0) { - InitializeAnimation(ent, 4); +void sub_08062C24(Entity* this) { + GetNextFrame(this); + if ((this->frame & 128) != 0) { + InitializeAnimation(this, 4); MessageFromTarget(TEXT_INDEX(TEXT_EMPTY, 0x01)); - ent->action++; + this->action++; } } -void sub_08062C54(Entity* ent) { +void sub_08062C54(Entity* this) { if ((gMessage.doTextBox & 127) == 0) { - ent->action = 1; - InitializeAnimation(ent, 0); - RevokePriority(ent); + this->action = 1; + InitializeAnimation(this, 0); + RevokePriority(this); } } -void sub_08062C7C(Entity* ent) { - ent->action = 1; - sub_0807DD64(ent); - InitializeAnimation(ent, 0); - CreateFx(ent, FX_SWEAT, 0); - sub_08062CA4(ent); +void sub_08062C7C(Entity* this) { + this->action = 1; + sub_0807DD64(this); + InitializeAnimation(this, 0); + CreateFx(this, FX_SWEAT, 0); + sub_08062CA4(this); } -void sub_08062CA4(Entity* ent) { - ExecuteScriptForEntity(ent, NULL); - HandleEntity0x82Actions(ent); - GetNextFrame(ent); +void sub_08062CA4(Entity* this) { + ExecuteScriptForEntity(this, NULL); + HandleEntity0x82Actions(this); + GetNextFrame(this); } -void sub_08062CBC(Entity* ent) { +void sub_08062CBC(Entity* this) { static const Dialog gUnk_0810C2E4[2] = { { 0, DIALOG_ROOM_FLAG, DIALOG_TOGGLE_FLAG, 1, { TEXT_INDEX(TEXT_POST, 0x1), TEXT_INDEX(TEXT_POST, 0x0) } }, { 0, DIALOG_ROOM_FLAG, DIALOG_TOGGLE_FLAG, 1, { TEXT_INDEX(TEXT_POST, 0x3), TEXT_INDEX(TEXT_POST, 0x2) } }, @@ -90,11 +96,11 @@ void sub_08062CBC(Entity* ent) { } else { uVar1 = 0; } - ShowNPCDialogue(ent, &gUnk_0810C2E4[uVar1]); + ShowNPCDialogue(this, &gUnk_0810C2E4[uVar1]); } -void sub_08062CE0(Entity* ent) { - if (ent->action == 0) { - ent->action = 1; +void sub_08062CE0(Entity* this) { + if (this->action == 0) { + this->action = 1; } } diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 7230bd7a..3560137b 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -1,28 +1,41 @@ +/** + * @file stockwell.c + * @ingroup NPCs + * + * @brief Stockwell NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "script.h" -#include "room.h" -#include "message.h" #include "functions.h" +#include "game.h" +#include "item.h" +#include "message.h" #include "npc.h" #include "object.h" -#include "item.h" -#include "game.h" +#include "room.h" +#include "script.h" #ifndef EU static const Rect gUnk_0810FDA0 = { 0, 8, 10, 16 }; #endif +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[28]; + /*0x84*/ ScriptExecutionContext* context; +} StockwellEntity; + extern u16 script_StockwellBuy[]; extern u16 script_StockwellDogFood[]; extern void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script); extern u16 script_Stockwell; -void sub_08065080(Entity*); -void sub_080650CC(Entity*); -void sub_080651AC(Entity*); -void sub_080651D8(Entity*); -void sub_08065368(Entity*); +void sub_08065080(StockwellEntity*); +void sub_080650CC(StockwellEntity*); +void sub_080651AC(StockwellEntity*); +void sub_080651D8(StockwellEntity*); +void sub_08065368(StockwellEntity*); void sub_080651F8(Entity*); void sub_0806522C(Entity*); void sub_08065250(Entity*); @@ -32,82 +45,82 @@ void sub_080652E4(Entity*); void sub_08065314(Entity*); void sub_08065338(Entity*); -void Stockwell(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Stockwell(StockwellEntity* this) { + static void (*const actionFuncs[])(StockwellEntity*) = { sub_08065080, sub_080650CC, sub_080651AC, sub_080651D8, sub_08065368, }; - actionFuncs[this->action](this); - ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh); - sub_0806ED78(this); + actionFuncs[super->action](this); + ExecuteScript(super, this->context); + sub_0806ED78(super); } -void sub_08065080(Entity* this) { +void sub_08065080(StockwellEntity* this) { ScriptExecutionContext* context; - this->action = 1; - this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); - InitializeAnimation(this, 4); - AddInteractableWhenBigObject(this); + super->action = 1; + super->spriteSettings.draw = 1; + SetDefaultPriority(super, PRIO_MESSAGE); + InitializeAnimation(super, 4); + AddInteractableWhenBigObject(super); #ifndef EU - SetInteractableObjectCollision(this, 0, 0, &gUnk_0810FDA0); + SetInteractableObjectCollision(super, 0, 0, &gUnk_0810FDA0); #endif - context = StartCutscene(this, &script_Stockwell); - *(ScriptExecutionContext**)&this->cutsceneBeh = context; + context = StartCutscene(super, &script_Stockwell); + this->context = context; } -void sub_080650CC(Entity* this) { +void sub_080650CC(StockwellEntity* this) { static const u8 gUnk_0810FDB8[] = { 4, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 5 }; u32 bVar2; u32 confirmMsgId; u32 itemPrice; if ((gRoomVars.animFlags & 1)) { - this->action = 4; - this->subAction = 0; - InitScriptExecutionContext(*(ScriptExecutionContext**)&this->cutsceneBeh, script_StockwellDogFood); + super->action = 4; + super->subAction = 0; + InitScriptExecutionContext(this->context, script_StockwellDogFood); } else { - bVar2 = this->frame & 0x20; - if ((bVar2 == 0) && (this->interactType != 0)) { - this->interactType = bVar2; - this->action++; - InitializeAnimation(this, 7); + bVar2 = super->frame & 0x20; + if ((bVar2 == 0) && (super->interactType != INTERACTION_NONE)) { + super->interactType = bVar2; + super->action++; + InitializeAnimation(super, 7); if (gRoomVars.shopItemType == 0) { confirmMsgId = TEXT_INDEX(TEXT_STOCKWELL, 0x1); } else { confirmMsgId = GetSaleItemConfirmMessageID(gRoomVars.shopItemType); itemPrice = GetItemPrice(gRoomVars.shopItemType); - this->action = 4; - this->subAction = bVar2; - InitScriptExecutionContext(*(ScriptExecutionContext**)&this->cutsceneBeh, script_StockwellBuy); + super->action = 4; + super->subAction = bVar2; + InitScriptExecutionContext(this->context, script_StockwellBuy); } - MessageNoOverlap(confirmMsgId, this); + MessageNoOverlap(confirmMsgId, super); //! @bug itemPrice (r8) is not initialized if gRoomVars.shopItemType == 0 gMessage.rupees = (u16)itemPrice; - } else if ((this->frame & 0x40)) { - InitializeAnimation(this, gUnk_0810FDB8[Random() & 0xf]); + } else if ((super->frame & 0x40)) { + InitializeAnimation(super, gUnk_0810FDB8[Random() & 0xf]); } else { - GetNextFrame(this); + GetNextFrame(super); } } } -void sub_080651AC(Entity* this) { - GetNextFrame(this); +void sub_080651AC(StockwellEntity* this) { + GetNextFrame(super); if ((gMessage.doTextBox & 0x7f) == 0) { - this->interactType = gMessage.doTextBox & 0x7f; - this->action = 1; - InitializeAnimation(this, 4); + super->interactType = gMessage.doTextBox & 0x7f; + super->action = 1; + InitializeAnimation(super, 4); } } -void sub_080651D8(Entity* this) { +void sub_080651D8(StockwellEntity* this) { static void (*const subActionFuncs[])(Entity*) = { sub_080651F8, sub_0806522C, sub_08065250, sub_0806528C, sub_080652B0, sub_080652E4, sub_08065314, sub_08065338, }; - GetNextFrame(this); - subActionFuncs[this->subAction](this); + GetNextFrame(super); + subActionFuncs[super->subAction](super); } void sub_080651F8(Entity* this) { @@ -186,8 +199,8 @@ void sub_08065338(Entity* this) { } } -void sub_08065368(Entity* this) { - GetNextFrame(this); +void sub_08065368(StockwellEntity* this) { + GetNextFrame(super); } void sub_08065370(Entity* this, ScriptExecutionContext* context) { @@ -222,10 +235,10 @@ void sub_08065370(Entity* this, ScriptExecutionContext* context) { } break; case ITEM_WALLET: - localFlag = 0x55; + localFlag = SHOP00_SAIFU; break; case ITEM_LARGE_QUIVER: - localFlag = 0x56; + localFlag = SHOP00_YAZUTSU; break; #ifndef EU case ITEM_BOMBBAG: @@ -251,11 +264,11 @@ void sub_08065370(Entity* this, ScriptExecutionContext* context) { if (localFlag) { SetLocalFlag(localFlag); } - if (gSave.unk5C <= -2) { - gSave.unk5C++; + if (gSave.items_bought <= ~1u) { + gSave.items_bought++; } - if (gSave.unk5C >= 10) { + if (gSave.items_bought >= 10) { context->intVariable = TEXT_INDEX(TEXT_STOCKWELL, 0x11); } else { if (itemPrice >= 100) { diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 05416de9..6367bf76 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -1,19 +1,31 @@ +/** + * @file sturgeon.c + * @ingroup NPCs + * + * @brief Sturgeon NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" +#include "item.h" #include "npc.h" #include "object.h" -#include "item.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} SturgeonEntity; const SpriteLoadData gUnk_0810FA38[] = { { 59, 140, 0 }, { 59, 140, 0 }, { 0, 0, 0 }, }; -void sub_08064B44(Entity*); -void sub_08064B88(Entity*); -void sub_08064C2C(Entity*); -void sub_08064C50(Entity*); -void (*const gUnk_0810FA44[])(Entity*) = { +void sub_08064B44(SturgeonEntity*); +void sub_08064B88(SturgeonEntity*); +void sub_08064C2C(SturgeonEntity*); +void sub_08064C50(SturgeonEntity*); +void (*const gUnk_0810FA44[])(SturgeonEntity*) = { sub_08064B44, sub_08064B88, sub_08064C2C, @@ -28,102 +40,103 @@ extern const u16 gUnk_0810FA54[]; // }; extern u32 gUnk_0810FA5A; // TODO second parameter of sub_0806EE04 -void Sturgeon_MakeInteractable(Entity* this); +void Sturgeon_MakeInteractable(SturgeonEntity* this); void sub_08064C9C(Entity* this); void sub_08064CD8(Entity* this); -void Sturgeon(Entity* this) { - if ((this->flags & ENT_SCRIPTED) == 0) { - gUnk_0810FA44[this->action](this); - sub_0806ED78(this); +void Sturgeon(SturgeonEntity* this) { + if ((super->flags & ENT_SCRIPTED) == 0) { + gUnk_0810FA44[super->action](this); + sub_0806ED78(super); } else { - if (this->action == 0) { - if (LoadExtraSpriteData(this, gUnk_0810FA38)) { - this->action = 1; - this->timer = 0; - sub_0807DD50(this); + if (super->action == 0) { + if (LoadExtraSpriteData(super, gUnk_0810FA38)) { + super->action = 1; + super->timer = 0; + InitScriptForNPC(super); } } else { - u32 tmp = this->action & 0x80; + u32 tmp = super->action & 0x80; if (tmp) { - if (UpdateFuseInteraction(this)) { - this->action = 1; + if (UpdateFuseInteraction(super)) { + super->action = 1; } } else { - if (this->interactType == 2) { - this->action = this->action | 0xff; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = super->action | 0xff; + super->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); - sub_08064C9C(this); + ExecuteScriptAndHandleAnimation(super, NULL); + sub_08064C9C(super); } } } } } -void sub_08064B44(Entity* this) { - if (LoadExtraSpriteData(this, gUnk_0810FA38)) { - InitializeAnimation(this, 2); - sub_0806EE04(this, &gUnk_0810FA5A, 0); +void sub_08064B44(SturgeonEntity* this) { + if (LoadExtraSpriteData(super, gUnk_0810FA38)) { + InitializeAnimation(super, 2); + sub_0806EE04(super, &gUnk_0810FA5A, 0); Sturgeon_MakeInteractable(this); - this->action = 1; - this->subAction = 0; - this->spriteSettings.draw = 1; + super->action = 1; + super->subAction = 0; + super->spriteSettings.draw = 1; } } -void sub_08064B88(Entity* this) { +void sub_08064B88(SturgeonEntity* this) { s32 temp; s32 temp2; - switch (this->interactType) { - case 0: - temp = sub_0806EE20(this); - this->animationState = this->knockbackDirection; + switch (super->interactType) { + case INTERACTION_NONE: + temp = sub_0806EE20(super); + super->animationState = super->knockbackDirection; if (temp != 0) { - InitializeAnimation(this, temp & 0x7f); + InitializeAnimation(super, temp & 0x7f); } - GetNextFrame(this); + GetNextFrame(super); break; - case 2: - this->action = 3; - temp2 = GetAnimationState(this); + case INTERACTION_FUSE: + super->action = 3; + temp2 = GetAnimationState(super); if (temp2 < 0) { - temp2 = this->animationState; + temp2 = super->animationState; } - this->subtimer = this->animIndex; - InitializeAnimation(this, temp2); - this->interactType = 0; - sub_0806F118(this); + super->subtimer = super->animIndex; + InitializeAnimation(super, temp2); + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); break; - case 1: + case INTERACTION_TALK: default: - this->action = 2; - temp2 = GetAnimationState(this); + super->action = 2; + temp2 = GetAnimationState(super); if (temp2 < 0) { - temp2 = this->animationState; + temp2 = super->animationState; } - this->subtimer = this->animIndex; - InitializeAnimation(this, temp2); - this->interactType = 0; - sub_08064CD8(this); + super->subtimer = super->animIndex; + InitializeAnimation(super, temp2); + super->interactType = INTERACTION_NONE; + sub_08064CD8(super); } } -void sub_08064C2C(Entity* this) { +void sub_08064C2C(SturgeonEntity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { - this->action = 1; - InitializeAnimation(this, (u32)this->subtimer); + super->action = 1; + InitializeAnimation(super, (u32)super->subtimer); } } -void sub_08064C50(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitializeAnimation(this, this->subtimer); +void sub_08064C50(SturgeonEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitializeAnimation(super, super->subtimer); } } @@ -140,9 +153,9 @@ void sub_08064C9C(Entity* this) { } } -void Sturgeon_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Sturgeon_MakeInteractable(SturgeonEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void sub_08064CD8(Entity* this) { diff --git a/src/npc/syrup.c b/src/npc/syrup.c index 1668d4f7..ae1f8eb1 100644 --- a/src/npc/syrup.c +++ b/src/npc/syrup.c @@ -1,7 +1,20 @@ -#include "npc.h" +/** + * @file syrup.c + * @ingroup NPCs + * + * @brief Syrup NPC + */ +#define NENT_DEPRECATED #include "functions.h" +#include "npc.h" #include "object.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[26]; + /*0x82*/ u16 unk_82; +} SyrupEntity; + static const SpriteLoadData gUnk_081121B4[] = { { 0xc2, 0x46, 0x4 }, { 0x44c2, 0x46, 0x4 }, @@ -16,38 +29,38 @@ static const SpriteLoadData gUnk_081121C4[] = { }; void sub_0806A26C(Entity*); -void sub_0806A1F8(Entity*); -void sub_0806A234(Entity*); +void sub_0806A1F8(SyrupEntity*); +void sub_0806A234(SyrupEntity*); -void Syrup(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Syrup(SyrupEntity* this) { + static void (*const actionFuncs[])(SyrupEntity*) = { sub_0806A1F8, sub_0806A234, }; - actionFuncs[this->action](this); - sub_0806ED78(this); + actionFuncs[super->action](this); + sub_0806ED78(super); } -void sub_0806A1F8(Entity* this) { +void sub_0806A1F8(SyrupEntity* this) { const SpriteLoadData* paVar2; - this->type == 0 ? (paVar2 = gUnk_081121B4) : (paVar2 = gUnk_081121C4); + super->type == 0 ? (paVar2 = gUnk_081121B4) : (paVar2 = gUnk_081121C4); - if (LoadExtraSpriteData(this, paVar2)) { - this->action = 1; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); - InitializeAnimation(this, 0); + if (LoadExtraSpriteData(super, paVar2)) { + super->action = 1; + SetDefaultPriority(super, PRIO_MESSAGE); + InitScriptForNPC(super); + InitializeAnimation(super, 0); } } -void sub_0806A234(Entity* this) { - sub_0807DD94(this, 0); - if ((this->field_0x82.HWORD & 4) != 0) { +void sub_0806A234(SyrupEntity* this) { + ExecuteScriptAndHandleAnimation(super, NULL); + if ((this->unk_82 & 4) != 0) { if ((gRoomTransition.frameCount & 7) == 0) { - sub_0806A26C(this); + sub_0806A26C(super); } - sub_080042BA(this, 2); + sub_080042BA(super, 2); } } diff --git a/src/npc/talon.c b/src/npc/talon.c index dc86ba85..4b62dd22 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -1,6 +1,22 @@ -#include "npc.h" +/** + * @file talon.c + * @ingroup NPCs + * + * @brief Talon NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "item.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unk_69; + /*0x6a*/ u8 unk_6a; + /*0x6b*/ u8 unused[25]; + /*0x84*/ u32 unk_84; +} TalonEntity; static const SpriteLoadData gUnk_0810FEB0[] = { { 0x4b, 0x8b, 0 }, @@ -10,27 +26,27 @@ static const SpriteLoadData gUnk_0810FEB0[] = { extern u8 script_TalonGotKey; -void sub_0806574C(Entity* this); +void sub_0806574C(TalonEntity* this); void sub_08065570(Entity* this); void sub_0806559C(Entity* this); -void sub_08065608(Entity* this); -void sub_08065648(Entity* this); -void sub_080656D4(Entity* this); -void sub_080656A4(Entity* this); -void sub_08065680(Entity* this); +void sub_08065608(TalonEntity* this); +void sub_08065648(TalonEntity* this); +void sub_080656D4(TalonEntity* this); +void sub_080656A4(TalonEntity* this); +void sub_08065680(TalonEntity* this); -void Talon(Entity* this) { - static void (*const actionFuncs[])(Entity * this) = { +void Talon(TalonEntity* this) { + static void (*const actionFuncs[])(Entity*) = { sub_08065570, sub_0806559C, }; - static void (*const scriptedActionFuncs[])(Entity * this) = { + static void (*const scriptedActionFuncs[])(TalonEntity*) = { sub_08065608, sub_08065648, sub_080656D4, sub_080656A4, sub_08065680, }; - if (this->flags & ENT_SCRIPTED) { - scriptedActionFuncs[this->action](this); + if (super->flags & ENT_SCRIPTED) { + scriptedActionFuncs[super->action](this); } else { - actionFuncs[this->action](this); + actionFuncs[super->action](super); } } @@ -68,80 +84,80 @@ void sub_0806559C(Entity* this) { GetNextFrame(this); } sub_0806ED78(this); - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; ResetPlayerAnimationAndAction(); } } -void sub_08065608(Entity* this) { - if (LoadExtraSpriteData(this, gUnk_0810FEB0)) { - this->action = 1; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); - sub_0807DD50(this); +void sub_08065608(TalonEntity* this) { + if (LoadExtraSpriteData(super, gUnk_0810FEB0)) { + super->action = 1; + super->spriteSettings.draw = 1; + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); + InitScriptForNPC(super); } } -void sub_08065648(Entity* this) { - if (this->interactType == 2) { - this->field_0x68.HALF.HI = this->action; - this->action = 4; - this->interactType = 0; - sub_0806F118(this); +void sub_08065648(TalonEntity* this) { + if (super->interactType == INTERACTION_FUSE) { + this->unk_69 = super->action; + super->action = 4; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } } -void sub_08065680(Entity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = this->field_0x68.HALF.HI; - InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO); +void sub_08065680(TalonEntity* this) { + if (UpdateFuseInteraction(super) != 0) { + super->action = this->unk_69; + InitAnimationForceUpdate(super, this->unk_6a); } } -void sub_080656A4(Entity* this) { +void sub_080656A4(TalonEntity* this) { if ((gMessage.doTextBox & 0x7F) == 0) { - this->action = this->field_0x68.HALF.HI; - InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO); + super->action = this->unk_69; + InitAnimationForceUpdate(super, this->unk_6a); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void sub_080656D4(Entity* this) { - if (this->interactType == 2) { - this->field_0x68.HALF.HI = this->action; - this->action = 4; - this->interactType = 0; - sub_0806F118(this); +void sub_080656D4(TalonEntity* this) { + if (super->interactType == INTERACTION_FUSE) { + this->unk_69 = super->action; + super->action = 4; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); sub_0806574C(this); } else { - if (this->interactType != 0) { + if (super->interactType != INTERACTION_NONE) { if (GetInventoryValue(ITEM_QST_LONLON_KEY) != 0) { - StartCutscene(this, (u16*)&script_TalonGotKey); + StartCutscene(super, (u16*)&script_TalonGotKey); } else { - this->field_0x68.HALF.HI = this->action; - this->action = 3; - this->interactType = 0; - MessageNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this); + this->unk_69 = super->action; + super->action = 3; + super->interactType = INTERACTION_NONE; + MessageNoOverlap(*(u32*)(*(u32*)&this->unk_84 + 4), super); sub_0806574C(this); return; } } - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } } -void sub_0806574C(Entity* this) { +void sub_0806574C(TalonEntity* this) { u32 j; - j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); - if (this->animIndex != j) { - InitAnimationForceUpdate(this, j); + j = (super->animIndex & ~3) + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + if (super->animIndex != j) { + InitAnimationForceUpdate(super, j); } - this->field_0x6a.HALF.LO = this->animIndex; + this->unk_6a = super->animIndex; } void sub_08065780(Entity* this, ScriptExecutionContext* context) { diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 05e0d3f6..52ea9b4f 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -1,50 +1,62 @@ -#include "global.h" +/** + * @file teachers.c + * @ingroup NPCs + * + * @brief Teachers NPC + */ +#define NENT_DEPRECATED #include "entity.h" +#include "npc.h" #include "player.h" #include "save.h" #include "script.h" -#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 animIndex; +} TeachersEntity; static const SpriteLoadData gUnk_08113910[] = { { 0x103, 0x4f, 0x4 }, { 0x2103, 0x4f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0x50, 0x4 }, { 0x2002, 0x50, 0x4 }, { 0x4000, 0x50, 0x4 }, { 0, 0, 0 }, }; -void Teachers(Entity* this) { - switch (this->action) { +void Teachers(TeachersEntity* this) { + switch (super->action) { case 0: - if (LoadExtraSpriteData(this, &gUnk_08113910[this->type * 4])) { - this->action = 1; - this->spriteSettings.draw = TRUE; - this->animationState = this->timer; - this->field_0x68.HALF.HI = 0; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + if (LoadExtraSpriteData(super, &gUnk_08113910[super->type * 4])) { + super->action = 1; + super->spriteSettings.draw = TRUE; + super->animationState = super->timer; + this->animIndex = 0; + SetDefaultPriority(super, PRIO_MESSAGE); + InitScriptForNPC(super); } break; case 1: - if (this->interactType == 2) { - this->action = 2; - this->interactType = 0; - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, - (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + this->animIndex = super->animIndex; + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( + GetFacingDirection(super, &gPlayerEntity))); + InitializeNPCFusion(super); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(super, NULL); } break; case 2: - if (UpdateFuseInteraction(this)) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + if (UpdateFuseInteraction(super)) { + super->action = 1; + InitializeAnimation(super, this->animIndex); } } } -void Teachers_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Teachers_MakeInteractable(TeachersEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void Teachers_Head(Entity* this) { diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index 1d5cfabf..cd113f45 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -1,9 +1,20 @@ -#include "global.h" +/** + * @file tingleSiblings.c + * @ingroup NPCs + * + * @brief Tingle Siblings NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "npc.h" #include "functions.h" #include "item.h" #include "kinstone.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} TingleSiblingsEntity; extern void sub_08064DE4(Entity*); extern void sub_08064D78(Entity*); @@ -32,7 +43,7 @@ void sub_08064D90(Entity* this) { void sub_08064DA0(Entity* this) { sub_08064EE8(this); - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { this->action = 2; InitAnimationForceUpdate(this, 6); MessageFromTarget(0); @@ -53,16 +64,17 @@ void sub_08064DE4(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; this->animationState = 4; - sub_0807DD50(this); + InitScriptForNPC(this); break; case 1: - if (this->interactType == 2) { + if (this->interactType == INTERACTION_FUSE) { this->action = 2; - this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); - sub_0806F118(this); + this->interactType = INTERACTION_NONE; + InitAnimationForceUpdate(this, + GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity))); + InitializeNPCFusion(this); } else { - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } break; case 2: @@ -83,28 +95,28 @@ void sub_08064DE4(Entity* this) { } } -void TingleSiblings_MakeInteractable(Entity* this) { - this->field_0x68.HALF.LO = GetFusionToOffer(this); - switch (this->type) { +void TingleSiblings_MakeInteractable(TingleSiblingsEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + switch (super->type) { case 0: if ((CheckKinstoneFused(KINSTONE_59) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) { - this->field_0x68.HALF.LO = 0; + this->fusionOffer = 0; } break; case 3: if ((CheckKinstoneFused(KINSTONE_5A) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) { - this->field_0x68.HALF.LO = 0; + this->fusionOffer = 0; } break; default: break; } - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void sub_08064EE8(Entity* this) { u32 bVar1; - Entity* fxEnt; + Entity* fxEntity; u32 confettiFx; UpdateAnimationSingleFrame(this); @@ -117,9 +129,9 @@ void sub_08064EE8(Entity* this) { confettiFx = FX_CONFETTI_LARGE; } - fxEnt = CreateFx(this, confettiFx, 0); - if ((fxEnt != NULL) && (bVar1 == 2)) { - fxEnt->spriteSettings.flipX = 1; + fxEntity = CreateFx(this, confettiFx, 0); + if ((fxEntity != NULL) && (bVar1 == 2)) { + fxEntity->spriteSettings.flipX = 1; } } } @@ -134,7 +146,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) { context->condition = 0; roomFlag = gUnk_0810FC50[this->type]; if (CheckRoomFlag(roomFlag) == 0) { - bVar2 = gSave.fuserProgress[GetFuserId(this)]; + bVar2 = gSave.kinstones.fuserProgress[GetFuserId(this)]; if (bVar2 >= 2) { uVar5 = 3; } else { @@ -151,7 +163,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) { remainingFusions = -1; } else { if (CheckGlobalFlag(KAKERA_COMPLETE) == 0) { - remainingFusions = 100 - gSave.fusedKinstoneCount; + remainingFusions = 100 - gSave.kinstones.fusedCount; if (remainingFusions < 1) { uVar5 = 8; remainingFusions = 0; diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index c0bbaad2..a55e609c 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -1,3 +1,10 @@ +/** + * @file townMinish.c + * @ingroup NPCs + * + * @brief Town Minish NPC + */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" @@ -5,11 +12,22 @@ #include "npc.h" #include "tiles.h" -void sub_0806ACC4(Entity*); -void sub_0806ABFC(Entity*); -void sub_0806AC3C(Entity*); -void sub_0806AEA8(Entity*); -void sub_0806AEE4(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unk_69; + /*0x6a*/ u8 unk_6a; + /*0x6b*/ u8 unused[23]; + /*0x82*/ u16 unk_82; + /*0x84*/ ScriptExecutionContext* context; +} TownMinishEntity; + +extern u32 sub_080B1AC8(u32, u32, u32); +void sub_0806ACC4(TownMinishEntity*); +void sub_0806ABFC(TownMinishEntity*); +void sub_0806AC3C(TownMinishEntity*); +void sub_0806AEA8(TownMinishEntity*); +void sub_0806AEE4(TownMinishEntity*); void sub_0806AFE8(Entity*, ScriptExecutionContext*); void sub_0806B004(Entity*, ScriptExecutionContext*); void sub_0806B098(Entity*, ScriptExecutionContext*); @@ -137,98 +155,99 @@ static const Rect gUnk_081126D4[4] = { }; static const u8 gUnk_081126E4[4] = { 0x0e, 0x0d, 0x0b, 0x07 }; -void TownMinish(Entity* this) { - static void (*const scriptedActionFuncs[])(Entity*) = { +void TownMinish(TownMinishEntity* this) { + static void (*const scriptedActionFuncs[])(TownMinishEntity*) = { sub_0806ABFC, sub_0806AC3C, }; - if ((this->flags & ENT_SCRIPTED) == 0) { - scriptedActionFuncs[this->action](this); - sub_0806ED78(this); + if ((super->flags & ENT_SCRIPTED) == 0) { + scriptedActionFuncs[super->action](this); + sub_0806ED78(super); } else { sub_0806ACC4(this); } } -void sub_0806ABFC(Entity* this) { - const SpriteLoadData* SpriteLoadData = gUnk_08112674[this->type]; - if (!LoadExtraSpriteData(this, SpriteLoadData)) { +void sub_0806ABFC(TownMinishEntity* this) { + const SpriteLoadData* SpriteLoadData = gUnk_08112674[super->type]; + if (!LoadExtraSpriteData(super, SpriteLoadData)) { return; } - InitializeAnimation(this, 2); - this->action = 1; - this->field_0x6a.HALF.LO = this->timer; + InitializeAnimation(super, 2); + super->action = 1; + this->unk_6a = super->timer; - this->animationState = this->field_0x6a.HALF.LO << 1; - this->field_0x68.HALF.HI = this->animationState * 4; + super->animationState = this->unk_6a << 1; + this->unk_69 = super->animationState * 4; - this->timer = 0; + super->timer = 0; } -void sub_0806AC3C(Entity* this) { - if (this->animIndex <= 3) { +void sub_0806AC3C(TownMinishEntity* this) { + if (super->animIndex <= 3) { s32 unk; Entity* link = &gPlayerEntity; - if (EntityInRectRadius(this, link, 0x18, 0x18)) { - unk = GetFacingDirection(this, link) & 0x1e; + if (EntityInRectRadius(super, link, 0x18, 0x18)) { + unk = GetFacingDirection(super, link) & 0x1e; } else { - unk = this->animationState * 4; + unk = super->animationState * 4; } - if (unk != this->field_0x68.HALF.HI) { - if (((unk - this->field_0x68.HALF.HI) & 0x1f) <= 0xf) { - this->field_0x68.HALF.HI--; + if (unk != this->unk_69) { + if (((unk - this->unk_69) & 0x1f) <= 0xf) { + this->unk_69--; } else { - this->field_0x68.HALF.HI++; + this->unk_69++; } - this->field_0x68.HALF.HI &= 0x1f; + this->unk_69 &= 0x1f; } - if (!(this->field_0x68.HALF.HI & 7)) { - this->animationState = sub_0806F5B0(this->field_0x68.HALF.HI); - InitializeAnimation(this, AnimationStateFlip90(this->animationState / 2)); + if (!(this->unk_69 & 7)) { + super->animationState = GetAnimationStateForDirection8(this->unk_69); + InitializeAnimation(super, AnimationStateFlip90(super->animationState / 2)); } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void sub_0806ACC4(Entity* this) { +void sub_0806ACC4(TownMinishEntity* this) { u8 delay; - switch (this->action) { + switch (super->action) { case 0: - if (!LoadExtraSpriteData(this, gUnk_08112674[this->type])) + if (!LoadExtraSpriteData(super, gUnk_08112674[super->type])) return; - this->action = 1; - delay = this->timer; - this->field_0x6a.HALF.LO = delay; - this->animationState = delay * 2; - this->timer = 0; + super->action = 1; + delay = super->timer; + this->unk_6a = delay; + super->animationState = delay * 2; + super->timer = 0; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_0807DD50(this); - InitializeAnimation(this, (this->animationState / 2) + 8); + this->fusionOffer = GetFusionToOffer(super); + InitScriptForNPC(super); + InitializeAnimation(super, (super->animationState / 2) + 8); break; case 1: - if (this->interactType == 2) { - this->action = 3; - this->interactType = 0; - sub_0806F118(this); + if (super->interactType == INTERACTION_FUSE) { + super->action = 3; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); } else { - ExecuteScriptForEntity(this, NULL); + ExecuteScriptForEntity(super, NULL); sub_0806AEA8(this); - if (this->type2 == 10 && this->interactType) { - this->action = 2; - this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8); - sub_0806AFE8(this, *(ScriptExecutionContext**)&this->cutsceneBeh); + if (super->type2 == 10 && super->interactType) { + super->action = 2; + super->interactType = INTERACTION_NONE; + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8); + sub_0806AFE8(super, this->context); } - if (this->type == 1) { + if (super->type == 1) { u8 idx = gPlayerEntity.animationState >> 1; - SetInteractableObjectCollision(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); + SetInteractableObjectCollision(super, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); } } break; @@ -236,96 +255,96 @@ void sub_0806ACC4(Entity* this) { if (gMessage.doTextBox & 0x7f) break; - this->action = 1; - InitializeAnimation(this, this->animationState / 2 + 4); + super->action = 1; + InitializeAnimation(super, super->animationState / 2 + 4); break; case 3: - if (UpdateFuseInteraction(this)) - this->action = 1; + if (UpdateFuseInteraction(super)) + super->action = 1; break; } - if (this->frameDuration != 0xff) { - GetNextFrame(this); + if (super->frameDuration != 0xff) { + GetNextFrame(super); } } -void TownMinish_MakeInteractable(Entity* this) { - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void TownMinish_MakeInteractable(TownMinishEntity* this) { + AddInteractableWhenBigFuser(super, this->fusionOffer); } -void TownMinish_Head(Entity* this) { +void TownMinish_Head(TownMinishEntity* this) { u32 frames; - if ((this->flags & ENT_SCRIPTED) == 0) { - frames = this->field_0x68.HALF.HI / 2; - if ((this->frameSpriteSettings & 1)) { - SetExtraSpriteFrame(this, 0, frames + 0x1c); + if ((super->flags & ENT_SCRIPTED) == 0) { + frames = this->unk_69 / 2; + if ((super->frameSpriteSettings & 1)) { + SetExtraSpriteFrame(super, 0, frames + 0x1c); } else { - SetExtraSpriteFrame(this, 0, 0xff); + SetExtraSpriteFrame(super, 0, 0xff); } - SetExtraSpriteFrame(this, 1, this->frameIndex); - SetSpriteSubEntryOffsetData1(this, 1, 0); - sub_0807000C(this); + SetExtraSpriteFrame(super, 1, super->frameIndex); + SetSpriteSubEntryOffsetData1(super, 1, 0); + sub_0807000C(super); } else { - frames = this->frame; + frames = super->frame; if (frames != 0xff) { frames &= ~0x80; } - if ((this->frameSpriteSettings & 1) == 0) { + if ((super->frameSpriteSettings & 1) == 0) { frames = 0xff; } - SetExtraSpriteFrame(this, 0, frames); - SetExtraSpriteFrame(this, 1, this->frameIndex); - SetSpriteSubEntryOffsetData1(this, 1, 0); - sub_0807000C(this); + SetExtraSpriteFrame(super, 0, frames); + SetExtraSpriteFrame(super, 1, super->frameIndex); + SetSpriteSubEntryOffsetData1(super, 1, 0); + sub_0807000C(super); } } -void sub_0806AEA8(Entity* this) { - int old = this->field_0x82.HWORD; - this->field_0x82.HWORD &= ~0x20; +void sub_0806AEA8(TownMinishEntity* this) { + int old = this->unk_82; + this->unk_82 &= ~0x20; if (old & 0x20) { - GravityUpdate(this, Q_8_8(64.0)); + GravityUpdate(super, Q_8_8(64.0)); } - HandleEntity0x82Actions(this); - this->field_0x82.HWORD = old; + HandleEntity0x82Actions(super); + this->unk_82 = old; } -void sub_0806AED8(Entity* this) { - this->timer = 0; +void sub_0806AED8(TownMinishEntity* this) { + super->timer = 0; sub_0806AEE4(this); } -void sub_0806AEE4(Entity* this) { +void sub_0806AEE4(TownMinishEntity* this) { int index; const u8* idx3; u8 tmp1, tmp2; - if (this->timer) { - this->timer--; + if (super->timer) { + super->timer--; } else { - this->timer = 2; - index = GetFacingDirectionInRectRadius(this, 0x20, 0x20); + super->timer = 2; + index = GetFacingDirectionInRectRadius(super, 0x20, 0x20); if (index < 0) { - int state = this->field_0x6a.HALF.LO; - this->animationState = state * 2; + int state = this->unk_6a; + super->animationState = state * 2; index = state * 8; } - idx3 = gUnk_081125F4[this->animationState / 2][index >> 1]; + idx3 = gUnk_081125F4[super->animationState / 2][index >> 1]; tmp1 = idx3[0]; tmp2 = idx3[1]; if (tmp2 & 0x80) { - this->animationState = sub_0806F5B0(index); + super->animationState = GetAnimationStateForDirection8(index); } tmp2 &= ~0x80; - this->frame = tmp1; - this->frameIndex = tmp2; - this->frameSpriteSettings = 1; - this->animIndex = 0; - this->frameDuration = 0xff; + super->frame = tmp1; + super->frameIndex = tmp2; + super->frameSpriteSettings = 1; + super->animIndex = 0; + super->frameDuration = 0xff; } } @@ -732,7 +751,7 @@ void sub_0806B004(Entity* this, ScriptExecutionContext* context) { int idx = 0; if (CheckGlobalFlag(MIZUKAKI_START)) { - if (CheckLocalFlag(0x73)) { + if (CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK)) { if (GetInventoryValue(ITEM_FLIPPERS) == 0) { idx = 3; if (CheckLocalFlag(KHOUSE51_00) == 0) { diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index adb973cb..9feb45ea 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -1,6 +1,21 @@ -#include "npc.h" +/** + * @file townsperson.c + * @ingroup NPCs + * + * @brief Townsperson NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "item.h" +#include "npc.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; + /*0x69*/ u8 unk_69; + /*0x6a*/ s16 unk_6a; + /*0x6c*/ s16 unk_6c; +} TownspersonEntity; typedef struct { u8 frame1; @@ -10,7 +25,7 @@ typedef struct { } struct_0810B680; extern void sub_08061CB4(Entity*, u32); -extern void sub_08061D64(Entity*); +extern void sub_08061D64(TownspersonEntity*); extern void sub_08062048(Entity*); extern struct_0810B680 gUnk_0810B680[]; @@ -58,8 +73,8 @@ void sub_08061C00(Entity* this) { } sub_08061CB4(this, uVar1); sub_0806ED78(this); - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; MessageFromTarget(this->type2 + TEXT_INDEX(TEXT_EMPTY, 0x01)); } } @@ -88,77 +103,79 @@ void sub_08061CB4(Entity* this, u32 arg1) { } } -void sub_08061CEC(Entity* this) { +void sub_08061CEC(TownspersonEntity* this) { u32 uVar2; - if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->type])) { - this->action = 1; - this->spriteSettings.draw = TRUE; - this->animationState = this->timer; - this->field_0x68.HALF.HI = 0xff; - uVar2 = sub_0805ACC0(this); + if (LoadExtraSpriteData(super, gUnk_0810B6EC[super->type])) { + super->action = 1; + super->spriteSettings.draw = TRUE; + super->animationState = super->timer; + this->unk_69 = 0xff; + uVar2 = sub_0805ACC0(super); if (uVar2 == 0) { - this->field_0x6a.HWORD = this->x.HALF.HI; - uVar2 = (u16)this->y.HALF.HI; + this->unk_6a = super->x.HALF.HI; + uVar2 = (u16)super->y.HALF.HI; } else { - this->field_0x6a.HWORD = (uVar2 >> 0x10); + this->unk_6a = (uVar2 >> 0x10); } - *(u16*)&this->field_0x6c = uVar2; - this->field_0x68.HALF.LO = GetFusionToOffer(this); - sub_0807DD64(this); + this->unk_6c = uVar2; + this->fusionOffer = GetFusionToOffer(super); + sub_0807DD64(super); sub_08061D64(this); } } -void sub_08061D64(Entity* this) { - if (this->interactType == 2) { - this->action = 3; - this->interactType = 0; - sub_0806F118(this); - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); +void sub_08061D64(TownspersonEntity* this) { + if (super->interactType == INTERACTION_FUSE) { + super->action = 3; + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + this->unk_69 = super->animIndex; + InitializeAnimation(super, (super->animIndex & -4) + + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } else { - ExecuteScriptForEntity(this, NULL); - HandleEntity0x82Actions(this); - if (this->frameDuration == 0xff) { - this->frameDuration = gUnk_0810B680[this->type].unk2; + ExecuteScriptForEntity(super, NULL); + HandleEntity0x82Actions(super); + if (super->frameDuration == 0xff) { + super->frameDuration = gUnk_0810B680[super->type].unk2; } - GetNextFrame(this); - if (this->interactType != 0) { - this->action = 2; - this->interactType = 0; - sub_08062048(this); - this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + GetNextFrame(super); + if (super->interactType != INTERACTION_NONE) { + super->action = 2; + super->interactType = INTERACTION_NONE; + sub_08062048(super); + this->unk_69 = super->animIndex; + InitializeAnimation(super, (super->animIndex & -4) + + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); } } } -void sub_08061E24(Entity* this) { - GetNextFrame(this); +void sub_08061E24(TownspersonEntity* this) { + GetNextFrame(super); if ((gMessage.doTextBox & 0x7f) == 0) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + super->action = 1; + InitializeAnimation(super, this->unk_69); } } -void sub_08061E50(Entity* this) { +void sub_08061E50(TownspersonEntity* this) { - if (UpdateFuseInteraction(this) != 0) { - this->action = 1; - InitializeAnimation(this, this->field_0x68.HALF.HI); + if (UpdateFuseInteraction(super) != 0) { + super->action = 1; + InitializeAnimation(super, this->unk_69); } } -void Townsperson_MakeInteractable(Entity* this) { - if (this->id == 6) { - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void Townsperson_MakeInteractable(TownspersonEntity* this) { + if (super->id == 6) { + AddInteractableWhenBigFuser(super, this->fusionOffer); } else { - AddInteractableWhenBigObject(this); + AddInteractableWhenBigObject(super); } } -void sub_08061E90(Entity* this, ScriptExecutionContext* context) { +void sub_08061E90(TownspersonEntity* this, ScriptExecutionContext* context) { u32 animIndex; s32 iVar4; @@ -166,7 +183,7 @@ void sub_08061E90(Entity* this, ScriptExecutionContext* context) { context->unk_18++; context->unk_12 = (Random() & 0x3f) + 0x20; animIndex = DirectionRound(Random()); - switch (this->direction) { + switch (super->direction) { case 0x0: if (animIndex == 0x10) { animIndex = 0x8; @@ -187,32 +204,32 @@ void sub_08061E90(Entity* this, ScriptExecutionContext* context) { animIndex = 0; } } - this->direction = (u8)animIndex; - this->animationState = sub_0806F5B0(animIndex); - this->speed = gUnk_0810B74A[this->type]; + super->direction = (u8)animIndex; + super->animationState = GetAnimationStateForDirection8(animIndex); + super->speed = gUnk_0810B74A[super->type]; } - animIndex = (this->animationState >> 1) + 4; - if (animIndex != this->animIndex) { - InitializeAnimation(this, animIndex); + animIndex = (super->animationState >> 1) + 4; + if (animIndex != super->animIndex) { + InitializeAnimation(super, animIndex); } - ProcessMovement0(this); - iVar4 = this->x.HALF.HI - *(s16*)&this->field_0x6a.HWORD; + ProcessMovement0(super); + iVar4 = super->x.HALF.HI - this->unk_6a; if (0x10 < iVar4) { - this->x.HALF.HI = this->field_0x6a.HWORD + 0x10; + super->x.HALF.HI = this->unk_6a + 0x10; context->unk_12 = 1; } if (iVar4 < -0x10) { - this->x.HALF.HI = *(s16*)&this->field_0x6a.HWORD - 0x10; + super->x.HALF.HI = this->unk_6a - 0x10; context->unk_12 = 1; } - iVar4 = this->y.HALF.HI - *(s16*)&this->field_0x6c; + iVar4 = super->y.HALF.HI - this->unk_6c; if (0x10 < iVar4) { - this->y.HALF.HI = *(s16*)&this->field_0x6c + 0x10; + super->y.HALF.HI = this->unk_6c + 0x10; context->unk_12 = 1; } if (iVar4 < -0x10) { - this->y.HALF.HI = *(s16*)&this->field_0x6c - 0x10; + super->y.HALF.HI = this->unk_6c - 0x10; context->unk_12 = 1; } if (--context->unk_12 != 0) { diff --git a/src/npc/vaati.c b/src/npc/vaati.c index e9197a55..f55e285f 100644 --- a/src/npc/vaati.c +++ b/src/npc/vaati.c @@ -1,45 +1,61 @@ -#include "global.h" +/** + * @file vaati.c + * @ingroup NPCs + * + * @brief Vaati NPC + */ +#define NENT_DEPRECATED #include "entity.h" +#include "functions.h" #include "script.h" #include "sound.h" -#include "functions.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ s8 unk_69; + /*0x6a*/ u8 unused1[22]; + /*0x80*/ u16 unk_80; + /*0x82*/ u8 unused2[2]; + /*0x84*/ ScriptExecutionContext* context; +} VaatiEntity; extern void sub_08095CB0(Entity*); extern void CreateRepeatedSoundManager(Entity*); extern void DeleteRepeatedSoundManager(Entity*); extern void CreateVaatiApparateManager(Entity*, u32); -void VaatiAction0(Entity*); -void VaatiAction1(Entity*); +void VaatiAction0(VaatiEntity*); +void VaatiAction1(VaatiEntity*); void sub_08066B74(Entity*, ScriptExecutionContext*); -void (*const vaatiActions[])(Entity*) = { VaatiAction0, VaatiAction1 }; +void (*const vaatiActions[])(VaatiEntity*) = { VaatiAction0, VaatiAction1 }; -void Vaati(Entity* this) { - vaatiActions[this->action](this); - this->palette.b.b0 = this->palette.b.b4 + (this->frameSpriteSettings & 1); +void Vaati(VaatiEntity* this) { + vaatiActions[super->action](this); + super->palette.b.b0 = super->palette.b.b4 + (super->frameSpriteSettings & 1); } -void VaatiAction0(Entity* this) { - this->action = 1; - this->subAction = 0; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.LO = 0; - this->field_0x68.HALF.HI = 0; - SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD64(this); +void VaatiAction0(VaatiEntity* this) { + super->action = 1; + super->subAction = 0; + super->spriteSettings.draw = 1; + this->unk_68 = 0; + this->unk_69 = 0; + SetDefaultPriority(super, PRIO_MESSAGE); + sub_0807DD64(super); VaatiAction1(this); } -void VaatiAction1(Entity* this) { - ScriptExecutionContext* tmp; - sub_0807DD94(this, sub_08066B74); - if ((*(s8*)&this->field_0x68.HALF.HI != 0) && ((gRoomTransition.frameCount & 3) == 0)) { - sub_08095CB0(this); +void VaatiAction1(VaatiEntity* this) { + ScriptExecutionContext* context; + ExecuteScriptAndHandleAnimation(super, sub_08066B74); + if ((*(s8*)&this->unk_69 != 0) && ((gRoomTransition.frameCount & 3) == 0)) { + sub_08095CB0(super); } - if ((this->frame & ~0x80) != 0) { - switch (this->frame & ~0x80u) { + if ((super->frame & ~0x80) != 0) { + switch (super->frame & ~0x80u) { case 1: EnqueueSFX(SFX_21C); break; @@ -47,18 +63,18 @@ void VaatiAction1(Entity* this) { EnqueueSFX(SFX_21E); break; case 3: - tmp = (*(ScriptExecutionContext**)&this->cutsceneBeh); - tmp->intVariable = 4; - CreateRepeatedSoundManager(this); + context = this->context; + context->intVariable = 4; + CreateRepeatedSoundManager(super); break; case 4: - tmp = (*(ScriptExecutionContext**)&this->cutsceneBeh); - tmp->intVariable = 4; - DeleteRepeatedSoundManager(this); + context = this->context; + context->intVariable = 4; + DeleteRepeatedSoundManager(super); EnqueueSFX(SFX_21D); break; } - this->frame &= ~0x80; + super->frame &= ~0x80; } } @@ -77,45 +93,45 @@ void sub_08066B74(Entity* this, ScriptExecutionContext* context) { switch (currentAction) { case 1 << 20: - this->field_0x80.HWORD = animationState + 0x10; + ((VaatiEntity*)this)->unk_80 = animationState + 0x10; break; case 1 << 21: - this->field_0x80.HWORD = animationState + 0x14; + ((VaatiEntity*)this)->unk_80 = animationState + 0x14; break; case 1 << 22: - this->field_0x80.HWORD = animationState + 0x18; + ((VaatiEntity*)this)->unk_80 = animationState + 0x18; break; case 1 << 23: - this->field_0x80.HWORD = animationState + 0x1c; + ((VaatiEntity*)this)->unk_80 = animationState + 0x1c; break; case 1 << 24: - this->field_0x80.HWORD = animationState + 0x20; + ((VaatiEntity*)this)->unk_80 = animationState + 0x20; break; case 1 << 25: - this->field_0x80.HWORD = animationState + 0x24; + ((VaatiEntity*)this)->unk_80 = animationState + 0x24; break; case 1 << 26: - this->field_0x80.HWORD = animationState + 0x28; + ((VaatiEntity*)this)->unk_80 = animationState + 0x28; break; case 1 << 27: - this->field_0x80.HWORD = animationState + 0x2c; + ((VaatiEntity*)this)->unk_80 = animationState + 0x2c; break; case 1 << 28: - this->field_0x80.HWORD = animationState + 0x30; + ((VaatiEntity*)this)->unk_80 = animationState + 0x30; break; case 1 << 29: - this->field_0x68.HALF.LO = 1; + ((VaatiEntity*)this)->unk_68 = 1; break; case 1 << 30: - this->field_0x68.HALF.LO = 0xff; + ((VaatiEntity*)this)->unk_68 = 0xff; break; case 1 << 31: - this->field_0x68.HALF.HI ^= 1; + ((VaatiEntity*)this)->unk_69 ^= 1; break; } } while (actions != 0); } - HandlePostScriptActions(this, *(ScriptExecutionContext**)&this->cutsceneBeh); + HandlePostScriptActions(this, ((VaatiEntity*)this)->context); } void Vaati_Apparate(Entity* this) { diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c index f2837926..5e80be89 100644 --- a/src/npc/vaatiReborn.c +++ b/src/npc/vaatiReborn.c @@ -1,6 +1,12 @@ -#include "global.h" -#include "npc.h" +/** + * @file vaatiReborn.c + * @ingroup NPCs + * + * @brief Vaati Reborn NPC + */ +#define NENT_DEPRECATED #include "functions.h" +#include "npc.h" void VaatiRebornAction0(Entity* this); void VaatiRebornAction1(Entity* this); diff --git a/src/npc/wheaton.c b/src/npc/wheaton.c index daa98a6f..aa24f321 100644 --- a/src/npc/wheaton.c +++ b/src/npc/wheaton.c @@ -1,3 +1,10 @@ +/** + * @file wheaton.c + * @ingroup NPCs + * + * @brief Wheaton NPC + */ +#define NENT_DEPRECATED #include "npc.h" void Wheaton(Entity* this) { @@ -11,5 +18,5 @@ void Wheaton(Entity* this) { this->spriteOffsetY = 0xfe; sub_0807DD64(this); } - sub_0807DD94(this, 0); + ExecuteScriptAndHandleAnimation(this, NULL); } diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index aa4f9b31..41eb3567 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -1,7 +1,18 @@ -#include "global.h" -#include "sound.h" +/** + * @file windTribespeople.c + * @ingroup NPCs + * + * @brief Wind Tribespeople NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "npc.h" +#include "sound.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} WindTribespeopleEntity; void sub_0806C798(Entity*); void sub_0806C7D4(Entity*); @@ -43,7 +54,7 @@ void sub_0806C798(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; this->animationState = this->timer; - sub_0807DD50(this); + InitScriptForNPC(this); sub_0806C7D4(this); } } @@ -52,13 +63,14 @@ void sub_0806C7D4(Entity* this) { u32 iVar1; u32 uVar2; - if (this->interactType == '\x02') { + if (this->interactType == INTERACTION_FUSE) { this->action = 3; - this->interactType = 0; - sub_0806F118(this); + this->interactType = INTERACTION_NONE; + InitializeNPCFusion(this); } else { - sub_0807DD94(this, NULL); - if ((this->type2 == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(0x63)) && (CheckRoomFlag(0))) { + ExecuteScriptAndHandleAnimation(this, NULL); + if ((this->type2 == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(SORA_ELDER_RECOVER)) && + (CheckRoomFlag(0))) { this->type2 = 7; sub_0807DD80(this, &script_WindTribespeople6); } @@ -78,12 +90,9 @@ void sub_0806C85C(Entity* this) { } } -void WindTribespeople_MakeInteractable(Entity* this) { - u8 bVar1; - - bVar1 = GetFusionToOffer(this); - this->field_0x68.HALF.LO = bVar1; - AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO); +void WindTribespeople_MakeInteractable(WindTribespeopleEntity* this) { + this->fusionOffer = GetFusionToOffer(super); + AddInteractableWhenBigFuser(super, this->fusionOffer); } void WindTribespeople_Head(Entity* this) { @@ -201,7 +210,7 @@ void sub_0806C99C(Entity* this, ScriptExecutionContext* context) { if (CheckGlobalFlag(WARP_EVENT_END)) { flagAsBool = 2; } - if (CheckLocalFlag(99) != 0) { + if (CheckLocalFlag(SORA_ELDER_RECOVER)) { flagAsBool++; } MessageNoOverlap(messageIndices[flagAsBool], this); diff --git a/src/npc/zelda.c b/src/npc/zelda.c index f15b2a13..629d8ab2 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -1,3 +1,11 @@ +/** + * @file zelda.c + * @ingroup NPCs + * + * @brief Zelda NPC + */ +#define NENT_DEPRECATED +#include "npc/zelda.h" #include "entity.h" #include "flags.h" #include "functions.h" @@ -25,11 +33,11 @@ void sub_08066CCC(Entity* this) { this->spriteSettings.draw = 1; PrependEntityToList(this, 7); SetDefaultPriority(this, PRIO_MESSAGE); - sub_0807DD50(this); + InitScriptForNPC(this); } void sub_08066CF8(Entity* this) { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } void sub_08066D04(Entity* this) { @@ -68,17 +76,17 @@ void sub_08066D4C(Entity* this, ScriptExecutionContext* context) { void sub_08066D94(Entity* this) { u32 room; - Entity* npc; + ZeldaFollowerEntity* npc; SetGlobalFlag(ZELDA_CHASE); - npc = CreateNPC(ZELDA_FOLLOWER, 0, 0); + npc = (ZeldaFollowerEntity*)CreateNPC(ZELDA_FOLLOWER, 0, 0); if (npc != NULL) { - npc->animationState = gPlayerEntity.animationState; - npc->flags |= ENT_PERSIST; - npc->animationState = GetAnimationState(this); + npc->base.animationState = gPlayerEntity.animationState; + npc->base.flags |= ENT_PERSIST; + npc->base.animationState = GetAnimationState(this); room = gRoomControls.room; - npc->field_0x74.HWORD = room; - CopyPosition(this, npc); + npc->unk_74 = room; + CopyPosition(this, &npc->base); } DeleteThisEntity(); } @@ -91,29 +99,29 @@ void SetZeldaFollowTarget(Entity* target) { } } -void sub_08066E08(Entity* this) { - InitAnimationForceUpdate(this, 0x50); - this->field_0x80.HWORD = this->animIndex; +void sub_08066E08(ZeldaEntity* this) { + InitAnimationForceUpdate(super, 0x50); + this->unk_80 = super->animIndex; } -void sub_08066E20(Entity* this) { - InitAnimationForceUpdate(this, 0x44); - this->field_0x80.HWORD = this->animIndex; +void sub_08066E20(ZeldaEntity* this) { + InitAnimationForceUpdate(super, 0x44); + this->unk_80 = super->animIndex; } -void sub_08066E38(Entity* this) { - InitAnimationForceUpdate(this, 0x48); - this->field_0x80.HWORD = this->animIndex; +void sub_08066E38(ZeldaEntity* this) { + InitAnimationForceUpdate(super, 0x48); + this->unk_80 = super->animIndex; } -void sub_08066E50(Entity* this) { - InitAnimationForceUpdate(this, 0x4C); - this->field_0x80.HWORD = this->animIndex; +void sub_08066E50(ZeldaEntity* this) { + InitAnimationForceUpdate(super, 0x4C); + this->unk_80 = super->animIndex; } -void sub_08066E68(Entity* this) { - InitAnimationForceUpdate(this, 0x54); - this->field_0x80.HWORD = this->animIndex; +void sub_08066E68(ZeldaEntity* this) { + InitAnimationForceUpdate(super, 0x54); + this->unk_80 = super->animIndex; } void sub_08066E80(Entity* this, ScriptExecutionContext* context) { @@ -156,7 +164,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { return; } } - this->field_0x80.HWORD = this->animIndex; + ((ZeldaEntity*)this)->unk_80 = this->animIndex; gActiveScriptInfo.commandSize = 0; } diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index 2402823d..fd9c71d9 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -1,3 +1,11 @@ +/** + * @file zeldaFollower.c + * @ingroup NPCs + * + * @brief Zelda Follower NPC + */ +#define NENT_DEPRECATED +#include "npc/zelda.h" #include "common.h" #include "entity.h" #include "functions.h" @@ -18,8 +26,8 @@ typedef union { #define ZELDA_FOLLOWER_HEAP_LEN 20 -#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem*)this->myHeap) -#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem*)this->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1)) +#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem*)super->myHeap) +#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem*)super->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1)) #define ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr) \ do { \ @@ -32,29 +40,29 @@ typedef union { } \ } while (0) -void sub_08068318(Entity*); -void sub_0806854C(Entity*, u32*); +void sub_08068318(ZeldaFollowerEntity*); +void sub_0806854C(ZeldaFollowerEntity*, u32*); void sub_08068578(Entity* this); -void ZeldaFollower(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = TRUE; - this->animationState = 4; - this->field_0x68.HALF.LO = 0; - this->field_0x68.HALF.HI = 0; - SetDefaultPriority(this, PRIO_MESSAGE); - InitAnimationForceUpdate(this, 0); +void ZeldaFollower(ZeldaFollowerEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = TRUE; + super->animationState = 4; + this->unk_68 = 0; + this->unk_69 = 0; + SetDefaultPriority(super, PRIO_MESSAGE); + InitAnimationForceUpdate(super, 0); sub_0806854C(this, NULL); } - if ((s8)this->field_0x68.HALF.LO != 0) { + if ((s8)this->unk_68 != 0) { sub_08068318(this); } else { - this->spriteSettings.draw = FALSE; + super->spriteSettings.draw = FALSE; } } -void sub_08068318(Entity* this) { +void sub_08068318(ZeldaFollowerEntity* this) { s32 dist; s16 z; @@ -71,39 +79,39 @@ void sub_08068318(Entity* this) { item.FIELDS.animationState = gPlayerEntity.animationState; item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; - heapPtr = this->myHeap; + heapPtr = super->myHeap; if ((heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) || (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16)) { - this->x.HALF.HI = gPlayerEntity.x.HALF.HI; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI; - this->spriteSettings.draw = 1; - sub_08068578(this); + super->x.HALF.HI = gPlayerEntity.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->spriteSettings.draw = 1; + sub_08068578(super); } animIndex = 0; if (item.DWORD != heapPtr->DWORD || item.FIELDS.framestate == 0x16 || item.FIELDS.framestate == 0xa) { - ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr); + ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr); heapPtr = ZELDA_FOLLOWER_HEAP; heapPtr[0] = item; animIndex = 0x4; - if ((s8)this->field_0x68.HALF.HI > 0) { - this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1; + if ((s8)this->unk_69 > 0) { + this->unk_69 = this->unk_69 - 1; } } else { heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1; z = heapPtr->FIELDS.z; if (z < 0) { - ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr); + ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr); animIndex = 0x4; } else { dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x, (u16)heapPtr->FIELDS.y); dist = ((u32)dist) >> 0x4; if (dist > 0x18) { - ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr); + ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr); animIndex = 0x4; } } @@ -111,43 +119,43 @@ void sub_08068318(Entity* this) { heapPtr = ZELDA_FOLLOWER_HEAP; heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1; - this->x.HALF.HI = heapPtr->FIELDS.x; - this->y.HALF.HI = heapPtr->FIELDS.y; - this->z.HALF.HI = heapPtr->FIELDS.z; - this->animationState = heapPtr->FIELDS.animationState; - this->collisionLayer = heapPtr->FIELDS.collisionLayer; + super->x.HALF.HI = heapPtr->FIELDS.x; + super->y.HALF.HI = heapPtr->FIELDS.y; + super->z.HALF.HI = heapPtr->FIELDS.z; + super->animationState = heapPtr->FIELDS.animationState; + super->collisionLayer = heapPtr->FIELDS.collisionLayer; if (heapPtr->FIELDS.framestate == 0x16 || heapPtr->FIELDS.framestate == 0xa) { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } - if (((s8)this->field_0x68.HALF.HI) > 0) { - this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1; + if (((s8)this->unk_69) > 0) { + this->unk_69 = this->unk_69 - 1; } animIndexTmp = animIndex; - animIndex += this->animationState >> 1; + animIndex += super->animationState >> 1; - if (!(animIndex == this->animIndex || (animIndexTmp == 0 && ((s8)this->field_0x68.HALF.HI) > 0))) { - InitAnimationForceUpdate(this, animIndex); - this->field_0x68.HALF.HI = 0x1e; + if (!(animIndex == super->animIndex || (animIndexTmp == 0 && ((s8)this->unk_69) > 0))) { + InitAnimationForceUpdate(super, animIndex); + this->unk_69 = 0x1e; } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } - sub_0800451C(this); - if (this->z.HALF.HI < 0) { - sub_0806F854(this, 0x0, -0xc); + sub_0800451C(super); + if (super->z.HALF.HI < 0) { + sub_0806F854(super, 0x0, -0xc); } } -void sub_0806854C(Entity* this, u32* none) { - this->myHeap = zMalloc(sizeof(ZeldaFollowerItem[ZELDA_FOLLOWER_HEAP_LEN])); - if (this->myHeap != NULL) { - this->field_0x68.HALF.LO = 1; - RemoveInteractableObject(this); - this->hitbox = NULL; - sub_08068578(this); +void sub_0806854C(ZeldaFollowerEntity* this, u32* none) { + super->myHeap = zMalloc(sizeof(ZeldaFollowerItem[ZELDA_FOLLOWER_HEAP_LEN])); + if (super->myHeap != NULL) { + this->unk_68 = 1; + RemoveInteractableObject(super); + super->hitbox = NULL; + sub_08068578(super); } } @@ -272,17 +280,17 @@ void sub_08068578(Entity* this) { } } -void ZeldaFollower_Hide(Entity* zelda, Entity* follower) { - follower->field_0x68.HALF.LO = 0; - follower->spriteSettings.draw = 0; +void ZeldaFollower_Hide(Entity* zelda, ZeldaFollowerEntity* follower) { + follower->unk_68 = 0; + follower->base.spriteSettings.draw = 0; } -void ZeldaFollower_Show(Entity* zelda, Entity* follower) { - follower->field_0x68.HALF.LO = 1; - follower->spriteSettings.draw = 1; - follower->animationState = zelda->animationState; - sub_08068578(follower); - InitAnimationForceUpdate(follower, follower->animationState / 2); +void ZeldaFollower_Show(Entity* zelda, ZeldaFollowerEntity* follower) { + follower->unk_68 = 1; + follower->base.spriteSettings.draw = 1; + follower->base.animationState = zelda->animationState; + sub_08068578(&follower->base); + InitAnimationForceUpdate(&follower->base, follower->base.animationState / 2); } void sub_080686C4(Entity* zelda, Entity* follower) { diff --git a/src/npcUtils.c b/src/npcUtils.c index 8702f3eb..b0c111fe 100644 --- a/src/npcUtils.c +++ b/src/npcUtils.c @@ -12,8 +12,8 @@ extern const NPCDefinition gNPCDefinitions[]; typedef struct { u16 textIndex; - u16 _2; - u16 _4; + u16 cancelledTextIndex; + u16 fusingTextIndex; } NPCData; extern NPCData* gUnk_08001A7C[]; @@ -128,7 +128,7 @@ s32 GetAnimationStateInRectRadius(Entity* ent, u32 x, u32 y) { u32 GetAnimationState(Entity* ent) { u32 direction = GetFacingDirection(ent, &gPlayerEntity); - return sub_0806F5A4(direction); + return GetAnimationStateForDirection4(direction); } s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y) { @@ -161,7 +161,7 @@ u32 sub_0806EE20(Entity* ent) { } else { ent->knockbackSpeed = 8; v3 = GetFacingDirection(ent, &gPlayerEntity); - ent->knockbackDirection = sub_0806F5A4(v3); + ent->knockbackDirection = GetAnimationStateForDirection4(v3); } return 0; } @@ -206,7 +206,7 @@ static void sub_0806EF14(Entity* ent) { sub_0806EF4C(ent, xy); ent->direction = sub_080045B4(ent, xy[0], xy[1]); if ((ent->collisionFlags & 1) == 0) - ent->knockbackDirection = sub_0806F5A4(ent->direction); + ent->knockbackDirection = GetAnimationStateForDirection4(ent->direction); } static void sub_0806EF4C(Entity* ent, u16* xy) { @@ -326,36 +326,37 @@ void CollideFollowers(void) { } } -void sub_0806F118(Entity* ent) { - u32 idx = GetFuserId(ent); - NPCData* data = gUnk_08001A7C[idx]; - sub_0801DFB4(ent, data->textIndex, data->_2, data->_4); +void InitializeNPCFusion(Entity* entity) { + u32 fuserId = GetFuserId(entity); + NPCData* data = gUnk_08001A7C[fuserId]; + InitializeFuseInfo(entity, data->textIndex, data->cancelledTextIndex, data->fusingTextIndex); gPlayerState.controlMode = CONTROL_DISABLED; } -u32 UpdateFuseInteraction(Entity* ent) { - u32 ret; - sub_0801E00C(); - ret = -1; - switch (gFuseInfo._0) { +// Returns -1, 0, or 1 +u32 UpdateFuseInteraction(Entity* entity) { + u32 result; + PerformFuseAction(); + result = -1; + switch (gFuseInfo.fusionState) { default: - ret = 0; + result = 0; break; - case 2: + case FUSION_STATE_2: gPlayerState.controlMode = CONTROL_DISABLED; - ret = 1; - case 1: + result = 1; + case FUSION_STATE_1: PlayerResetStateFromFusion(); gPlayerState.controlMode = CONTROL_1; break; } - return ret; + return result; } -void MarkFuserDone(Entity* ent) { - u32 idx = GetFuserId(ent); - if (idx != 0) - gSave.fuserOffers[idx] = KINSTONE_FUSER_DONE; +void MarkFuserDone(Entity* entity) { + u32 fuserId = GetFuserId(entity); + if (fuserId != 0) + gSave.kinstones.fuserOffers[fuserId] = KINSTONE_FUSER_DONE; } void ShowNPCDialogue(Entity* ent, const Dialog* dia) { diff --git a/src/object.c b/src/object.c index 96729ee1..58806614 100644 --- a/src/object.c +++ b/src/object.c @@ -102,7 +102,7 @@ void (*const gObjectFunctions[])(Entity*) = { [EZLO_CAP_FLYING] = EzloCapFlying, [GIANT_TWIG] = GiantTwig, [OBJECT_63] = Object63, - [THUNDERBOLD] = Thunderbold, + [THUNDERBOLT] = Thunderbolt, [LADDER_HOLE] = LadderHoleInBookshelf, [WATER_DROP_OBJECT] = WaterDropObject, [GLEEROK_PARTICLE] = GleerokParticle, diff --git a/src/object/ambientClouds.c b/src/object/ambientClouds.c index 3cd73953..c24b16f4 100644 --- a/src/object/ambientClouds.c +++ b/src/object/ambientClouds.c @@ -4,6 +4,7 @@ * * @brief Ambient Clouds object */ +#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" @@ -27,8 +28,6 @@ void AmbientClouds(Entity* this) { } void AmbientClouds_Init(Entity* this) { - Entity* pEVar2; - #ifndef EU if ((this->flags & ENT_DID_INIT) != 0) { #endif @@ -44,10 +43,10 @@ void AmbientClouds_Init(Entity* this) { this->parent = NULL; CreateObjectWithParent(this, AMBIENT_CLOUDS, 0, 0xff); for (; this->type != 0; --this->type) { - pEVar2 = CreateObjectWithParent(this, AMBIENT_CLOUDS, 0, this->type); - this->child = pEVar2; - if (pEVar2 != NULL) { - pEVar2->parent = this->parent; + Entity* entity = CreateObjectWithParent(this, AMBIENT_CLOUDS, 0, this->type); + this->child = entity; + if (entity != NULL) { + entity->parent = this->parent; if (this->parent != NULL) { this->parent->child = this->child; } @@ -77,9 +76,6 @@ void AmbientClouds_Init(Entity* this) { } void AmbientClouds_Action1(Entity* this) { - int iVar1; - Entity* pEVar2; - if (this->type2 == 0xff) { this->spritePriority.b0 = 7; this->spriteRendering.b3 = 3; @@ -92,8 +88,7 @@ void AmbientClouds_Action1(Entity* this) { else this->timer = 0; this->y.HALF.HI += (this->type2 - 1) * -0x24; - iVar1 = EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf); - if ((iVar1 != 0) && (this->timer != 0)) { + if (EntityInRectRadius(this, &gPlayerEntity, 15, 15) && (this->timer != 0)) { this->action = 2; this->spriteOrientation.flipY = 2; this->spriteRendering.b3 = 3; @@ -105,21 +100,21 @@ void AmbientClouds_Action1(Entity* this) { gPlayerEntity.z.HALF.HI += 0x24; sub_0807AA80(&gPlayerEntity); if (this->subtimer == 0) { - pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0); - if (pEVar2 != NULL) { - pEVar2->x.HALF.HI += 8; + Entity* fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + if (fx != NULL) { + fx->x.HALF.HI += 8; } - pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0); - if (pEVar2 != NULL) { - pEVar2->x.HALF.HI -= 8; + fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + if (fx != NULL) { + fx->x.HALF.HI -= 8; } - pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0); - if (pEVar2 != NULL) { - pEVar2->y.HALF.HI += 8; + fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + if (fx != NULL) { + fx->y.HALF.HI += 8; } - pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0); - if (pEVar2 != NULL) { - pEVar2->y.HALF.HI -= 8; + fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + if (fx != NULL) { + fx->y.HALF.HI -= 8; } } } @@ -131,7 +126,7 @@ void AmbientClouds_Action1(Entity* this) { void AmbientClouds_Action2(Entity* this) { this->y.HALF.HI += this->type2 * -0x24; - if (EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf)) { + if (EntityInRectRadius(this, &gPlayerEntity, 15, 15)) { gPlayerState.field_0x14 = 1; gPlayerState.flags |= PL_FLAGS2; } else { @@ -144,7 +139,7 @@ void AmbientClouds_Action2(Entity* this) { } void AmbientClouds_Action3(Entity* this) { - if (EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf)) { + if (EntityInRectRadius(this, &gPlayerEntity, 15, 15)) { gPlayerState.field_0x14 = 1; } } diff --git a/src/object/angryStatue.c b/src/object/angryStatue.c index bc9d357c..cac153d1 100644 --- a/src/object/angryStatue.c +++ b/src/object/angryStatue.c @@ -4,6 +4,7 @@ * * @brief Angry Statue object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "hitbox.h" diff --git a/src/object/archway.c b/src/object/archway.c index 76a9df16..2feceae8 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -4,6 +4,7 @@ * * @brief Archway object */ +#define NENT_DEPRECATED #include "entity.h" #include "game.h" diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index 658b5e5d..691ff2cb 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -4,66 +4,74 @@ * * @brief BackgroundCloud object */ +#define NENT_DEPRECATED #include "object.h" -void BackgroundCloud_Init(Entity*); -void BackgroundCloud_Action1(Entity*); -void BackgroundCloud_Action2(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ s16 unk_78; + /*0x7a*/ s16 unk_7a; +} BackgroundCloudEntity; -void BackgroundCloud(Entity* this) { - static void (*const BackgroundCloud_Actions[])(Entity*) = { +void BackgroundCloud_Init(BackgroundCloudEntity* this); +void BackgroundCloud_Action1(BackgroundCloudEntity* this); +void BackgroundCloud_Action2(BackgroundCloudEntity* this); + +void BackgroundCloud(BackgroundCloudEntity* this) { + static void (*const BackgroundCloud_Actions[])(BackgroundCloudEntity*) = { BackgroundCloud_Init, BackgroundCloud_Action1, BackgroundCloud_Action2, }; - BackgroundCloud_Actions[this->action](this); + BackgroundCloud_Actions[super->action](this); } -void BackgroundCloud_Init(Entity* this) { +void BackgroundCloud_Init(BackgroundCloudEntity* this) { static const u8 gUnk_08121EB0[] = { 0x30, 0x28, 0x20 }; - this->action = 1; - this->spriteSettings.draw = 1; - this->spriteOrientation.flipY = 3; - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = this->type; - this->frameIndex = this->type; - this->direction = 8; - this->speed = gUnk_08121EB0[this->type]; - this->field_0x78.HWORD = gRoomControls.origin_x - 0x60; - this->field_0x7a.HWORD = gRoomControls.origin_x + gRoomControls.width + 0x60; - this->animationState = 0; - this->x.HALF.HI += (Random() & 0xf) << 4; - this->timer = 0; - this->subAction = 0; + super->action = 1; + super->spriteSettings.draw = 1; + super->spriteOrientation.flipY = 3; + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = super->type; + super->frameIndex = super->type; + super->direction = 8; + super->speed = gUnk_08121EB0[super->type]; + this->unk_78 = gRoomControls.origin_x - 0x60; + this->unk_7a = gRoomControls.origin_x + gRoomControls.width + 0x60; + super->animationState = 0; + super->x.HALF.HI += (Random() & 0xf) << 4; + super->timer = 0; + super->subAction = 0; } -void BackgroundCloud_Action1(Entity* this) { - LinearMoveUpdate(this); +void BackgroundCloud_Action1(BackgroundCloudEntity* this) { + LinearMoveUpdate(super); - if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD || (s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD) - this->action = 2; + if (super->x.HALF.HI < this->unk_78 || super->x.HALF.HI > this->unk_7a) + super->action = 2; } -void BackgroundCloud_Action2(Entity* this) { +void BackgroundCloud_Action2(BackgroundCloudEntity* this) { static const u8 gUnk_08121EB3[] = { 0x8, 0x28, 0x48, 0x98, 0 }; - if (this->subAction == 0) { - this->subAction = 1; - this->timer = ((Random() & 7) << 3) + 31; + if (super->subAction == 0) { + super->subAction = 1; + super->timer = ((Random() & 7) << 3) + 31; - if ((this->direction & 0x10)) { - this->x.HALF.HI = this->field_0x7a.HWORD; + if ((super->direction & 0x10)) { + super->x.HALF.HI = this->unk_7a; } else { - this->x.HALF.HI = this->field_0x78.HWORD; + super->x.HALF.HI = this->unk_78; } - if (this->type == 2) - this->y.HALF.HI = gUnk_08121EB3[this->type2 * 2 + (Random() & 1)]; + if (super->type == 2) + super->y.HALF.HI = gUnk_08121EB3[super->type2 * 2 + (Random() & 1)]; } - if (this->subAction == 1) { - if (--this->timer == 0) { - this->action = 1; - this->subAction = 0; + if (super->subAction == 1) { + if (--super->timer == 0) { + super->action = 1; + super->subAction = 0; } } } diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index c044ac9f..497fd432 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -4,75 +4,82 @@ * * @brief Baker Oven object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "tiles.h" -extern void SoundReqClipped(Entity*, u32); -void sub_0809CDF0(Entity*); -void BakerOven_Init(Entity*); -void BakerOven_Action1(Entity*); -void BakerOven_Action2(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u16 unk_80; +} BakerOvenEntity; -void BakerOven(Entity* this) { - static void (*const BakerOven_Actions[])(Entity*) = { +extern void SoundReqClipped(Entity*, u32); +void sub_0809CDF0(BakerOvenEntity* this); +void BakerOven_Init(BakerOvenEntity* this); +void BakerOven_Action1(BakerOvenEntity* this); +void BakerOven_Action2(BakerOvenEntity* this); + +void BakerOven(BakerOvenEntity* this) { + static void (*const BakerOven_Actions[])(BakerOvenEntity*) = { BakerOven_Init, BakerOven_Action1, BakerOven_Action2, }; - BakerOven_Actions[this->action](this); + BakerOven_Actions[super->action](this); } -void BakerOven_Init(Entity* this) { +void BakerOven_Init(BakerOvenEntity* this) { u32 i; - Entity* ent; + Entity* entity; - this->action = 1; - UpdateSpriteForCollisionLayer(this); + super->action = 1; + UpdateSpriteForCollisionLayer(super); - if (this->type == 0) { - this->spritePriority.b0 = 5; + if (super->type == 0) { + super->spritePriority.b0 = 5; /* Create steam clouds */ for (i = 0; i < 3; i++) { - ent = CreateObject(BAKER_OVEN, 1, i); - if (ent != NULL) { - ent->parent = this; - PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0)); + entity = CreateObject(BAKER_OVEN, 1, i); + if (entity != NULL) { + entity->parent = super; + PositionRelative(super, entity, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0)); } } sub_0809CDF0(this); } else { - if (this->type2 & 1) { - this->spriteSettings.draw = 1; - this->timer = 20; + if (super->type2 & 1) { + super->spriteSettings.draw = 1; + super->timer = 20; } else { - this->action = 2; - this->timer = (this->type2 & 2) ? 20 : 18; + super->action = 2; + super->timer = (super->type2 & 2) ? 20 : 18; } - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } -void BakerOven_Action1(Entity* this) { - u8* frames; +void BakerOven_Action1(BakerOvenEntity* this) { + u8* frame; - if (this->type) { - GetNextFrame(this); - frames = &this->frame; - if (this->frame & 1) { - this->frame &= ~1; - this->y.HALF.HI++; + if (super->type) { + GetNextFrame(super); + frame = &super->frame; + if (super->frame & 1) { + super->frame &= ~1; + super->y.HALF.HI++; } - if ((*frames & ANIM_DONE) && this->frameDuration == 1) { - this->action = 2; - this->spriteSettings.draw = 0; + if ((*frame & ANIM_DONE) && super->frameDuration == 1) { + super->action = 2; + super->spriteSettings.draw = 0; } /* Damage minish link if he touches a steam cloud */ - if (this->subtimer == 0 && gPlayerEntity.iframes == 0 && this->frameIndex && - sub_0806FC80(this, &gPlayerEntity, 4)) { - this->subtimer++; + if (super->subtimer == 0 && gPlayerEntity.iframes == 0 && super->frameIndex && + sub_0806FC80(super, &gPlayerEntity, 4)) { + super->subtimer++; ModHealth(-2); SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); gPlayerEntity.iframes = 16; @@ -83,31 +90,31 @@ void BakerOven_Action1(Entity* this) { } } -void BakerOven_Action2(Entity* this) { +void BakerOven_Action2(BakerOvenEntity* this) { /* Reset cloud position and start animation. */ - if (--this->timer == 0) { - this->action = 1; - this->timer = 30; - this->subtimer = 0; - this->spriteSettings.draw = 1; - this->y.HALF.HI = this->parent->y.HALF.HI - 0xe; - InitializeAnimation(this, 0); + if (--super->timer == 0) { + super->action = 1; + super->timer = 30; + super->subtimer = 0; + super->spriteSettings.draw = 1; + super->y.HALF.HI = super->parent->y.HALF.HI - 0xe; + InitializeAnimation(super, 0); } } -void sub_0809CDF0(Entity* this) { +void sub_0809CDF0(BakerOvenEntity* this) { u32 metaTilePos; - this->field_0x80.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) | - (((this->y.HALF.HI - gRoomControls.origin_y) >> 4 & 0x3f) << 6); + this->unk_80 = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) | + (((super->y.HALF.HI - gRoomControls.origin_y) >> 4 & 0x3f) << 6); - metaTilePos = this->field_0x80.HWORD; - SetMetaTile(SPECIAL_META_TILE_46, metaTilePos + TILE_POS(-1, 0), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(0, 0), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(1, 0), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -1), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -1), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_36, metaTilePos + TILE_POS(1, -1), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -2), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -2), this->collisionLayer); + metaTilePos = this->unk_80; + SetMetaTile(SPECIAL_META_TILE_46, metaTilePos + TILE_POS(-1, 0), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(0, 0), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(1, 0), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -1), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -1), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_36, metaTilePos + TILE_POS(1, -1), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -2), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -2), super->collisionLayer); } diff --git a/src/object/barrelInside.c b/src/object/barrelInside.c index 3ef99da4..1bd43f7e 100644 --- a/src/object/barrelInside.c +++ b/src/object/barrelInside.c @@ -4,6 +4,7 @@ * * @brief Barrel Inside object */ +#define NENT_DEPRECATED #include "entity.h" typedef struct { diff --git a/src/object/barrelSpiderweb.c b/src/object/barrelSpiderweb.c index 3e555ece..a3dcc448 100644 --- a/src/object/barrelSpiderweb.c +++ b/src/object/barrelSpiderweb.c @@ -4,149 +4,143 @@ * * @brief Barrel Spiderweb object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" -typedef struct { - /*0x00*/ Entity base; -} BarrelSpiderwebEntity; +void BarrelSpiderweb_Init(Entity*); +void BarrelSpiderweb_Action1(Entity*); +void BarrelSpiderweb_Action2(Entity*); +void sub_0808BDB0(Entity*); +void sub_0808BBE0(Entity*); +void sub_0808BD00(Entity*); -void BarrelSpiderweb_Init(BarrelSpiderwebEntity*); -void BarrelSpiderweb_Action1(BarrelSpiderwebEntity*); -void BarrelSpiderweb_Action2(BarrelSpiderwebEntity*); -void sub_0808BDB0(BarrelSpiderwebEntity*); -void sub_0808BBE0(BarrelSpiderwebEntity*); -void sub_0808BD00(BarrelSpiderwebEntity*); - -void BarrelSpiderweb(BarrelSpiderwebEntity* this) { - static void (*const BarrelSpiderweb_Actions[])(BarrelSpiderwebEntity*) = { +void BarrelSpiderweb(Entity* this) { + static void (*const BarrelSpiderweb_Actions[])(Entity*) = { BarrelSpiderweb_Init, BarrelSpiderweb_Action1, BarrelSpiderweb_Action2, }; - BarrelSpiderweb_Actions[super->action](this); + BarrelSpiderweb_Actions[this->action](this); } -void BarrelSpiderweb_Init(BarrelSpiderwebEntity* this) { +void BarrelSpiderweb_Init(Entity* this) { if (CheckGlobalFlag(LV1TARU_OPEN)) { LoadGfxGroup(0x4a); DeleteThisEntity(); } else { - super->action = 1; - super->flags |= ENT_COLLIDE; - super->timer = 120; - super->subtimer = 0; - super->spriteRendering.b3 = 3; - super->spritePriority.b0 = 4; - super->spriteOrientation.flipY = 2; - super->speed = 0x300; - super->hitType = 1; - super->collisionFlags = 7; - super->hurtType = 0x48; - super->flags2 = 4; - super->hitbox = (Hitbox*)&gHitbox_0; - super->frameIndex = 2; - super->collisionLayer = gPlayerEntity.collisionLayer; + this->action = 1; + this->flags |= ENT_COLLIDE; + this->timer = 120; + this->subtimer = 0; + this->spriteRendering.b3 = 3; + this->spritePriority.b0 = 4; + this->spriteOrientation.flipY = 2; + this->speed = 0x300; + this->hitType = 1; + this->collisionFlags = 7; + this->hurtType = 0x48; + this->flags2 = 4; + this->hitbox = (Hitbox*)&gHitbox_0; + this->frameIndex = 2; + this->collisionLayer = gPlayerEntity.collisionLayer; sub_0808BDB0(this); - super->y.HALF.HI = 0x170 - (super->parent)->zVelocity; + this->y.HALF.HI = 0x170 - (this->parent)->zVelocity; sub_0808BBE0(this); } } -void sub_0808BBE0(BarrelSpiderwebEntity* this) { +void sub_0808BBE0(Entity* this) { static const u16 gUnk_0812144C[] = { 192, 256, 208, 240, 224, 224, 240, 208, 256, 192, 256, 192, 240, 208, 224, 224, 208, 240, 192, 256 }; static const u8 gUnk_08121474[] = { 248, 250, 252, 254, 0, 0, 2, 4, 6, 8, 0, 0, }; const u16* ptr; - s32 diff = super->y.HALF.HI - gRoomControls.scroll_y; + s32 diff = this->y.HALF.HI - gRoomControls.scroll_y; if ((u32)diff < 0xa0) { diff /= 0x10; - super->spriteOffsetY = gUnk_08121474[diff]; + this->spriteOffsetY = gUnk_08121474[diff]; ptr = &gUnk_0812144C[diff * 2]; - SetAffineInfo(super, ptr[0], ptr[1], 0); + SetAffineInfo(this, ptr[0], ptr[1], 0); } else { - super->contactFlags &= ~0x80; + this->contactFlags &= ~0x80; } } -void BarrelSpiderweb_Action1(BarrelSpiderwebEntity* this) { +void BarrelSpiderweb_Action1(Entity* this) { s32 tmp; - super->x.HALF.HI = gRoomControls.origin_x + 0x78; + this->x.HALF.HI = gRoomControls.origin_x + 0x78; tmp = -0x170; - super->y.HALF.HI = gRoomControls.origin_y - ((super->parent)->zVelocity + tmp); + this->y.HALF.HI = gRoomControls.origin_y - ((this->parent)->zVelocity + tmp); sub_0808BBE0(this); - if (super->contactFlags == 0x93) { - super->timer--; - super->spriteSettings.draw = 1; - if (super->timer == 0) { + if (this->contactFlags == 0x93) { + this->timer--; + this->spriteSettings.draw = 1; + if (this->timer == 0) { SetGlobalFlag(LV1TARU_OPEN); - super->action = 2; - super->subtimer = 128; - super->spriteOffsetY = 0; + this->action = 2; + this->subtimer = 128; + this->spriteOffsetY = 0; } else { - if ((super->timer & 1) != 0) { - super->x.HALF.HI += ((Random() & 3) - 2); - super->y.HALF.HI += ((Random() & 3) - 1); + if ((this->timer & 1) != 0) { + this->x.HALF.HI += ((Random() & 3) - 2); + this->y.HALF.HI += ((Random() & 3) - 1); } - if (super->subtimer != 1) { - super->subtimer = 1; + if (this->subtimer != 1) { + this->subtimer = 1; LoadGfxGroup(0x4a); } } } else { - super->timer = 120; - super->spriteSettings.draw = 0; - if (super->subtimer != 0) { - super->subtimer = 0; + this->timer = 120; + this->spriteSettings.draw = 0; + if (this->subtimer != 0) { + this->subtimer = 0; LoadGfxGroup(0x49); } } } -void sub_0808BD00(BarrelSpiderwebEntity* this) { +void sub_0808BD00(Entity* this) { SetGlobalFlag(LV1TARU_OPEN); SoundReq(SFX_SECRET); DeleteThisEntity(); } -void BarrelSpiderweb_Action2(BarrelSpiderwebEntity* this) { +void BarrelSpiderweb_Action2(Entity* this) { - if (super->subtimer != 0) { - super->subtimer -= 8; - SetAffineInfo(super, 0x200 - super->subtimer, 0x200 - super->subtimer, 0); + if (this->subtimer != 0) { + this->subtimer -= 8; + SetAffineInfo(this, 0x200 - this->subtimer, 0x200 - this->subtimer, 0); } - if (super->contactFlags == 0x93) { - super->direction = GetFacingDirection(super, &gPlayerEntity); - LinearMoveUpdate(super); - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 6, 0x1c)) { + if (this->contactFlags == 0x93) { + this->direction = GetFacingDirection(this, &gPlayerEntity); + LinearMoveUpdate(this); + if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 6, 0x1c)) { sub_0808BD00(this); } } else { - if ((super->flags & ENT_COLLIDE) != 0) { - super->flags &= ~ENT_COLLIDE; - super->timer = 30; + if ((this->flags & ENT_COLLIDE) != 0) { + this->flags &= ~ENT_COLLIDE; + this->timer = 30; } else { - super->spriteSettings.draw ^= 1; - if (--super->timer == 0) { + this->spriteSettings.draw ^= 1; + if (--this->timer == 0) { sub_0808BD00(this); } } } } -void sub_0808BDB0(BarrelSpiderwebEntity* this) { +void sub_0808BDB0(Entity* this) { LinkedList* list = &gEntityLists[6]; Entity* it = list->first; - super->parent = NULL; + this->parent = NULL; for (; it != (Entity*)list; it = it->next) { if (it->kind == 0x9 && it->id == 0xc) { - super->parent = it; + this->parent = it; return; } } diff --git a/src/object/bedCover.c b/src/object/bedCover.c index fe21b77e..7e9f62a3 100644 --- a/src/object/bedCover.c +++ b/src/object/bedCover.c @@ -4,10 +4,8 @@ * * @brief Bed Cover object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/bell.c b/src/object/bell.c index 28edcb79..59d9baf5 100644 --- a/src/object/bell.c +++ b/src/object/bell.c @@ -4,28 +4,29 @@ * * @brief Bell object */ +#define NENT_DEPRECATED #include "object.h" -void Bell_Init(Entity*); -void Bell_Action1(Entity*); +void Bell_Init(Entity* this); +void Bell_Action1(Entity* this); -void Bell(Entity* ent) { +void Bell(Entity* this) { static void (*const Bell_Actions[])(Entity*) = { Bell_Init, Bell_Action1, }; - Bell_Actions[ent->action](ent); + Bell_Actions[this->action](this); } -void Bell_Init(Entity* ent) { - ent->action = 1; - ent->spriteSettings.draw = 1; - ent->collisionLayer = 1; - ent->spritePriority.b0 = 0; - UpdateSpriteForCollisionLayer(ent); - InitAnimationForceUpdate(ent, 0); +void Bell_Init(Entity* this) { + this->action = 1; + this->spriteSettings.draw = 1; + this->collisionLayer = 1; + this->spritePriority.b0 = 0; + UpdateSpriteForCollisionLayer(this); + InitAnimationForceUpdate(this, 0); } -void Bell_Action1(Entity* ent) { - UpdateAnimationSingleFrame(ent); +void Bell_Action1(Entity* this) { + UpdateAnimationSingleFrame(this); } diff --git a/src/object/bench.c b/src/object/bench.c index 5639efee..03ae3442 100644 --- a/src/object/bench.c +++ b/src/object/bench.c @@ -17,8 +17,8 @@ typedef struct { u16 tilePos; } BenchEntity; -void Bench_Init(BenchEntity*); -void Bench_Action1(BenchEntity*); +void Bench_Init(BenchEntity* this); +void Bench_Action1(BenchEntity* this); void Bench(Entity* this) { static void (*const Bench_Actions[])(BenchEntity*) = { diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c index 104cd470..5a827374 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -18,17 +18,17 @@ typedef struct { Entity base; - const u8* unk68; + const u8* unk_68; } BigBarrelEntity; -void sub_08088A68(BigBarrelEntity*); -void sub_08088C9C(BigBarrelEntity*); -void sub_08088DB4(BigBarrelEntity*); -void sub_08088E74(BigBarrelEntity*); -void sub_08088F20(BigBarrelEntity*); -void sub_08088BE0(BigBarrelEntity*); -void sub_08089094(BigBarrelEntity*); -void sub_080890EC(BigBarrelEntity*, const s16*, s32); +void BigBarrel_Type0(BigBarrelEntity* this); +void BigBarrel_Type1(BigBarrelEntity* this); +void BigBarrel_Type2(BigBarrelEntity* this); +void BigBarrel_Type3(BigBarrelEntity* this); +void BigBarrel_Type4(BigBarrelEntity* this); +void sub_08088BE0(BigBarrelEntity* this); +void sub_08089094(BigBarrelEntity* this); +void sub_080890EC(BigBarrelEntity* this, const s16*, s32); Entity* sub_08088C78(BigBarrelEntity*, u32, u32, u32); @@ -40,13 +40,13 @@ const s8 gUnk_08120C25[] = { 5, 0, 4, 0, 4, 0, 2, 0, -1 }; const s8 gUnk_08120C2E[] = { 3, 0, -1, 0, 0, 0 }; void BigBarrel(Entity* this) { - static void (*const typeFuncs[])(BigBarrelEntity*) = { - sub_08088A68, sub_08088C9C, sub_08088DB4, sub_08088E74, sub_08088F20, + static void (*const BigBarrel_Types[])(BigBarrelEntity*) = { + BigBarrel_Type0, BigBarrel_Type1, BigBarrel_Type2, BigBarrel_Type3, BigBarrel_Type4, }; - typeFuncs[this->type]((BigBarrelEntity*)this); + BigBarrel_Types[this->type]((BigBarrelEntity*)this); } -void sub_08088A68(BigBarrelEntity* this) { +void BigBarrel_Type0(BigBarrelEntity* this) { u32 uVar3; const u8* pcVar3; @@ -55,9 +55,9 @@ void sub_08088A68(BigBarrelEntity* this) { super->spriteSettings.draw = 3; super->updatePriority = 3; if (CheckGlobalFlag(LV1TARU_OPEN)) { - super->frameIndex = gSave.unk7 + 1; + super->frameIndex = gSave.dws_barrel_state + 1; } else { - super->frameIndex = gSave.unk7; + super->frameIndex = gSave.dws_barrel_state; } sub_08088BE0(this); if (CheckPlayerInRegion(super->x.HALF.HI - gRoomControls.origin_x, super->y.HALF.HI - gRoomControls.origin_y, @@ -68,30 +68,30 @@ void sub_08088A68(BigBarrelEntity* this) { if (gRoomVars.animFlags & 1) { gRoomVars.animFlags &= ~1; super->timer = 1; - this->unk68 = gUnk_08120C1C; + this->unk_68 = gUnk_08120C1C; SoundReq(SFX_BARREL_ENTER); } if (gRoomVars.animFlags & 2) { gRoomVars.animFlags &= ~2; super->timer = 1; - this->unk68 = gUnk_08120C25; + this->unk_68 = gUnk_08120C25; SoundReq(SFX_BARREL_RELEASE); } if (gRoomVars.animFlags & 4) { gRoomVars.animFlags &= ~4; super->timer = 1; - this->unk68 = gUnk_08120C2E; + this->unk_68 = gUnk_08120C2E; SoundReq(SFX_BARREL_ENTER); } if (super->timer) { if (super->timer-- == 1) { - pcVar3 = this->unk68; + pcVar3 = this->unk_68; uVar3 = pcVar3[0]; *(u8*)&super->spriteOffsetY = uVar3; pcVar3++; if (*pcVar3 != 0xff) { super->timer = 8; - this->unk68 = pcVar3; + this->unk_68 = pcVar3; } else { super->spriteOffsetY = 0; } @@ -143,7 +143,7 @@ Entity* sub_08088C78(BigBarrelEntity* this, u32 type, u32 type2, u32 xOffset) { return pEVar1; } -void sub_08088C9C(BigBarrelEntity* this) { +void BigBarrel_Type1(BigBarrelEntity* this) { static const u8 gUnk_08120C48[] = { 2, 3, 4, 5, 6, 7, 7, 7 }; static const s8 gUnk_08120C50[] = { 8, -8 }; u32 localFlag; @@ -203,7 +203,7 @@ void sub_08088C9C(BigBarrelEntity* this) { } } -void sub_08088DB4(BigBarrelEntity* this) { +void BigBarrel_Type2(BigBarrelEntity* this) { switch (super->action) { case 0: super->action = 1; @@ -242,7 +242,7 @@ void sub_08088DB4(BigBarrelEntity* this) { } } -void sub_08088E74(BigBarrelEntity* this) { +void BigBarrel_Type3(BigBarrelEntity* this) { static const s8 gUnk_08120C52[] = { -2, 0, 2, 0 }; Entity* ent; @@ -268,8 +268,8 @@ void sub_08088E74(BigBarrelEntity* this) { } } -void sub_08088F20(BigBarrelEntity* this) { - Entity* pEVar3; +void BigBarrel_Type4(BigBarrelEntity* this) { + Entity* flame; switch (super->action) { case 0: @@ -287,13 +287,13 @@ void sub_08088F20(BigBarrelEntity* this) { super->action = 2; super->timer = 30; RequestPriorityDuration(super, 270); - pEVar3 = CreateObject(FLAME, 1, 0); - if (pEVar3 != NULL) { - pEVar3->updatePriority = 3; - pEVar3->x.HALF.HI = super->x.HALF.HI; - pEVar3->y.HALF.HI = super->y.HALF.HI; - pEVar3->collisionLayer = 2; - pEVar3->spritePriority.b0 = 2; + flame = CreateObject(FLAME, 1, 0); + if (flame != NULL) { + flame->updatePriority = 3; + flame->x.HALF.HI = super->x.HALF.HI; + flame->y.HALF.HI = super->y.HALF.HI; + flame->collisionLayer = 2; + flame->spritePriority.b0 = 2; } SetMetaTileType(META_TILE_TYPE_118, COORD_TO_TILE(super), LAYER_TOP); break; diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index 40ad2817..2e907d92 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -4,7 +4,6 @@ * * @brief Big Ice Block object */ - #define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index 75733f01..f0a691ae 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -4,7 +4,6 @@ * * @brief Big Pushable Lever object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 6d11e27a..f7bacd3d 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -4,92 +4,98 @@ * * @brief Big Vortex object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "object.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[30]; + /*0x86*/ u16 unk_86; +} BigVortexEntity; + void sub_08098E3C(Entity*); void sub_08098E88(Entity*); -void BigVortex_Init(Entity*); -void BigVortex_Action1(Entity*); -void BigVortex_Action2(Entity*); -void BigVortex_Action3(Entity*); -void BigVortex_Action4(Entity*); +void BigVortex_Init(BigVortexEntity* this); +void BigVortex_Action1(BigVortexEntity* this); +void BigVortex_Action2(BigVortexEntity* this); +void BigVortex_Action3(BigVortexEntity* this); +void BigVortex_Action4(BigVortexEntity* this); -void BigVortex(Entity* this) { - static void (*const BigVortex_Actions[])(Entity*) = { +void BigVortex(BigVortexEntity* this) { + static void (*const BigVortex_Actions[])(BigVortexEntity*) = { BigVortex_Init, BigVortex_Action1, BigVortex_Action2, BigVortex_Action3, BigVortex_Action4, }; - if (this->type == 0) { - BigVortex_Actions[this->action](this); + if (super->type == 0) { + BigVortex_Actions[super->action](this); } else { - sub_08098E3C(this); + sub_08098E3C(super); } } -void BigVortex_Init(Entity* this) { +void BigVortex_Init(BigVortexEntity* this) { u32 temp; - this->action = 1; - this->z.HALF.HI = -0x10; + super->action = 1; + super->z.HALF.HI = -0x10; - temp = this->field_0x86.HWORD; + temp = this->unk_86; if ((temp != 0) && !CheckFlags(temp)) { - this->action = 1; + super->action = 1; } else { - this->action = 3; - this->spriteSettings.draw = TRUE; - sub_08098E88(this); + super->action = 3; + super->spriteSettings.draw = TRUE; + sub_08098E88(super); } - SetDefaultPriority(this, PRIO_PLAYER_EVENT); - InitAnimationForceUpdate(this, 0); + SetDefaultPriority(super, PRIO_PLAYER_EVENT); + InitAnimationForceUpdate(super, 0); } -void BigVortex_Action1(Entity* this) { - Entity* ent; +void BigVortex_Action1(BigVortexEntity* this) { + Entity* fx; - if (CheckFlags(this->field_0x86.HWORD)) { - this->action = 2; - this->timer = 45; - ent = CreateFx(this, FX_BIG_EXPLOSION2, 0); - if (ent != NULL) { - ent->y.HALF.HI += 8; + if (CheckFlags(this->unk_86)) { + super->action = 2; + super->timer = 45; + fx = CreateFx(super, FX_BIG_EXPLOSION2, 0); + if (fx != NULL) { + fx->y.HALF.HI += 8; } } } -void BigVortex_Action2(Entity* this) { - if (--this->timer == 0) { - this->action = 3; - this->spriteSettings.draw = TRUE; - sub_08098E88(this); +void BigVortex_Action2(BigVortexEntity* this) { + if (--super->timer == 0) { + super->action = 3; + super->spriteSettings.draw = TRUE; + sub_08098E88(super); } } -void BigVortex_Action3(Entity* this) { +void BigVortex_Action3(BigVortexEntity* this) { - if (sub_0800419C(this, &gPlayerEntity, 8, 8) != 0) { - CopyPosition(this, &gPlayerEntity); - sub_08004542(this); + if (sub_0800419C(super, &gPlayerEntity, 8, 8) != 0) { + CopyPosition(super, &gPlayerEntity); + sub_08004542(super); sub_08004542(&gPlayerEntity); gPlayerEntity.collisionLayer = 1; - SortEntityAbove(this, &gPlayerEntity); + SortEntityAbove(super, &gPlayerEntity); gPlayerState.queued_action = PLAYER_PARACHUTE; gPlayerState.field_0x38 = 1; - gPlayerState.field_0x39 = this->type2; - this->action = 4; - if (this->type2 == 1) { + gPlayerState.field_0x39 = super->type2; + super->action = 4; + if (super->type2 == 1) { SetGlobalFlag(TATSUMAKI); } PutAwayItems(); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void BigVortex_Action4(Entity* this) { - UpdateAnimationSingleFrame(this); +void BigVortex_Action4(BigVortexEntity* this) { + UpdateAnimationSingleFrame(super); } void sub_08098E3C(Entity* this) { diff --git a/src/object/bird.c b/src/object/bird.c index 6520cea8..390b9344 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -4,234 +4,241 @@ * * @brief Bird object */ +#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "game.h" #include "item.h" #include "message.h" #include "object.h" +#include "object/cutsceneOrchestrator.h" #include "save.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ s16 gravity; +} BirdEntity; + extern u16 script_EzloTalkOcarina[]; -void Bird_Type0(Entity*); -void Bird_Type1(Entity*); -void Bird_Type2(Entity*); -void Bird_Type3(Entity*); -void Bird_Type8(Entity*); -void Bird_Type9(Entity*); -void Bird_Type10(Entity*); -void Bird_Type0_Init(Entity*); -void Bird_Type0_Action1(Entity*); -void Bird_Type1_Init(Entity*); -void Bird_Type1_Action1(Entity*); -void Bird_Type1_Action1_Subaction0(Entity*); -void Bird_Type1_Action1_Subaction1(Entity*); -void Bird_Type2_Init(Entity*); -void Bird_Type2_Action1(Entity*); +void Bird_Type0(BirdEntity* this); +void Bird_Type1(BirdEntity* this); +void Bird_Type2(BirdEntity* this); +void Bird_Type3(BirdEntity* this); +void Bird_Type8(BirdEntity* this); +void Bird_Type9(BirdEntity* this); +void Bird_Type10(BirdEntity* this); +void Bird_Type0_Init(BirdEntity* this); +void Bird_Type0_Action1(BirdEntity* this); +void Bird_Type1_Init(BirdEntity* this); +void Bird_Type1_Action1(BirdEntity* this); +void Bird_Type1_Action1_Subaction0(BirdEntity* this); +void Bird_Type1_Action1_Subaction1(BirdEntity* this); +void Bird_Type2_Init(BirdEntity* this); +void Bird_Type2_Action1(BirdEntity* this); -void Bird(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { +void Bird(BirdEntity* this) { + static void (*const typeFuncs[])(BirdEntity*) = { Bird_Type0, Bird_Type1, Bird_Type2, Bird_Type3, Bird_Type3, Bird_Type3, Bird_Type3, Bird_Type3, Bird_Type8, Bird_Type9, Bird_Type10, }; - typeFuncs[this->type](this); + typeFuncs[super->type](this); } -void Bird_Type0(Entity* this) { - static void (*const Bird_Type0_Actions[])(Entity*) = { +void Bird_Type0(BirdEntity* this) { + static void (*const Bird_Type0_Actions[])(BirdEntity*) = { Bird_Type0_Init, Bird_Type0_Action1, }; - Bird_Type0_Actions[this->action](this); + Bird_Type0_Actions[super->action](this); } -void Bird_Type0_Init(Entity* this) { +void Bird_Type0_Init(BirdEntity* this) { Entity* target; - this->action++; - this->spriteSettings.draw = TRUE; - this->timer = 49; - this->subtimer = 1; - this->zVelocity = Q_16_16(-1.5); - this->z.WORD = Q_16_16(-56.75); - this->field_0x68.HWORD = Q_8_8(-8.0); - this->speed = 0x280; - this->direction = 8; - this->collisionLayer = 2; - this->x.HALF.HI = gRoomControls.scroll_x; + super->action++; + super->spriteSettings.draw = TRUE; + super->timer = 49; + super->subtimer = 1; + super->zVelocity = Q_16_16(-1.5); + super->z.WORD = Q_16_16(-56.75); + this->gravity = Q_8_8(-8.0); + super->speed = 0x280; + super->direction = 8; + super->collisionLayer = 2; + super->x.HALF.HI = gRoomControls.scroll_x; SoundReq(SFX_123); - UpdateSpriteForCollisionLayer(this); - InitAnimationForceUpdate(this, 0); + UpdateSpriteForCollisionLayer(super); + InitAnimationForceUpdate(super, 0); target = CreateObject(BIRD, 1, 0); if (target != NULL) { - target->parent = this; - PositionRelative(this, target, 0, Q_16_16(8.0)); - SortEntityAbove(this, target); + target->parent = super; + PositionRelative(super, target, 0, Q_16_16(8.0)); + SortEntityAbove(super, target); } } -void Bird_Type0_Action1(Entity* this) { - LinearMoveUpdate(this); - GravityUpdate(this, *(s16*)&this->field_0x68.HWORD); - if (this->timer != 0) { - if (--this->timer == 0) { - this->subtimer = 0; +void Bird_Type0_Action1(BirdEntity* this) { + LinearMoveUpdate(super); + GravityUpdate(super, this->gravity); + if (super->timer != 0) { + if (--super->timer == 0) { + super->subtimer = 0; } - } else if (CheckOnScreen(this) == 0) { + } else if (CheckOnScreen(super) == 0) { DeleteThisEntity(); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void Bird_Type1(Entity* this) { - static void (*const Bird_Type1_Actions[])(Entity*) = { +void Bird_Type1(BirdEntity* this) { + static void (*const Bird_Type1_Actions[])(BirdEntity*) = { Bird_Type1_Init, Bird_Type1_Action1, }; - Bird_Type1_Actions[this->action](this); + Bird_Type1_Actions[super->action](this); } -void Bird_Type1_Init(Entity* this) { - this->action++; - this->collisionLayer = 1; - UpdateSpriteForCollisionLayer(this); - InitAnimationForceUpdate(this, 0x17); +void Bird_Type1_Init(BirdEntity* this) { + super->action++; + super->collisionLayer = 1; + UpdateSpriteForCollisionLayer(super); + InitAnimationForceUpdate(super, 0x17); } -void Bird_Type1_Action1(Entity* this) { - static void (*const Bird_Type1_Action1_Subactions[])(Entity*) = { +void Bird_Type1_Action1(BirdEntity* this) { + static void (*const Bird_Type1_Action1_Subactions[])(BirdEntity*) = { Bird_Type1_Action1_Subaction0, Bird_Type1_Action1_Subaction1, }; - Bird_Type1_Action1_Subactions[this->subAction](this); + Bird_Type1_Action1_Subactions[super->subAction](this); } -void Bird_Type1_Action1_Subaction0(Entity* this) { +void Bird_Type1_Action1_Subaction0(BirdEntity* this) { u32 temp; - if (this->parent != NULL) { - temp = this->parent->subtimer; + if (super->parent != NULL) { + temp = super->parent->subtimer; if (temp != 0) { - PositionRelative(this->parent, this, 0, Q_16_16(8.0)); + PositionRelative(super->parent, super, 0, Q_16_16(8.0)); } else { - this->subAction++; - this->zVelocity = temp; + super->subAction++; + super->zVelocity = temp; } } } -void Bird_Type1_Action1_Subaction1(Entity* this) { +void Bird_Type1_Action1_Subaction1(BirdEntity* this) { Entity* fx; - if (sub_080044EC(this, 0x1800) < 2) { - this->type = 2; - this->action = 1; - this->z.WORD = 0; - this->collisionLayer = 1; + if (sub_080044EC(super, 0x1800) < 2) { + super->type = 2; + super->action = 1; + super->z.WORD = 0; + super->collisionLayer = 1; SetLocalFlag(LV3_OCARINA_FALL); SoundReq(SFX_SECRET); - fx = CreateFx(this, FX_DASH, 0); + fx = CreateFx(super, FX_DASH, 0); if (fx != NULL) { - SortEntityBelow(this, fx); + SortEntityBelow(super, fx); } } } -void Bird_Type2(Entity* this) { - static void (*const Bird_Type2_Actions[])(Entity*) = { +void Bird_Type2(BirdEntity* this) { + static void (*const Bird_Type2_Actions[])(BirdEntity*) = { Bird_Type2_Init, Bird_Type2_Action1, }; - Bird_Type2_Actions[this->action](this); + Bird_Type2_Actions[super->action](this); } -void Bird_Type2_Init(Entity* this) { - this->action++; - this->collisionLayer = 1; - UpdateSpriteForCollisionLayer(this); - InitAnimationForceUpdate(this, 0x17); +void Bird_Type2_Init(BirdEntity* this) { + super->action++; + super->collisionLayer = 1; + UpdateSpriteForCollisionLayer(super); + InitAnimationForceUpdate(super, 0x17); } -void Bird_Type2_Action1(Entity* this) { +void Bird_Type2_Action1(BirdEntity* this) { if ((gPlayerState.flags & PL_MINISH) != 0) { - sub_0800445C(this); - } else if (IsCollidingPlayer(this) != 0) { + sub_0800445C(super); + } else if (IsCollidingPlayer(super) != 0) { CreateItemEntity(ITEM_OCARINA, 0, 0); gSave.windcrests |= 0x10000000; DeleteThisEntity(); } } -void Bird_Type3(Entity* this) { +void Bird_Type3(BirdEntity* this) { - if (this->action == 0) { - this->action++; - this->collisionLayer = 2; - UpdateSpriteForCollisionLayer(this); - this->frame = 0x80; + if (super->action == 0) { + super->action++; + super->collisionLayer = 2; + UpdateSpriteForCollisionLayer(super); + super->frame = 0x80; } - if ((this->frame & ANIM_DONE) != 0) { - InitializeAnimation(this, Random() & 3); - this->frameDuration = (Random() & 0xf) + 0x10; - this->spriteSettings.flipX = FALSE; + if ((super->frame & ANIM_DONE) != 0) { + InitializeAnimation(super, Random() & 3); + super->frameDuration = (Random() & 0xf) + 0x10; + super->spriteSettings.flipX = FALSE; if ((Random() & 1) != 0) { - this->spriteSettings.flipX = TRUE; + super->spriteSettings.flipX = TRUE; } } else { - GetNextFrame(this); + GetNextFrame(super); } } -void Bird_Type8(Entity* this) { +void Bird_Type8(BirdEntity* this) { Entity* pEVar5; - switch (this->action) { + switch (super->action) { case 0: - if (this->timer != 0) { - this->frameIndex = 0xff; - this->timer--; + if (super->timer != 0) { + super->frameIndex = 0xff; + super->timer--; return; } - this->action = 1; - this->zVelocity = 0; - this->z.WORD = Q_16_16(-20.0); - this->speed = 0x180; - this->direction = 8; - this->collisionLayer = 1; - this->spritePriority.b0 = 0; - this->spriteRendering.b3 = 0; - this->spriteOrientation.flipY = 1; - this->x.HALF.HI = gRoomControls.scroll_x; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI; - this->child = NULL; - SetDefaultPriority(this, 6); - InitAnimationForceUpdate(this, 0); + super->action = 1; + super->zVelocity = 0; + super->z.WORD = Q_16_16(-20.0); + super->speed = 0x180; + super->direction = 8; + super->collisionLayer = 1; + super->spritePriority.b0 = 0; + super->spriteRendering.b3 = 0; + super->spriteOrientation.flipY = 1; + super->x.HALF.HI = gRoomControls.scroll_x; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->child = NULL; + SetDefaultPriority(super, 6); + InitAnimationForceUpdate(super, 0); SoundReq(0x123); break; case 1: - this->collisionLayer = gPlayerEntity.collisionLayer; - this->speed += 8; - if (this->speed > 0x300) { - this->speed = 0x300; + super->collisionLayer = gPlayerEntity.collisionLayer; + super->speed += 8; + if (super->speed > 0x300) { + super->speed = 0x300; } if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE && gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && - PlayerCanBeMoved() && (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) { - s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8; + PlayerCanBeMoved() && (EntityInRectRadius(super, &gPlayerEntity, 0xe, 0xe))) { + s32 z = gPlayerEntity.z.HALF.HI - super->z.HALF.HI - 8; if ((u16)z < 0x20 && gPlayerEntity.health != 0) { pEVar5 = CreateObject(BIRD, 10, 0); if (pEVar5 != NULL) { - this->child = pEVar5; - this->action = 2; - this->timer = 8; - this->speed = 0x300; - this->field_0x68.HWORD = Q_8_8(-32.0); + super->child = pEVar5; + super->action = 2; + super->timer = 8; + super->speed = 0x300; + this->gravity = Q_8_8(-32.0); PlayerDropHeldObject(); sub_08078B48(); ResetPlayerAnimationAndAction(); @@ -251,33 +258,33 @@ void Bird_Type8(Entity* this) { gPlayerEntity.spriteSettings.draw = 0; break; } - LinearMoveUpdate(this); - GravityUpdate(this, (s16)this->field_0x68.HWORD); - UpdateAnimationSingleFrame(this); - pEVar5 = this->child; + LinearMoveUpdate(super); + GravityUpdate(super, (s16)this->gravity); + UpdateAnimationSingleFrame(super); + pEVar5 = super->child; if (pEVar5 != NULL) { - if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI - 8) { - this->timer = 0; + if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI - 8) { + super->timer = 0; } - if (this->timer == 0) { - PositionRelative(this, pEVar5, 0xfff80000, 0); + if (super->timer == 0) { + PositionRelative(super, pEVar5, 0xfff80000, 0); pEVar5->z.HALF.HI += 0x18; - pEVar5->spritePriority.b0 = this->spritePriority.b0; - pEVar5->spriteRendering.b3 = this->spriteRendering.b3; - pEVar5->spriteOrientation.flipY = this->spriteOrientation.flipY; + pEVar5->spritePriority.b0 = super->spritePriority.b0; + pEVar5->spriteRendering.b3 = super->spriteRendering.b3; + pEVar5->spriteOrientation.flipY = super->spriteOrientation.flipY; } else { - this->timer--; + super->timer--; CopyPosition(&gPlayerEntity, pEVar5); } } - if (CheckOnScreen(this) == 0) { - if (this->action == 2) { + if (CheckOnScreen(super) == 0) { + if (super->action == 2) { gSave.windcrests |= 0x10000000; MenuFadeIn(9, 0); } - pEVar5 = this->child; + pEVar5 = super->child; if (pEVar5 != NULL) { DeleteEntityAny(pEVar5); } @@ -285,43 +292,42 @@ void Bird_Type8(Entity* this) { } } -void Bird_Type9(Entity* this) { - Entity* pEVar1; +void Bird_Type9(BirdEntity* this) { Entity* child; - if (this->action == 0) { - this->action = 1; - this->spriteSettings.draw = 1; - this->zVelocity = Q_16_16(-2.5); - this->z.WORD = Q_16_16(-75.25); - this->field_0x68.HWORD = Q_8_8(-16.0); - this->speed = 0x300; - this->direction = 8; - this->collisionLayer = 1; - this->spritePriority.b0 = 0; - this->spriteRendering.b3 = 0; - this->spriteOrientation.flipY = 1; - SetDefaultPriority(this, 6); - this->x.HALF.HI = gRoomControls.scroll_x; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI; + if (super->action == 0) { + super->action = 1; + super->spriteSettings.draw = 1; + super->zVelocity = Q_16_16(-2.5); + super->z.WORD = Q_16_16(-75.25); + this->gravity = Q_8_8(-16.0); + super->speed = 0x300; + super->direction = 8; + super->collisionLayer = 1; + super->spritePriority.b0 = 0; + super->spriteRendering.b3 = 0; + super->spriteOrientation.flipY = 1; + SetDefaultPriority(super, 6); + super->x.HALF.HI = gRoomControls.scroll_x; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI; SoundReq(SFX_123); - this->spritePriority.b1 = 2; - InitAnimationForceUpdate(this, 0); + super->spritePriority.b1 = 2; + InitAnimationForceUpdate(super, 0); sub_08078B48(); - } else if (this->action == 1) { + } else if (super->action == 1) { gPlayerEntity.spriteSettings.draw = 0; - child = this->child; + child = super->child; if (child != NULL) { - PositionRelative(this, child, Q_16_16(-8), 0); + PositionRelative(super, child, Q_16_16(-8), 0); child->z.HALF.HI += 0x18; - child->spritePriority.b0 = this->spritePriority.b0; - child->spriteRendering.b3 = this->spriteRendering.b3; - child->spriteOrientation.flipY = this->spriteOrientation.flipY; + child->spritePriority.b0 = super->spritePriority.b0; + child->spriteRendering.b3 = super->spriteRendering.b3; + child->spriteOrientation.flipY = super->spriteOrientation.flipY; } sub_08078B48(); - if (gRoomControls.scroll_x + 0x78 < this->x.HALF.HI) { - this->action++; - this->spritePriority.b1 = 1; + if (gRoomControls.scroll_x + 0x78 < super->x.HALF.HI) { + super->action++; + super->spritePriority.b1 = 1; if (child != NULL) { child->action++; } @@ -331,39 +337,40 @@ void Bird_Type9(Entity* this) { ResetPlayerEventPriority(); gPauseMenuOptions.disabled = 0; if (!CheckGlobalFlag(WARP_1ST)) { - pEVar1 = CreateObject(CUTSCENE_ORCHESTRATOR, 0, 0); - if (pEVar1 != NULL) { - *(ScriptExecutionContext**)&pEVar1->cutsceneBeh = StartCutscene(pEVar1, script_EzloTalkOcarina); + CutsceneOrchestratorEntity* orchestrator = + (CutsceneOrchestratorEntity*)CreateObject(CUTSCENE_ORCHESTRATOR, 0, 0); + if (orchestrator != NULL) { + orchestrator->context = StartCutscene(&orchestrator->base, script_EzloTalkOcarina); SetGlobalFlag(WARP_1ST); } } } } - LinearMoveUpdate(this); - GravityUpdate(this, (short)this->field_0x68.HWORD); - UpdateAnimationSingleFrame(this); - if (!CheckOnScreen(this)) { + LinearMoveUpdate(super); + GravityUpdate(super, (short)this->gravity); + UpdateAnimationSingleFrame(super); + if (!CheckOnScreen(super)) { DeleteThisEntity(); } } -void Bird_Type10(Entity* this) { - this->palette.b.b0 = gPlayerEntity.palette.b.b0; - switch (this->action) { +void Bird_Type10(BirdEntity* this) { + super->palette.b.b0 = gPlayerEntity.palette.b.b0; + switch (super->action) { case 0: - this->action = 1; - this->spriteSettings.draw = 1; - this->collisionLayer = 1; - this->spritePriority.b0 = 0; - this->spriteRendering.b3 = 0; - this->spriteOrientation.flipY = 1; - SetDefaultPriority(this, 6); - InitAnimationForceUpdate(this, 0xe0); + super->action = 1; + super->spriteSettings.draw = 1; + super->collisionLayer = 1; + super->spritePriority.b0 = 0; + super->spriteRendering.b3 = 0; + super->spriteOrientation.flipY = 1; + SetDefaultPriority(super, 6); + InitAnimationForceUpdate(super, 0xe0); case 1: - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); break; case 2: - this->action = 3; + super->action = 3; break; case 3: DeleteThisEntity(); @@ -372,8 +379,6 @@ void Bird_Type10(Entity* this) { } void CreateBird(Entity* this) { - Entity* birdEnt; - // EU only allows warp from the overworld. This prevents warping from the rooftop of the Wind Tribe's tower. #ifndef EU if (AreaAllowsWarp()) { @@ -381,9 +386,9 @@ void CreateBird(Entity* this) { if (AreaIsOverworld()) { #endif if (!FindEntity(OBJECT, BIRD, 6, 8, 0)) { - birdEnt = CreateObject(BIRD, 8, 0); - if (birdEnt != NULL) { - birdEnt->timer = 0; + Entity* bird = CreateObject(BIRD, 8, 0); + if (bird != NULL) { + bird->timer = 0; } } } diff --git a/src/object/blockPushed.c b/src/object/blockPushed.c index e80640c2..f6a4fb40 100644 --- a/src/object/blockPushed.c +++ b/src/object/blockPushed.c @@ -4,7 +4,6 @@ * * @brief Block Pushed object */ - #define NENT_DEPRECATED #include "area.h" #include "functions.h" diff --git a/src/object/book.c b/src/object/book.c index ece50550..36f76c6a 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -4,6 +4,7 @@ * * @brief Book object */ +#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "item.h" @@ -11,19 +12,27 @@ #include "npc.h" #include "object.h" -extern void (*const Book_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unused2[5]; + /*0x86*/ u16 unk_86; +} BookEntity; + +extern void (*const Book_Actions[])(BookEntity*); extern s8 const gUnk_08123D94[]; u32 sub_0809B688(Entity*); void sub_0809B6B0(Entity*, Entity*); -void Book(Entity* this) { - Book_Actions[this->action](this); +void Book(BookEntity* this) { + Book_Actions[super->action](this); } -void Book_Init(Entity* this) { - u32 obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1); - if (this->type2 != 3) { +void Book_Init(BookEntity* this) { + u32 obtained = GetInventoryValue(super->type + ITEM_QST_BOOK1); + if (super->type2 != 3) { if (obtained != 0) { DeleteThisEntity(); } @@ -33,70 +42,70 @@ void Book_Init(Entity* this) { } if (obtained != 2) { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } } - this->spriteOffsetY = 3; - if (CheckFlags(this->field_0x86.HWORD)) { - if (this->type2 == 0) { - this->y.HALF.HI += 48; + super->spriteOffsetY = 3; + if (CheckFlags(this->unk_86)) { + if (super->type2 == 0) { + super->y.HALF.HI += 48; } - this->type2 = 2; + super->type2 = 2; } - UpdateSpriteForCollisionLayer(this); - InitAnimationForceUpdate(this, this->type + ITEM_QST_BOOK1); + UpdateSpriteForCollisionLayer(super); + InitAnimationForceUpdate(super, super->type + ITEM_QST_BOOK1); - switch (this->type2) { + switch (super->type2) { case 0: - this->action = 1; - this->timer = 22; - this->subtimer = 2; - this->field_0x80.HALF.LO = 0; - this->spritePriority.b0 = 3; + super->action = 1; + super->timer = 22; + super->subtimer = 2; + this->unk_80 = 0; + super->spritePriority.b0 = 3; break; case 1: { u32 scroll; u32 height; - this->action = 3; + super->action = 3; scroll = (u16)gRoomControls.scroll_y - 0x10; - height = (u16)this->y.HALF.HI - scroll; - this->z.HALF.HI -= height; + height = (u16)super->y.HALF.HI - scroll; + super->z.HALF.HI -= height; break; } case 2: - this->action = 4; + super->action = 4; break; case 3: - this->action = 5; - this->subAction = 0; - this->spritePriority.b0 = 3; + super->action = 5; + super->subAction = 0; + super->spritePriority.b0 = 3; break; default: break; } } -void Book_Action1(Entity* this) { - sub_0800445C(this); +void Book_Action1(BookEntity* this) { + sub_0800445C(super); - if (this->field_0x80.HALF.LO != 0) { - this->field_0x80.HALF.LO--; + if (this->unk_80 != 0) { + this->unk_80--; return; } - if (sub_0809B688(this)) { - if (--this->timer) { + if (sub_0809B688(super)) { + if (--super->timer) { return; } - this->action = 2; - this->timer = 30; - this->speed = 0x40; - this->direction = 0x10; + super->action = 2; + super->timer = 30; + super->speed = 0x40; + super->direction = 0x10; gPlayerState.pushedObject = TREE_THORNS; gPlayerState.queued_action = PLAYER_PUSH; @@ -107,79 +116,79 @@ void Book_Action1(Entity* this) { gPlayerEntity.direction = gPlayerEntity.animationState << 2; EnqueueSFX(SFX_10F); } else { - this->timer = 22; + super->timer = 22; } } -void Book_Action2(Entity* this) { - if (--this->timer == 0) { - if (--this->subtimer == 0) { - this->action = 3; - this->y.HALF.HI += 0x20; - this->z.HALF.HI -= 0x20; +void Book_Action2(BookEntity* this) { + if (--super->timer == 0) { + if (--super->subtimer == 0) { + super->action = 3; + super->y.HALF.HI += 0x20; + super->z.HALF.HI -= 0x20; } else { - this->action = 1; - this->timer = 22; - this->field_0x80.HALF.LO = 0x18; + super->action = 1; + super->timer = 22; + this->unk_80 = 0x18; } } - LinearMoveUpdate(this); + LinearMoveUpdate(super); } -void Book_Action3(Entity* this) { +void Book_Action3(BookEntity* this) { Entity* fx; - if (sub_080044EC(this, 0x2800) != 1) { + if (sub_080044EC(super, 0x2800) != 1) { return; } - this->action = 4; - this->spritePriority.b0 = 4; + super->action = 4; + super->spritePriority.b0 = 4; - SetFlag(this->field_0x86.HWORD); + SetFlag(this->unk_86); - fx = CreateFx(this, FX_DEATH, 0); + fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { - SortEntityAbove(this, fx); + SortEntityAbove(super, fx); } } -void Book_Action4(Entity* this) { +void Book_Action4(BookEntity* this) { if (gPlayerState.flags & PL_MINISH) { - sub_0800445C(this); - } else if (IsCollidingPlayer(this)) { - CreateItemEntity(this->type + ITEM_QST_BOOK1, 0, 0); + sub_0800445C(super); + } else if (IsCollidingPlayer(super)) { + CreateItemEntity(super->type + ITEM_QST_BOOK1, 0, 0); DeleteThisEntity(); } } -void Book_Action5(Entity* this) { - if (this->spriteSettings.draw == 1) { - switch (this->subAction) { +void Book_Action5(BookEntity* this) { + if (super->spriteSettings.draw == 1) { + switch (super->subAction) { case 0: { Entity* parent = FindEntityByID(NPC, STURGEON, 7); if (parent == NULL) { return; } - if (parent->x.HALF.HI < this->x.HALF.HI) { + if (parent->x.HALF.HI < super->x.HALF.HI) { return; } if (parent->animationState != 4) { return; } - this->parent = parent; - this->subAction = 1; - sub_0809B6B0(this->parent, this); + super->parent = parent; + super->subAction = 1; + sub_0809B6B0(super->parent, super); break; } case 1: { - if ((this->parent == NULL) || (this->parent->next == NULL)) { + if ((super->parent == NULL) || (super->parent->next == NULL)) { DeleteThisEntity(); return; } - sub_0809B6B0(this->parent, this); + sub_0809B6B0(super->parent, super); break; } default: @@ -187,22 +196,22 @@ void Book_Action5(Entity* this) { } } else { - switch (this->subAction) { + switch (super->subAction) { default: { DeleteThisEntity(); break; } case 0: { - if (GetInventoryValue(this->type + ITEM_QST_BOOK1) == 2) { - this->subAction = 1; + if (GetInventoryValue(super->type + ITEM_QST_BOOK1) == 2) { + super->subAction = 1; } break; } case 1: { u8 doTextBox = gMessage.doTextBox & 0x7f; if (!doTextBox) { - this->spriteSettings.draw = 1; - this->subAction = doTextBox; + super->spriteSettings.draw = 1; + super->subAction = doTextBox; } break; } @@ -213,7 +222,7 @@ void Book_Action5(Entity* this) { u32 sub_0809B688(Entity* this) { u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12); - if (ret == 1 && gPlayerState.direction != 16) { + if (ret == 1 && gPlayerState.direction != DirectionSouth) { ret = 0; } @@ -229,7 +238,7 @@ void sub_0809B6B0(Entity* parent, Entity* this) { this->spritePriority.b0 = 3 - this->type; } -void (*const Book_Actions[])(Entity*) = { +void (*const Book_Actions[])(BookEntity*) = { Book_Init, Book_Action1, Book_Action2, Book_Action3, Book_Action4, Book_Action5, }; diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c index a3bac959..a8fc0d4d 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -4,7 +4,6 @@ * * @brief Boss Door object */ - #define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" @@ -85,7 +84,7 @@ void BossDoor_Init(BossDoorEntity* this) { } void BossDoor_Action1(BossDoorEntity* this) { - if (super->interactType != 0) { + if (super->interactType != INTERACTION_NONE) { super->action = 2; RemoveInteractableObject(super); SetFlag(this->unk_86); diff --git a/src/object/button.c b/src/object/button.c index a7f2a9ac..317d8e50 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -4,177 +4,189 @@ * * @brief Button object */ -#include "object.h" +#define NENT_DEPRECATED #include "functions.h" #include "tiles.h" +#include "object.h" -void Button_Init(Entity*); -void Button_Action1(Entity*); -void Button_Action2(Entity*); -void Button_Action3(Entity*); -void Button_Action4(Entity*); -void Button_Action5(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u16 unk_72; + /*0x74*/ u16 metaTilePos; + /*0x76*/ u8 unused2[14]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} ButtonEntity; -void Button(Entity* this) { - static void (*const Button_Actions[])(Entity*) = { +void Button_Init(ButtonEntity* this); +void Button_Action1(ButtonEntity* this); +void Button_Action2(ButtonEntity* this); +void Button_Action3(ButtonEntity* this); +void Button_Action4(ButtonEntity* this); +void Button_Action5(ButtonEntity* this); + +void Button(ButtonEntity* this) { + static void (*const Button_Actions[])(ButtonEntity*) = { Button_Init, Button_Action1, Button_Action2, Button_Action3, Button_Action4, Button_Action5, }; - Button_Actions[this->action](this); + Button_Actions[super->action](this); } -extern u32 sub_08081E3C(Entity*); +extern u32 sub_08081E3C(ButtonEntity*); -void Button_Init(Entity* this) { - COLLISION_OFF(this); - this->updatePriority = PRIO_NO_BLOCK; - this->y.HALF.HI++; - if (this->cutsceneBeh.HWORD != 0) { - this->collisionLayer = this->cutsceneBeh.HWORD; +void Button_Init(ButtonEntity* this) { + COLLISION_OFF(super); + super->updatePriority = PRIO_NO_BLOCK; + super->y.HALF.HI++; + if (this->unk_84 != 0) { + super->collisionLayer = this->unk_84; } - this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | - ((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6); - this->field_0x70.HALF.HI = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); - if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) { - this->action = 5; - SetMetaTileType(META_TILE_TYPE_122, this->field_0x74.HWORD, this->collisionLayer); + this->metaTilePos = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | + ((((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6); + this->unk_72 = GetMetaTileType(this->metaTilePos, super->collisionLayer); + if (super->type == 0 && CheckFlags(this->unk_86)) { + super->action = 5; + SetMetaTileType(META_TILE_TYPE_122, this->metaTilePos, super->collisionLayer); } else { if (sub_08081E3C(this)) { - this->action = 2; + super->action = 2; } else { - this->action = 1; + super->action = 1; } } } -void Button_Action1(Entity* this) { +void Button_Action1(ButtonEntity* this) { if (sub_08081E3C(this)) { - this->action = 2; - this->field_0x70.HALF.HI = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); + super->action = 2; + this->unk_72 = GetMetaTileType(this->metaTilePos, super->collisionLayer); } } -u32 sub_08081CB0(Entity*); +u32 sub_08081CB0(ButtonEntity*); void sub_08081FF8(Entity*); -void Button_Action2(Entity* this) { +void Button_Action2(ButtonEntity* this) { if (sub_08081CB0(this)) { - this->subAction = 0; - this->timer = 10; - RequestPriorityDuration(this, 10); - sub_08081FF8(this); - if (this->type == 1) { - this->action = 3; + super->subAction = 0; + super->timer = 10; + RequestPriorityDuration(super, 10); + sub_08081FF8(super); + if (super->type == 1) { + super->action = 3; } else { - this->action = 5; + super->action = 5; } } } -u32 sub_08081F7C(Entity*, u32 metaTileType); -u32 sub_08081D28(Entity*); -void sub_08081E6C(Entity*); +u32 sub_08081F7C(ButtonEntity*, u32 metaTileType); +u32 sub_08081D28(ButtonEntity*); +void sub_08081E6C(ButtonEntity*); -void Button_Action3(Entity* this) { +void Button_Action3(ButtonEntity* this) { if (!sub_08081F7C(this, META_TILE_TYPE_120)) return; if (!sub_08081D28(this)) { - this->action = 4; - this->subtimer = 1; + super->action = 4; + super->subtimer = 1; if ((gPlayerState.heldObject == 2) || (!(gPlayerState.field_0x35 & 0x80))) { - this->timer = 24; + super->timer = 24; } else { - this->timer = 8; + super->timer = 8; } } else { sub_08081E6C(this); } } -void Button_Action4(Entity* this) { - if (this->timer != 0) { - this->timer--; - if (this->subtimer != 0) { - this->subtimer = 0; - SetMetaTile(SPECIAL_META_TILE_53, this->field_0x74.HWORD, this->collisionLayer); +void Button_Action4(ButtonEntity* this) { + if (super->timer != 0) { + super->timer--; + if (super->subtimer != 0) { + super->subtimer = 0; + SetMetaTile(SPECIAL_META_TILE_53, this->metaTilePos, super->collisionLayer); } if (sub_08081CB0(this)) { - this->action = 3; - this->timer = 0; + super->action = 3; + super->timer = 0; } } else { - this->action = 2; - ClearFlag(this->field_0x86.HWORD); - SetMetaTileType(META_TILE_TYPE_119, this->field_0x74.HWORD, this->collisionLayer); + super->action = 2; + ClearFlag(this->unk_86); + SetMetaTileType(META_TILE_TYPE_119, this->metaTilePos, super->collisionLayer); SoundReq(SFX_BUTTON_PRESS); } } -void Button_Action5(Entity* this) { +void Button_Action5(ButtonEntity* this) { if (sub_08081F7C(this, META_TILE_TYPE_122)) { sub_08081E6C(this); } } -Entity* sub_08081D74(Entity*); +Entity* sub_08081D74(ButtonEntity*); -u32 sub_08081CB0(Entity* this) { +bool32 sub_08081CB0(ButtonEntity* this) { u16 tileType; if (sub_08081D74(this)) { - this->field_0x70.HALF.LO = -1; - if (GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer) == SPECIAL_META_TILE_53) { - sub_0807B7D8(0x78, this->field_0x74.HWORD, this->collisionLayer); + this->unk_70 = -1; + if (GetMetaTileType(this->metaTilePos, super->collisionLayer) == SPECIAL_META_TILE_53) { + sub_0807B7D8(0x78, this->metaTilePos, super->collisionLayer); } - return 1; + return TRUE; } else { - tileType = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); + tileType = GetMetaTileType(this->metaTilePos, super->collisionLayer); if (tileType != 0x77 && tileType != 0x79 && tileType != SPECIAL_META_TILE_53) { - this->field_0x70.HALF.LO = GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer); - return 1; + this->unk_70 = GetMetaTileIndex(this->metaTilePos, super->collisionLayer); + return TRUE; } } - return 0; + return FALSE; } -u32 sub_08081D28(Entity* this) { +bool32 sub_08081D28(ButtonEntity* this) { if (sub_08081D74(this)) { - this->field_0x70.HALF_U.LO = 0xFFFF; - return 1; + this->unk_70 = 0xFFFF; + return TRUE; } else { - if (this->field_0x70.HALF_U.LO == 0xFFFF) { - return 0; + if (this->unk_70 == 0xFFFF) { + return FALSE; } - if (GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) { - return 0; + if (GetMetaTileIndex(this->metaTilePos, super->collisionLayer) != this->unk_70) { + return FALSE; } } - return 1; + return TRUE; } extern Entity* gPlayerClones[3]; u32 sub_08081E0C(Entity*); -Entity* sub_08081D74(Entity* this) { +Entity* sub_08081D74(ButtonEntity* this) { Entity* ent; - if (GetCollisionDataAtMetaTilePos(this->field_0x74.HWORD, this->collisionLayer) == COLLISION_DATA_15) { + if (GetCollisionDataAtMetaTilePos(this->metaTilePos, super->collisionLayer) == COLLISION_DATA_15) { return NULL; } ent = 0; - if (sub_08081E0C(this)) { + if (sub_08081E0C(super)) { if ((gPlayerState.flags & PL_CAPTURED) == 0 && (gPlayerState.flags & PL_MINISH) == 0) { ent = &gPlayerEntity; } } else { if (gPlayerState.flags & PL_CLONING) { - if (EntityInRectRadius(this, gPlayerClones[0], 5, 6)) { + if (EntityInRectRadius(super, gPlayerClones[0], 5, 6)) { ent = gPlayerClones[0]; - } else if (EntityInRectRadius(this, gPlayerClones[1], 5, 6)) { + } else if (EntityInRectRadius(super, gPlayerClones[1], 5, 6)) { ent = gPlayerClones[1]; - } else if (EntityInRectRadius(this, gPlayerClones[2], 5, 6)) { + } else if (EntityInRectRadius(super, gPlayerClones[2], 5, 6)) { ent = gPlayerClones[2]; } } } - this->child = ent; + super->child = ent; return ent; } @@ -187,13 +199,13 @@ u32 sub_08081E0C(Entity* this) { } } -u32 sub_08081E3C(Entity* this) { +u32 sub_08081E3C(ButtonEntity* this) { static const u16 gUnk_0811EE50[] = { 0x77, 0x78, 0x79, 0x7a, 0, 0, }; const u16* tmp1; s32 tmp2; - tmp2 = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer); + tmp2 = GetMetaTileType(this->metaTilePos, super->collisionLayer); tmp1 = gUnk_0811EE50; do { if (*tmp1 == tmp2) @@ -208,20 +220,20 @@ extern u16 gMapDataTopSpecial[0x2000]; extern u16 gMapDataBottomSpecial[]; -void sub_08081E6C(Entity* this) { +void sub_08081E6C(ButtonEntity* this) { u32 metaTileType; MapLayer* mapLayer; u16* tmp2; u16* tmp; u16* tmp3; - u32 metaTilePos = this->field_0x74.HWORD; - u32 layer = this->collisionLayer; + u32 metaTilePos = this->metaTilePos; + u32 layer = super->collisionLayer; u32 specialMetaTile = GetMetaTileType(metaTilePos, layer); if (specialMetaTile < 0x4000) return; mapLayer = GetLayerByIndex(layer); - metaTileType = (this->type == 0 ? META_TILE_TYPE_122 : META_TILE_TYPE_120); + metaTileType = (super->type == 0 ? META_TILE_TYPE_122 : META_TILE_TYPE_120); tmp = mapLayer->metatiles; tmp = tmp + (mapLayer->unkData2[metaTileType] << 2); tmp2 = (layer == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial); @@ -256,25 +268,25 @@ void sub_08081F24(Entity* this) { } } -u32 sub_08081F7C(Entity* this, u32 metaTileType) { +bool32 sub_08081F7C(ButtonEntity* this, u32 metaTileType) { u16 tmp; - if (this->timer == 0) - return 1; - if (--this->timer > 6) { - if (this->child != NULL) - this->child->spriteOffsetY = -4; + if (super->timer == 0) + return TRUE; + if (--super->timer > 6) { + if (super->child != NULL) + super->child->spriteOffsetY = -4; } else { - if (this->timer == 6) { - SetFlag(this->field_0x86.HWORD); - SetMetaTileType(metaTileType, this->field_0x74.HWORD, this->collisionLayer); - sub_08081F24(this); + if (super->timer == 6) { + SetFlag(this->unk_86); + SetMetaTileType(metaTileType, this->metaTilePos, super->collisionLayer); + sub_08081F24(super); SoundReq(SFX_BUTTON_PRESS); - if (this->field_0x70.HALF_U.LO != 0xFFFF) - SetMetaTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer); - return 0; + if (this->unk_70 != 0xFFFF) + SetMetaTile(this->unk_70, this->metaTilePos, super->collisionLayer); + return FALSE; } } - return 1; + return TRUE; } void sub_08081FF8(Entity* this) { diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index 57a5623a..9c001915 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -49,10 +49,10 @@ void CameraTarget(Entity* this) { u32 uVar2 = gPlayerState.field_0x27[0] > 0; - switch (gFuseInfo._0) { - case 0: - case 1: - case 2: + switch (gFuseInfo.fusionState) { + case FUSION_STATE_0: + case FUSION_STATE_1: + case FUSION_STATE_2: if ((gMessage.doTextBox & 0x7f) == 0) { break; } diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 5f3b3ada..66d035a1 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -4,7 +4,6 @@ * * @brief Chest Spawner object */ - #define NENT_DEPRECATED #include "functions.h" #include "item.h" @@ -150,7 +149,7 @@ void ChestSpawner_Type2Action2(ChestSpawnerEntity* this) { void ChestSpawner_Type2Action3(ChestSpawnerEntity* this) { sub_0800445C(super); - if (super->interactType != 0) { + if (super->interactType != INTERACTION_NONE) { super->action = 4; super->subtimer = 30; RemoveInteractableObject(super); @@ -177,12 +176,12 @@ void ChestSpawner_Type2Action4(ChestSpawnerEntity* this) { } } -void sub_08084074(u32 param_1) { - u8* arr = (u8*)GetCurrentRoomProperty(3); - if (arr != NULL) { - for (; arr[0] != 0; arr += 8) { - if ((arr[0] == 3) && (param_1 == arr[1])) { - CreateItemEntity(arr[2], arr[3], 0); +void sub_08084074(u32 flag) { + TileEntity* tileEntity = (TileEntity*)GetCurrentRoomProperty(3); + if (tileEntity != NULL) { + for (; tileEntity->type != 0; tileEntity++) { + if ((tileEntity->type == BIG_CHEST) && (flag == tileEntity->localFlag)) { + CreateItemEntity(tileEntity->_2, tileEntity->_3, 0); return; } } @@ -190,7 +189,9 @@ void sub_08084074(u32 param_1) { } void sub_080840A8(s32 x, s32 y) { - static const u8 gUnk_0811F838[] = { 84, 84, 84, 84, 85, 85, 85, 86 }; + static const u8 gUnk_0811F838[] = { + ITEM_RUPEE1, ITEM_RUPEE1, ITEM_RUPEE1, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE5, ITEM_RUPEE5, ITEM_RUPEE20, + }; static const s32 zVelocities[] = { 0x60000, 0x70000, 0x80000, 0x90000 }; static const s8 xOffsets[] = { -6, 0, 0, 6 }; Entity* obj = CreateObject(GROUND_ITEM, gUnk_0811F838[Random() & 7], 0); diff --git a/src/object/chuchuBossCutscene.c b/src/object/chuchuBossCutscene.c index 808782e1..235a1f91 100644 --- a/src/object/chuchuBossCutscene.c +++ b/src/object/chuchuBossCutscene.c @@ -4,114 +4,108 @@ * * @brief Chuchu Boss Cutscene object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "menu.h" #include "object.h" -typedef struct { - /*0x00*/ Entity base; -} ChuchuBossCutsceneEntity; +void ChuchuBossCutscene_Init(Entity*); +void ChuchuBossCutscene_Action1(Entity*); +void ChuchuBossCutscene_Action2(Entity*); +void ChuchuBossCutscene_Action3(Entity*); +void ChuchuBossCutscene_Action4(Entity*); +void ChuchuBossCutscene_Action5(Entity*); +void ChuchuBossCutscene_Action6(Entity*); +void ChuchuBossCutscene_Action7(Entity*); -void ChuchuBossCutscene_Init(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action1(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action2(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action3(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action4(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action5(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action6(ChuchuBossCutsceneEntity*); -void ChuchuBossCutscene_Action7(ChuchuBossCutsceneEntity*); - -void ChuchuBossCutscene(ChuchuBossCutsceneEntity* this) { - static void (*const ChuchuBossCutscene_Actions[])(ChuchuBossCutsceneEntity*) = { +void ChuchuBossCutscene(Entity* this) { + static void (*const ChuchuBossCutscene_Actions[])(Entity*) = { ChuchuBossCutscene_Init, ChuchuBossCutscene_Action1, ChuchuBossCutscene_Action2, ChuchuBossCutscene_Action3, ChuchuBossCutscene_Action4, ChuchuBossCutscene_Action5, ChuchuBossCutscene_Action6, ChuchuBossCutscene_Action7, }; - ChuchuBossCutscene_Actions[super->action](this); + ChuchuBossCutscene_Actions[this->action](this); } -void ChuchuBossCutscene_Init(ChuchuBossCutsceneEntity* this) { - super->action = 1; - super->timer = 60; - InitializeAnimation(super, 0); +void ChuchuBossCutscene_Init(Entity* this) { + this->action = 1; + this->timer = 60; + InitializeAnimation(this, 0); } -void ChuchuBossCutscene_Action1(ChuchuBossCutsceneEntity* this) { - if (--super->timer == 0) { - super->timer = 120; - super->action++; - super->spriteSettings.draw = 1; +void ChuchuBossCutscene_Action1(Entity* this) { + if (--this->timer == 0) { + this->timer = 120; + this->action++; + this->spriteSettings.draw = 1; } } -void ChuchuBossCutscene_Action2(ChuchuBossCutsceneEntity* this) { - GetNextFrame(super); - if ((super->frame & ANIM_DONE) != 0) { - super->action++; - super->spritePriority.b1 = 3; - InitializeAnimation(super, 2); +void ChuchuBossCutscene_Action2(Entity* this) { + GetNextFrame(this); + if ((this->frame & ANIM_DONE) != 0) { + this->action++; + this->spritePriority.b1 = 3; + InitializeAnimation(this, 2); } } -void ChuchuBossCutscene_Action3(ChuchuBossCutsceneEntity* this) { - GetNextFrame(super); - if (--super->timer == 0) { - super->action++; - super->direction = 0; - super->speed = 0x100; - super->zVelocity = Q_16_16(2.0); - super->spriteOrientation.flipY = 0; - super->timer = 0; - InitializeAnimation(super, 3); +void ChuchuBossCutscene_Action3(Entity* this) { + GetNextFrame(this); + if (--this->timer == 0) { + this->action++; + this->direction = DirectionNorth; + this->speed = 0x100; + this->zVelocity = Q_16_16(2.0); + this->spriteOrientation.flipY = 0; + this->timer = 0; + InitializeAnimation(this, 3); SoundReq(SFX_12B); } } -void ChuchuBossCutscene_Action4(ChuchuBossCutsceneEntity* this) { - if ((super->frame & 0x10) != 0) { - LinearMoveUpdate(super); - if (GravityUpdate(super, Q_8_8(32.0)) == 0) { - GetNextFrame(super); +void ChuchuBossCutscene_Action4(Entity* this) { + if ((this->frame & 0x10) != 0) { + LinearMoveUpdate(this); + if (GravityUpdate(this, Q_8_8(32.0)) == 0) { + GetNextFrame(this); } } else { - GetNextFrame(super); + GetNextFrame(this); } - if ((super->y.HALF.HI - gRoomControls.origin_y) < 0x231) { - super->y.HALF.HI = gRoomControls.origin_y + 0x230; - if ((super->frame & ANIM_DONE) != 0) { - super->action++; - super->timer = 120; - InitializeAnimation(super, 2); + if ((this->y.HALF.HI - gRoomControls.origin_y) < 0x231) { + this->y.HALF.HI = gRoomControls.origin_y + 0x230; + if ((this->frame & ANIM_DONE) != 0) { + this->action++; + this->timer = 120; + InitializeAnimation(this, 2); } - } else if ((super->frame & ANIM_DONE) != 0) { - super->zVelocity = Q_16_16(2.0); - InitializeAnimation(super, 3); + } else if ((this->frame & ANIM_DONE) != 0) { + this->zVelocity = Q_16_16(2.0); + InitializeAnimation(this, 3); SoundReq(SFX_12B); } } -void ChuchuBossCutscene_Action5(ChuchuBossCutsceneEntity* this) { - GetNextFrame(super); - if (--super->timer == 0) { - super->action++; - InitializeAnimation(super, 5); +void ChuchuBossCutscene_Action5(Entity* this) { + GetNextFrame(this); + if (--this->timer == 0) { + this->action++; + InitializeAnimation(this, 5); } } -void ChuchuBossCutscene_Action6(ChuchuBossCutsceneEntity* this) { - GetNextFrame(super); - if ((super->frame & ANIM_DONE) != 0) { - super->action++; - super->timer = 60; - InitializeAnimation(super, 1); +void ChuchuBossCutscene_Action6(Entity* this) { + GetNextFrame(this); + if ((this->frame & ANIM_DONE) != 0) { + this->action++; + this->timer = 60; + InitializeAnimation(this, 1); } } -void ChuchuBossCutscene_Action7(ChuchuBossCutsceneEntity* this) { - GetNextFrame(super); - if (--super->timer == 0) { +void ChuchuBossCutscene_Action7(Entity* this) { + GetNextFrame(this); + if (--this->timer == 0) { gMenu.overlayType++; DeleteThisEntity(); } diff --git a/src/object/chuchuBossParticle.c b/src/object/chuchuBossParticle.c index 9b73f0d1..b0b0da51 100644 --- a/src/object/chuchuBossParticle.c +++ b/src/object/chuchuBossParticle.c @@ -1,10 +1,10 @@ -#define NENT_DEPRECATED /** * @file chuchuBossParticle.c * @ingroup Objects * * @brief Chuchu Boss Particle object */ +#define NENT_DEPRECATED #include "entity.h" void ChuchuBossParticle_Init(Entity*); diff --git a/src/object/chuchuBossStartParticle.c b/src/object/chuchuBossStartParticle.c index ae8dfd15..25763c0f 100644 --- a/src/object/chuchuBossStartParticle.c +++ b/src/object/chuchuBossStartParticle.c @@ -4,247 +4,264 @@ * * @brief Chuchu Boss Start Particle object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" -static void sub_0808F2B0(Entity*); -void sub_0808F14C(Entity*); -void sub_0808F244(Entity*); -void sub_0808F0B8(Entity*); -void sub_0808F1E0(Entity*); -void sub_0808F2C0(Entity*); -void sub_0808F370(Entity*); -void sub_0808F3DC(Entity*); -void sub_0808F498(Entity*); -void sub_0808F554(Entity*); -void sub_0808F0D0(Entity*); -void sub_0808F170(Entity*); -void sub_0808F1A4(Entity*); -void sub_0808F244(Entity*); -void sub_0808F1F8(Entity*); -void sub_0808F5EC(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[5]; + /*0x6d*/ u8 unk_6d; + /*0x6e*/ u8 unused2[2]; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; + /*0x78*/ u32 unk_78; + /*0x7c*/ u8 unused3[3]; + /*0x7f*/ u8 unk_7f; + /*0x80*/ u8 unused4[4]; + /*0x84*/ u32 unk_84; +} ChuchuBossStartParticleEntity; -void ChuchuBossStartParticle(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { - sub_0808F0B8, sub_0808F1E0, sub_0808F2C0, sub_0808F370, sub_0808F0B8, sub_0808F3DC, - sub_0808F3DC, sub_0808F3DC, sub_0808F3DC, sub_0808F498, sub_0808F554, +static void sub_0808F2B0(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type0_Action1(ChuchuBossStartParticleEntity* this); +void sub_0808F244(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type0(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type1(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type2(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type3(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type5(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type9(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type10(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type0_Init(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type0_Action2(ChuchuBossStartParticleEntity* this); +void ChuchuBossStartParticle_Type0_Action3(ChuchuBossStartParticleEntity* this); +void sub_0808F244(ChuchuBossStartParticleEntity* this); +void sub_0808F1F8(ChuchuBossStartParticleEntity* this); +void sub_0808F5EC(ChuchuBossStartParticleEntity* this); + +void ChuchuBossStartParticle(ChuchuBossStartParticleEntity* this) { + static void (*const ChuchuBossStartParticle_Types[])(ChuchuBossStartParticleEntity*) = { + ChuchuBossStartParticle_Type0, ChuchuBossStartParticle_Type1, ChuchuBossStartParticle_Type2, + ChuchuBossStartParticle_Type3, ChuchuBossStartParticle_Type0, ChuchuBossStartParticle_Type5, + ChuchuBossStartParticle_Type5, ChuchuBossStartParticle_Type5, ChuchuBossStartParticle_Type5, + ChuchuBossStartParticle_Type9, ChuchuBossStartParticle_Type10, }; - typeFuncs[this->type](this); + ChuchuBossStartParticle_Types[super->type](this); } -void sub_0808F0B8(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808F0D0, - sub_0808F14C, - sub_0808F170, - sub_0808F1A4, +void ChuchuBossStartParticle_Type0(ChuchuBossStartParticleEntity* this) { + static void (*const ChuchuBossStartParticle_Type0_Actions[])(ChuchuBossStartParticleEntity*) = { + ChuchuBossStartParticle_Type0_Init, + ChuchuBossStartParticle_Type0_Action1, + ChuchuBossStartParticle_Type0_Action2, + ChuchuBossStartParticle_Type0_Action3, }; - actionFuncs[this->action](this); + ChuchuBossStartParticle_Type0_Actions[super->action](this); } -void sub_0808F0D0(Entity* this) { +void ChuchuBossStartParticle_Type0_Init(ChuchuBossStartParticleEntity* this) { u32 offsetX; u32 offsetY; Entity* ent; u32 uVar3; - ent = CreateObjectWithParent(this, CHUCHU_BOSS_START_PARTICLE, 2, 0); - this->child = ent; + ent = CreateObjectWithParent(super, CHUCHU_BOSS_START_PARTICLE, 2, 0); + super->child = ent; if (ent == NULL) { DeleteThisEntity(); } - this->action = 1; - this->z.HALF.HI = -0xc0; + super->action = 1; + super->z.HALF.HI = -0xc0; offsetX = Random() % 64; if ((Random() & 1) != 0) { offsetX = -offsetX; } - this->x.HALF.HI = this->parent->x.HALF.HI + offsetX; + super->x.HALF.HI = super->parent->x.HALF.HI + offsetX; offsetY = Random() % 32; if ((Random() & 1) != 0) { offsetY = -offsetY; } - this->y.HALF.HI = this->parent->y.HALF.HI + offsetY; - *(u32*)&this->field_0x74 = 0x240; - *(u32*)&this->field_0x78 = 0x140; - InitializeAnimation(this, 3); - sub_0808F14C(this); + super->y.HALF.HI = super->parent->y.HALF.HI + offsetY; + this->unk_74 = 0x240; + this->unk_78 = 0x140; + InitializeAnimation(super, 3); + ChuchuBossStartParticle_Type0_Action1(this); } -void sub_0808F14C(Entity* this) { +void ChuchuBossStartParticle_Type0_Action1(ChuchuBossStartParticleEntity* this) { sub_0808F2B0(this); - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { - this->action++; + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { + super->action++; SoundReq(SFX_WATER_SPLASH); } } -void sub_0808F170(Entity* this) { - *(u32*)&this->field_0x74 -= 0x20; - *(u32*)&this->field_0x78 += 0x20; - sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2); - if (*(u32*)&this->field_0x78 > 0x1ff) { - this->action++; +void ChuchuBossStartParticle_Type0_Action2(ChuchuBossStartParticleEntity* this) { + this->unk_74 -= 0x20; + this->unk_78 += 0x20; + sub_0806FCF4(super, this->unk_78, 8, 2); + if (this->unk_78 > 0x1ff) { + super->action++; } sub_0808F2B0(this); } -void sub_0808F1A4(Entity* this) { - *(u32*)&this->field_0x78 += 0x10; - *(u32*)&this->field_0x74 += 0x10; - sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2); - if (*(u32*)&this->field_0x78 > 0x3ff) { - this->child->action = 0xff; +void ChuchuBossStartParticle_Type0_Action3(ChuchuBossStartParticleEntity* this) { + this->unk_78 += 0x10; + this->unk_74 += 0x10; + sub_0806FCF4(super, this->unk_78, 8, 2); + if (this->unk_78 > 0x3ff) { + super->child->action = 0xff; DeleteThisEntity(); } else { sub_0808F2B0(this); } } -void sub_0808F1E0(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void ChuchuBossStartParticle_Type1(ChuchuBossStartParticleEntity* this) { + static void (*const actionFuncs[])(ChuchuBossStartParticleEntity*) = { sub_0808F1F8, sub_0808F244, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void sub_0808F1F8(Entity* this) { +void sub_0808F1F8(ChuchuBossStartParticleEntity* this) { u8 bVar1; - this->spriteRendering.b0 = 3; - this->action++; - this->spriteRendering.b3 = this->parent->spriteRendering.b3; - this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; - this->spritePriority.b0 = 7; - InitializeAnimation(this, 1); + super->spriteRendering.b0 = 3; + super->action++; + super->spriteRendering.b3 = super->parent->spriteRendering.b3; + super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY; + super->spritePriority.b0 = 7; + InitializeAnimation(super, 1); sub_0808F244(this); } -void sub_0808F244(Entity* this) { +void sub_0808F244(ChuchuBossStartParticleEntity* this) { - this->spriteSettings.draw = this->parent->spriteSettings.draw; - this->y.HALF.HI = this->parent->y.HALF.HI + 3; - this->x.HALF.HI = (*(s8*)&this->child->spriteOffsetX + this->child->x.HALF.HI); - this->z.WORD = 0; - *(u32*)&this->field_0x74 = 0x80 - this->parent->z.HALF.HI; - *(u32*)&this->field_0x78 = 0x100 - this->parent->z.HALF.HI; - *(u32*)&this->field_0x70.WORD = *((u8*)&this->parent->field_0x7c + 3); + super->spriteSettings.draw = super->parent->spriteSettings.draw; + super->y.HALF.HI = super->parent->y.HALF.HI + 3; + super->x.HALF.HI = (*(s8*)&super->child->spriteOffsetX + super->child->x.HALF.HI); + super->z.WORD = 0; + this->unk_74 = 0x80 - super->parent->z.HALF.HI; + this->unk_78 = 0x100 - super->parent->z.HALF.HI; + this->unk_70 = ((ChuchuBossStartParticleEntity*)super->parent)->unk_7f; sub_0808F2B0(this); - if ((this->parent->field_0x6c.HALF.HI & 2) != 0) { + if ((((ChuchuBossStartParticleEntity*)super->parent)->unk_6d & 2) != 0) { DeleteThisEntity(); } } -static void sub_0808F2B0(Entity* this) { - SetAffineInfo(this, *(u32*)&this->field_0x74, *(u32*)&this->field_0x78, this->field_0x70.WORD); +static void sub_0808F2B0(ChuchuBossStartParticleEntity* this) { + SetAffineInfo(super, this->unk_74, this->unk_78, this->unk_70); } -void sub_0808F2C0(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteRendering.b3 = this->parent->spriteRendering.b3; - this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 7; - this->z.WORD = 0; +void ChuchuBossStartParticle_Type2(ChuchuBossStartParticleEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteRendering.b3 = super->parent->spriteRendering.b3; + super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 7; + super->z.WORD = 0; - this->y.HALF.HI = this->parent->y.HALF.HI + 3; - this->x.HALF.HI = this->parent->x.HALF.HI; - InitializeAnimation(this, 3); + super->y.HALF.HI = super->parent->y.HALF.HI + 3; + super->x.HALF.HI = super->parent->x.HALF.HI; + InitializeAnimation(super, 3); } - if (this->parent->z.HALF.HI == 0) { - *(u32*)&this->field_0x74 = *(u32*)&this->parent->field_0x74; - *(u32*)&this->field_0x78 = *(u32*)&this->parent->field_0x78; + if (super->parent->z.HALF.HI == 0) { + this->unk_74 = ((ChuchuBossStartParticleEntity*)super->parent)->unk_74; + this->unk_78 = ((ChuchuBossStartParticleEntity*)super->parent)->unk_78; } else { - *(u32*)&this->field_0x74 = 0x200 - this->parent->z.HALF.HI; - *(u32*)&this->field_0x78 = this->parent->z.HALF.HI * -2 + 0x300; + this->unk_74 = 0x200 - super->parent->z.HALF.HI; + this->unk_78 = super->parent->z.HALF.HI * -2 + 0x300; } - *(u32*)&this->field_0x70 = 0; + this->unk_70 = 0; sub_0808F2B0(this); - sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2); - if (this->action == 0xff) { + sub_0806FCF4(super, this->unk_78, 8, 2); + if (super->action == 0xff) { DeleteThisEntity(); } } -void sub_0808F370(Entity* this) { +void ChuchuBossStartParticle_Type3(ChuchuBossStartParticleEntity* this) { static const u16 gUnk_08121EA0[] = { 0x1a4, 0x12c }; - if (this->action == 0) { - if (this->parent->subAction == 1) { - this->action = 1; - this->field_0x70.WORD = 0; + if (super->action == 0) { + if (super->parent->subAction == 1) { + super->action = 1; + this->unk_70 = 0; sub_0808F5EC(this); } } else { - u8 flag = this->parent->subAction - 1; + u8 flag = super->parent->subAction - 1; if (flag < 5) { - if (this->field_0x70.WORD == 0) { - if (--(*(u32*)&this->field_0x74) == -1) { - this->field_0x70.WORD = gUnk_08121EA0[Random() & 1]; + if (this->unk_70 == 0) { + if (--(this->unk_74) == -1) { + this->unk_70 = gUnk_08121EA0[Random() & 1]; } } else { - if (--this->field_0x70.WORD == 0) { + if (--this->unk_70 == 0) { sub_0808F5EC(this); } } } else { - this->action = 0; - *(u32*)&this->field_0x74 = 0; + super->action = 0; + this->unk_74 = 0; } } } -void sub_0808F3DC(Entity* this) { - if (this->action == 0) { - this->spriteSettings.draw = 1; - this->action = 1; - this->timer = 120; - InitializeAnimation(this, this->type + 1); +void ChuchuBossStartParticle_Type5(ChuchuBossStartParticleEntity* this) { + if (super->action == 0) { + super->spriteSettings.draw = 1; + super->action = 1; + super->timer = 120; + InitializeAnimation(super, super->type + 1); // TODO: This block of code might supposed to be a switch statement. - if (this->type != 8) { - if (this->type == 7) { - SortEntityBelow(this->child, this); + if (super->type != 8) { + if (super->type == 7) { + SortEntityBelow(super->child, super); return; } } else { - this->hitType = this->child->hitType; - this->child->hitType = 0x7E; + super->hitType = super->child->hitType; + super->child->hitType = 0x7E; } - SortEntityAbove(this->child, this); + SortEntityAbove(super->child, super); } else { - if (*(u32*)&this->parent->field_0x74 == 0) { - if (this->type == 8) { - this->child->hitType = this->hitType; + if (((ChuchuBossStartParticleEntity*)super->parent)->unk_74 == 0) { + if (super->type == 8) { + super->child->hitType = super->hitType; } DeleteThisEntity(); } - if (this->type == 5 && (this->frame & 1)) { - Entity* entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 8, 0); + if (super->type == 5 && (super->frame & 1)) { + Entity* entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 8, 0); if (entity != NULL) { - entity->parent = this->parent; - entity->child = this->parent->parent; + entity->parent = super->parent; + entity->child = super->parent->parent; } } - GetNextFrame(this); - CopyPositionAndSpriteOffset(this->child, this); + GetNextFrame(super); + CopyPositionAndSpriteOffset(super->child, super); } } -void sub_0808F498(Entity* this) { +void ChuchuBossStartParticle_Type9(ChuchuBossStartParticleEntity* this) { u32 var0; - if (this->action != 0) { - if (sub_0806F3E4(this)) { + if (super->action != 0) { + if (sub_0806F3E4(super)) { if (gRoomTransition.frameCount % 16 == 0) { SoundReq(SFX_EF); } DeleteThisEntity(); } - if (this->timer-- == 0) { + if (super->timer-- == 0) { DeleteThisEntity(); } @@ -252,59 +269,59 @@ void sub_0808F498(Entity* this) { DeleteThisEntity(); } } else { - this->action = 1; - this->timer = 64; - var0 = this->type2 != 0 ? 44 : 43; - this->x.HALF.HI -= this->parent->hitbox->width; - this->x.HALF.HI += (s32)Random() % (this->parent->hitbox->width * 2); - this->y.HALF.HI -= this->parent->hitbox->height; - this->y.HALF.HI += (s32)Random() % (this->parent->hitbox->height * 2); - ChangeObjPalette(this, var0); - InitializeAnimation(this, 4); + super->action = 1; + super->timer = 64; + var0 = super->type2 != 0 ? 44 : 43; + super->x.HALF.HI -= super->parent->hitbox->width; + super->x.HALF.HI += (s32)Random() % (super->parent->hitbox->width * 2); + super->y.HALF.HI -= super->parent->hitbox->height; + super->y.HALF.HI += (s32)Random() % (super->parent->hitbox->height * 2); + ChangeObjPalette(super, var0); + InitializeAnimation(super, 4); } } -void sub_0808F554(Entity* this) { - CopyPositionAndSpriteOffset(this->parent, this); - this->spriteOffsetY -= 24; - if ((s8)this->parent->spriteOffsetX != 0) { - this->spriteOffsetX += (s8)this->parent->spriteOffsetX / 2; +void ChuchuBossStartParticle_Type10(ChuchuBossStartParticleEntity* this) { + CopyPositionAndSpriteOffset(super->parent, super); + super->spriteOffsetY -= 24; + if ((s8)super->parent->spriteOffsetX != 0) { + super->spriteOffsetX += (s8)super->parent->spriteOffsetX / 2; } - if (this->action != 0) { - if (*(u32*)&this->cutsceneBeh) { - if (--(*(u32*)&this->cutsceneBeh) == 0) { + if (super->action != 0) { + if (this->unk_84) { + if (--(this->unk_84) == 0) { DeleteThisEntity(); } } - GetNextFrame(this); + GetNextFrame(super); } else { - this->action = 1; - this->spriteRendering.b3 = this->parent->spriteRendering.b3; - this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; - this->spritePriority.b0 = 0; - InitializeAnimation(this, 3); + super->action = 1; + super->spriteRendering.b3 = super->parent->spriteRendering.b3; + super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY; + super->spritePriority.b0 = 0; + InitializeAnimation(super, 3); } } -void sub_0808F5EC(Entity* this) { - Entity* entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 5, 0); +void sub_0808F5EC(ChuchuBossStartParticleEntity* this) { + Entity* entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 5, 0); if (entity != NULL) { - entity->parent = this; - entity->child = this->child; + entity->parent = super; + entity->child = super->child; } - entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 6, 0); + entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 6, 0); if (entity != NULL) { - entity->parent = this; - entity->child = this->child; + entity->parent = super; + entity->child = super->child; } - entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 7, 0); + entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 7, 0); if (entity != NULL) { - entity->parent = this; - entity->child = this->child; + entity->parent = super; + entity->child = super->child; } - *(u32*)&this->field_0x74 = 600; + this->unk_74 = 600; } diff --git a/src/object/cloud.c b/src/object/cloud.c index f0aa0d55..1252aca6 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -4,69 +4,75 @@ * * @brief Cloud object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "structures.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; +} CloudEntity; + void sub_0809F814(u32 r0); -void sub_0809F7BC(Entity*); -void sub_0809F7F4(Entity*); -void Cloud_Type0(Entity*); -void Cloud_Type1(Entity*); -void sub_0809F514(Entity*); -void sub_0809F548(Entity*); -void sub_0809F5B0(Entity*); -void sub_0809F6CC(Entity*); -void sub_0809F69C(Entity*); -void sub_0809F61C(Entity*); -void sub_0809F5F0(Entity*); -void sub_0809F5DC(Entity*); +void sub_0809F7BC(CloudEntity* this); +void sub_0809F7F4(CloudEntity* this); +void Cloud_Type0(CloudEntity* this); +void Cloud_Type1(CloudEntity* this); +void sub_0809F514(CloudEntity* this); +void sub_0809F548(CloudEntity* this); +void sub_0809F5B0(CloudEntity* this); +void sub_0809F6CC(CloudEntity* this); +void sub_0809F69C(CloudEntity* this); +void sub_0809F61C(CloudEntity* this); +void sub_0809F5F0(CloudEntity* this); +void sub_0809F5DC(CloudEntity* this); extern void* gUnk_080DD750; -void Cloud(Entity* this) { - static void (*const Cloud_Types[])(Entity*) = { +void Cloud(CloudEntity* this) { + static void (*const Cloud_Types[])(CloudEntity*) = { Cloud_Type0, Cloud_Type1, }; - Cloud_Types[this->type](this); + Cloud_Types[super->type](this); } -void Cloud_Type0(Entity* this) { - static void (*const gUnk_081247A0[])(Entity*) = { +void Cloud_Type0(CloudEntity* this) { + static void (*const gUnk_081247A0[])(CloudEntity*) = { sub_0809F514, sub_0809F548, sub_0809F5B0, }; - static void (*const gUnk_081247AC[])(Entity*) = { + static void (*const gUnk_081247AC[])(CloudEntity*) = { sub_0809F5DC, sub_0809F5F0, sub_0809F61C, sub_0809F69C, sub_0809F6CC, }; - if (this->type2 == 0) { - gUnk_081247A0[this->action](this); + if (super->type2 == 0) { + gUnk_081247A0[super->action](this); } else { - gUnk_081247AC[this->action](this); + gUnk_081247AC[super->action](this); } } -void sub_0809F514(Entity* this) { - this->action = 1; - this->timer = 120; - this->spriteSettings.draw = 0; - this->field_0x68.HALF.LO = 12; - gRoomControls.camera_target = this; +void sub_0809F514(CloudEntity* this) { + super->action = 1; + super->timer = 120; + super->spriteSettings.draw = 0; + this->unk_68 = 12; + gRoomControls.camera_target = super; gPauseMenuOptions.disabled = 255; sub_0809F7BC(this); } -void sub_0809F548(Entity* this) { +void sub_0809F548(CloudEntity* this) { - if (--this->timer == 0) { - this->action = 2; - this->timer = 90; + if (--super->timer == 0) { + super->action = 2; + super->timer = 90; SoundReq(SFX_11D); - sub_0809F814((((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) | - (((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6); + sub_0809F814((((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) | + (((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6); } else { if ((gRoomTransition.frameCount & 7) == 0) { sub_0809F7BC(this); @@ -75,8 +81,8 @@ void sub_0809F548(Entity* this) { } } -void sub_0809F5B0(Entity* this) { - if (--this->timer == 0) { +void sub_0809F5B0(CloudEntity* this) { + if (--super->timer == 0) { SoundReq(SFX_SECRET_BIG); SetGlobalFlag(KUMOTATSUMAKI); LoadRoomEntityList((EntityData*)&gUnk_080DD750); @@ -84,37 +90,37 @@ void sub_0809F5B0(Entity* this) { } } -void sub_0809F5DC(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 0; - this->field_0x68.HALF.LO = 12; +void sub_0809F5DC(CloudEntity* this) { + super->action = 1; + super->spriteSettings.draw = 0; + this->unk_68 = 12; } -void sub_0809F5F0(Entity* this) { +void sub_0809F5F0(CloudEntity* this) { u32 iVar1; - iVar1 = CheckRoomFlag(this->timer); + iVar1 = CheckRoomFlag(super->timer); if (iVar1 != 0) { - this->action = 2; - this->timer = 120; + super->action = 2; + super->timer = 120; SetPlayerControl(3); sub_08078B48(); - gRoomControls.camera_target = this; + gRoomControls.camera_target = super; } } -void sub_0809F61C(Entity* this) { +void sub_0809F61C(CloudEntity* this) { if ((gRoomControls.scroll_flags & 4) == 0) { - if (this->timer == 30) { - SetLocalFlag(this->type2); + if (super->timer == 30) { + SetLocalFlag(super->type2); } - if (--this->timer == 0) { - this->action = 3; - this->timer = 120; + if (--super->timer == 0) { + super->action = 3; + super->timer = 120; SoundReq(SFX_11D); - sub_0809F814((((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) | - (((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6); + sub_0809F814((((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) | + (((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6); } else { if ((gRoomTransition.frameCount & 7) == 0) { sub_0809F7BC(this); @@ -124,54 +130,54 @@ void sub_0809F61C(Entity* this) { } } -void sub_0809F69C(Entity* this) { +void sub_0809F69C(CloudEntity* this) { - if (--this->timer == 0) { - this->timer = 30; - this->action = 4; + if (--super->timer == 0) { + super->timer = 30; + super->action = 4; gRoomControls.camera_target = &gPlayerEntity; SoundReq(SFX_SECRET_BIG); } } -void sub_0809F6CC(Entity* this) { +void sub_0809F6CC(CloudEntity* this) { - if (((gRoomControls.scroll_flags & 4) == 0) && (--this->timer == 0)) { + if (((gRoomControls.scroll_flags & 4) == 0) && (--super->timer == 0)) { gPlayerState.controlMode = CONTROL_1; DeleteThisEntity(); } } -void Cloud_Type1(Entity* this) { +void Cloud_Type1(CloudEntity* this) { static const s8 gUnk_081247C0[] = { -1, 1, 2, -2, 0, 1, 0, -1, }; u8 bVar1; u32 uVar2; - if (this->action == 0) { - this->action = 1; - this->timer = (Random() & 30) + 8; - this->flags = this->flags | 12; + if (super->action == 0) { + super->action = 1; + super->timer = (Random() & 30) + 8; + super->flags = super->flags | 12; } if ((gRoomTransition.frameCount & 3) == 0) { uVar2 = Random(); - this->spriteOffsetX = gUnk_081247C0[uVar2 & 7]; - this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7]; + super->spriteOffsetX = gUnk_081247C0[uVar2 & 7]; + super->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7]; } - LinearMoveUpdate(this); - if (--this->timer == 0) { + LinearMoveUpdate(super); + if (--super->timer == 0) { DeleteThisEntity(); } } -Entity* sub_0809F770(Entity* this) { +Entity* sub_0809F770(CloudEntity* this) { Entity* cloud; int uVar1; cloud = CreateObject(CLOUD, 1, 0); if (cloud) { - PositionEntityOnTop(this, cloud); + PositionEntityOnTop(super, cloud); uVar1 = Random(); cloud->x.HALF.HI += ((uVar1 >> 0) & 31) - 16; cloud->y.HALF.HI += ((uVar1 >> 8) & 31) - 16; @@ -181,7 +187,7 @@ Entity* sub_0809F770(Entity* this) { return cloud; } -void sub_0809F7BC(Entity* this) { +void sub_0809F7BC(CloudEntity* this) { static const u16 gUnk_081247C8[] = { 0x100, 0x180, 0x200, 0x280 }; Entity* cloud; u32 uVar1; @@ -197,9 +203,9 @@ void sub_0809F7BC(Entity* this) { } } -void sub_0809F7F4(Entity* this) { - if (--this->field_0x68.HALF.LO == 0) { - this->field_0x68.HALF.LO = 12; +void sub_0809F7F4(CloudEntity* this) { + if (--this->unk_68 == 0) { + this->unk_68 = 12; SoundReq(SFX_184); } } diff --git a/src/object/crackingGround.c b/src/object/crackingGround.c index bf84577b..21845417 100644 --- a/src/object/crackingGround.c +++ b/src/object/crackingGround.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" void CrackingGround(Entity* this) { diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 23203866..1dae7789 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -4,7 +4,6 @@ * * @brief Crenel Bean Sprout object */ - #define NENT_DEPRECATED #include "asm.h" #include "functions.h" @@ -139,7 +138,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { if (super->parent->action == 2) { switch (super->parent->subAction) { case 1: - if ((gPlayerState.direction & 0x80) != 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { InitializeAnimation(super, 4); } else { GetNextFrame(super); @@ -162,7 +161,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { } else { gPlayerState.mobility |= 0x80; gPlayerState.heldObject = 5; - if ((gPlayerState.direction & 0x80) != 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { InitializeAnimation(super, (super->type >> 1) + 3); } else { GetNextFrame(super); diff --git a/src/object/cuccoMinigame.c b/src/object/cuccoMinigame.c index daf17bcd..69900125 100644 --- a/src/object/cuccoMinigame.c +++ b/src/object/cuccoMinigame.c @@ -109,60 +109,65 @@ void CuccoMinigame(CuccoMinigameEntity* this) { sub_0807DD64(super); sub_0806EC20(super); } - sub_0807DD94(super, 0); + ExecuteScriptAndHandleAnimation(super, NULL); } -NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMinigameEntity* this)) { - s32 iVar1; - int iVar2; - s32 iVar4; - s32 sVar6; - int iVar7; - s8* ptr; - s32 val; +void sub_080A1270(CuccoMinigameEntity* this) { + s32 numReturnedCuccos; + FORCE_REGISTER(int index, r10); + s8* returnedArray; + Entity* pEnt; Entity** entArray; + u16 cageX, cageY; + s32 castedCageX, castedCageY; + + s32 one; + FORCE_REGISTER(s16 minusOne, r5); + + numReturnedCuccos = 0; - sVar6 = 0; entArray = ((Entity**)super->myHeap); - ptr = this->returnedCuccoTypes; - iVar1 = (gRoomControls.origin_x + 0x360); - iVar4 = (gRoomControls.origin_y + 0x350); - iVar1 = (iVar1 << 16) >> 16; - iVar4 = (iVar4 << 16) >> 16; - val = -1; + returnedArray = this->returnedCuccoTypes; - for (iVar7 = 0; iVar7 < 9; iVar7++) { - pEnt = entArray[iVar7]; - if (((s8*)ptr)[iVar7] == 0) { + cageX = (gRoomControls.origin_x + 0x360); + cageY = (gRoomControls.origin_y + 0x350); + castedCageX = (s16)cageX; + castedCageY = (s16)cageY; + index = 9; + one = 1; + minusOne = -one; + do { + pEnt = *entArray; + if (*returnedArray == 0) { // this cucco not saved if (pEnt->next != NULL && pEnt != NULL) { - if ((iVar1 <= pEnt->x.HALF.HI) && (iVar4 <= pEnt->y.HALF.HI)) { - ptr[iVar7] = pEnt->type + 1; + if ((castedCageX <= pEnt->x.HALF.HI) && (castedCageY <= pEnt->y.HALF.HI)) { + returnedArray[0] = pEnt->type + one; pEnt->type2 = 1; - sVar6++; + + numReturnedCuccos++; SoundReq(CuccoMinigame_Sounds[pEnt->type]); } } else { - ((s8*)ptr)[iVar7] = val; + *returnedArray = minusOne; } - } else if (0 < (s8)ptr[iVar7]) { - sVar6++; + } else if (*returnedArray > 0) { // this cucco saved + numReturnedCuccos++; if (pEnt->next != NULL && pEnt != NULL) { - iVar2 = iVar1 + 4; - if (iVar2 > pEnt->x.HALF.HI) { - pEnt->x.HALF.HI = iVar2; + if (castedCageX + 4 > pEnt->x.HALF.HI) { + pEnt->x.HALF.HI = castedCageX + 4; } - iVar2 = iVar4 + 4; - if (iVar2 > pEnt->y.HALF.HI) { - pEnt->y.HALF.HI = iVar2; + if (castedCageY + 4 > pEnt->y.HALF.HI) { + pEnt->y.HALF.HI = castedCageY + 4; } } else { - ((s8*)ptr)[iVar7] = val; + *returnedArray = minusOne; } } - } + index--, returnedArray++, entArray++; + } while (index >= 0); - this->currentCuccos = sVar6; + this->currentCuccos = numReturnedCuccos; gPlayerState.field_0x27[0] = 0xff; if (--this->timer < 1) { SoundReq(SFX_CUCCO_MINIGAME_BELL); @@ -171,7 +176,6 @@ NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMi gActiveScriptInfo.commandSize = 0; } } -END_NONMATCH void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) { Entity** puVar1; @@ -211,7 +215,7 @@ void CuccoMinigame_WinItem(CuccoMinigameEntity* this) { } break; case ITEM_KINSTONE: - if (gSave.didAllFusions) { + if (gSave.kinstones.didAllFusions) { skipItem = 1; } break; diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index d3fb365f..5e552ab0 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -68,49 +68,41 @@ typedef struct { typedef void(CutsceneMiscObjectTypeAction)(CutsceneMiscObjectEntity*); -CutsceneMiscObjectTypeAction sub_08094A5C; -CutsceneMiscObjectTypeAction sub_08094A90; -CutsceneMiscObjectTypeAction sub_08094C30; -CutsceneMiscObjectTypeAction sub_08094C88; -CutsceneMiscObjectTypeAction sub_08094D94; -CutsceneMiscObjectTypeAction sub_08094E30; -CutsceneMiscObjectTypeAction sub_08094FA8; -CutsceneMiscObjectTypeAction sub_08095088; -CutsceneMiscObjectTypeAction sub_08095120; -CutsceneMiscObjectTypeAction sub_08095188; -CutsceneMiscObjectTypeAction sub_080951C4; -CutsceneMiscObjectTypeAction sub_08095288; -CutsceneMiscObjectTypeAction sub_080953A4; -CutsceneMiscObjectTypeAction sub_080953A4; -CutsceneMiscObjectTypeAction sub_080954DC; -CutsceneMiscObjectTypeAction sub_080956B4; -CutsceneMiscObjectTypeAction sub_0809577C; -CutsceneMiscObjectTypeAction sub_080957DC; -CutsceneMiscObjectTypeAction sub_0809584C; -CutsceneMiscObjectTypeAction sub_080958D8; -CutsceneMiscObjectTypeAction sub_08095918; -CutsceneMiscObjectTypeAction sub_08094C88; -CutsceneMiscObjectTypeAction sub_080959CC; -CutsceneMiscObjectTypeAction sub_08095A8C; -CutsceneMiscObjectTypeAction sub_08095B48; -CutsceneMiscObjectTypeAction sub_08095C00; -CutsceneMiscObjectTypeAction sub_080953A4; -CutsceneMiscObjectTypeAction sub_08095C68; -CutsceneMiscObjectTypeAction sub_08095CE0; -CutsceneMiscObjectTypeAction sub_08095CE0; -CutsceneMiscObjectTypeAction sub_08095DBC; -CutsceneMiscObjectTypeAction sub_08095F38; -CutsceneMiscObjectTypeAction sub_08096058; -CutsceneMiscObjectTypeAction sub_08096058; -CutsceneMiscObjectTypeAction sub_08094A90; -CutsceneMiscObjectTypeAction sub_08096084; -CutsceneMiscObjectTypeAction sub_08096084; -CutsceneMiscObjectTypeAction sub_08096168; -CutsceneMiscObjectTypeAction sub_080961F4; -CutsceneMiscObjectTypeAction sub_080961F4; -CutsceneMiscObjectTypeAction sub_080961F4; -CutsceneMiscObjectTypeAction sub_08096284; -CutsceneMiscObjectTypeAction sub_08096290; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type0; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type1; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type2; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type3; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type4; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type5; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type6; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type7; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type8; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type9; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type10; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type11; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type12; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type14; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type15; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type16; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type17; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type18; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type19; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type20; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type22; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type23; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type24; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type25; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type27; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type28; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type30; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type31; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type32; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type35; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type35; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type37; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type38; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type41; +CutsceneMiscObjectTypeAction CutsceneMiscObject_Type42; void sub_08095754(CutsceneMiscObjectEntity*); void sub_080957B4(CutsceneMiscObjectEntity*); @@ -120,18 +112,23 @@ void sub_08095D30(CutsceneMiscObjectEntity*, u32); static void sub_0809629C(CutsceneMiscObjectEntity*, u32); void CutsceneMiscObject(Entity* this) { - static CutsceneMiscObjectTypeAction* const sTypeTable[] = { - sub_08094A5C, sub_08094A90, sub_08094C30, sub_08094C88, sub_08094D94, sub_08094E30, sub_08094FA8, sub_08095088, - sub_08095120, sub_08095188, sub_080951C4, sub_08095288, sub_080953A4, sub_080953A4, sub_080954DC, sub_080956B4, - sub_0809577C, sub_080957DC, sub_0809584C, sub_080958D8, sub_08095918, sub_08094C88, sub_080959CC, sub_08095A8C, - sub_08095B48, sub_08095C00, sub_080953A4, sub_08095C68, sub_08095CE0, sub_08095CE0, sub_08095DBC, sub_08095F38, - sub_08096058, sub_08096058, sub_08094A90, sub_08096084, sub_08096084, sub_08096168, sub_080961F4, sub_080961F4, - sub_080961F4, sub_08096284, sub_08096290, + static CutsceneMiscObjectTypeAction* const CutsceneMiscObject_Types[] = { + CutsceneMiscObject_Type0, CutsceneMiscObject_Type1, CutsceneMiscObject_Type2, CutsceneMiscObject_Type3, + CutsceneMiscObject_Type4, CutsceneMiscObject_Type5, CutsceneMiscObject_Type6, CutsceneMiscObject_Type7, + CutsceneMiscObject_Type8, CutsceneMiscObject_Type9, CutsceneMiscObject_Type10, CutsceneMiscObject_Type11, + CutsceneMiscObject_Type12, CutsceneMiscObject_Type12, CutsceneMiscObject_Type14, CutsceneMiscObject_Type15, + CutsceneMiscObject_Type16, CutsceneMiscObject_Type17, CutsceneMiscObject_Type18, CutsceneMiscObject_Type19, + CutsceneMiscObject_Type20, CutsceneMiscObject_Type3, CutsceneMiscObject_Type22, CutsceneMiscObject_Type23, + CutsceneMiscObject_Type24, CutsceneMiscObject_Type25, CutsceneMiscObject_Type12, CutsceneMiscObject_Type27, + CutsceneMiscObject_Type28, CutsceneMiscObject_Type28, CutsceneMiscObject_Type30, CutsceneMiscObject_Type31, + CutsceneMiscObject_Type32, CutsceneMiscObject_Type32, CutsceneMiscObject_Type1, CutsceneMiscObject_Type35, + CutsceneMiscObject_Type35, CutsceneMiscObject_Type37, CutsceneMiscObject_Type38, CutsceneMiscObject_Type38, + CutsceneMiscObject_Type38, CutsceneMiscObject_Type41, CutsceneMiscObject_Type42, }; - sTypeTable[this->type]((CutsceneMiscObjectEntity*)this); + CutsceneMiscObject_Types[this->type]((CutsceneMiscObjectEntity*)this); } -void sub_08094A5C(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type0(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -142,7 +139,7 @@ void sub_08094A5C(CutsceneMiscObjectEntity* this) { GetNextFrame(super); } -void sub_08094A90(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type1(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->collisionLayer = 2; @@ -210,7 +207,7 @@ void sub_08094BE0(Entity* this) { } } -void sub_08094C30(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type2(CutsceneMiscObjectEntity* this) { Entity* p = super->parent; if (p == NULL || p->next == NULL) DeleteThisEntity(); @@ -224,7 +221,7 @@ void sub_08094C30(CutsceneMiscObjectEntity* this) { UpdateAnimationSingleFrame(super); } -void sub_08094C88(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type3(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action != 0) { @@ -283,7 +280,7 @@ void sub_08094D70(CutsceneMiscObjectEntity* this) { } } -void sub_08094D94(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type4(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action != 0) { @@ -316,7 +313,7 @@ void sub_08094E0C(CutsceneMiscObjectEntity* this) { } } -void sub_08094E30(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type5(CutsceneMiscObjectEntity* this) { if (super->type2 == 0) { if ((gRoomTransition.frameCount % 32) == 0) { Entity* e = CreateObject(0x6A, 5, 1); @@ -390,7 +387,7 @@ void sub_08094F98(CutsceneMiscObjectEntity* this) { CreateObject(CUTSCENE_MISC_OBJECT, 5, 0); } -void sub_08094FA8(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type6(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: super->action = 1; @@ -399,8 +396,8 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) { AddInteractableCheckableObject(super); break; case 1: - if (super->interactType != 0) { - super->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; super->action = 2; RemoveInteractableObject(super); gPlayerState.queued_action = PLAYER_EMPTYBOTTLE; @@ -441,7 +438,7 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) { } } -void sub_08095088(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) { u32 tmp; switch (super->action) { @@ -453,8 +450,8 @@ void sub_08095088(CutsceneMiscObjectEntity* this) { AddInteractableCheckableObject(super); break; case 1: - if (super->interactType != 0) { - super->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; super->action = 2; RemoveInteractableObject(super); CreateEzloHint(TEXT_INDEX(TEXT_BELARI, 0x1F), 0); @@ -473,7 +470,7 @@ void sub_08095088(CutsceneMiscObjectEntity* this) { super->type = tmp; } -void sub_08095120(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type8(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action = 1; SetDefaultPriority(super, PRIO_NO_BLOCK); @@ -493,7 +490,7 @@ void sub_08095164(CutsceneMiscObjectEntity* this) { } } -void sub_08095188(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type9(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action = 1; SetDefaultPriority(super, PRIO_NO_BLOCK); @@ -505,7 +502,7 @@ void sub_08095188(CutsceneMiscObjectEntity* this) { HandleEntity0x82Actions(super); } -void sub_080951C4(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type10(CutsceneMiscObjectEntity* this) { Entity* p; if (super->action == 0) { @@ -545,7 +542,7 @@ void sub_08095244(CutsceneMiscObjectEntity* this) { } } -void sub_08095288(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) { Entity* p; if (super->action == 0) { @@ -607,7 +604,7 @@ void sub_08095364(CutsceneMiscObjectEntity* this) { } } -void sub_080953A4(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type12(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->z.HALF.HI = -16; @@ -659,7 +656,7 @@ void sub_080954AC(CutsceneMiscObjectEntity* this, u32 arg2) { } } -void sub_080954DC(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type14(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: if (super->timer != 0) { @@ -719,28 +716,25 @@ void sub_0809567C(CutsceneMiscObjectEntity* this) { CalculateDirectionFromOffsets(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16)); } -void sub_080956B4(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type15(CutsceneMiscObjectEntity* this) { Entity* p; u16* p1; u16* p2; - Type15Vars* tmp; + u16* tmp; if (super->action == 0) { s32 i; - u16* p; u32 x; u32 y; super->action++; InitializeAnimation(super, 0); - // p = this->v.arr; - asm("mov r4, r5"); - asm("add r4, #0x68"); + tmp = ((CutsceneMiscObjectEntityType15*)this)->vars.arr; x = super->x.HALF_U.HI; y = super->y.HALF_U.HI; for (i = 0; i < 8; i++) { - *p++ = x; - *p++ = y; + *tmp++ = x; + *tmp++ = y; } } GetNextFrame(super); @@ -755,13 +749,13 @@ void sub_080956B4(CutsceneMiscObjectEntity* this) { } else { DeleteThisEntity(); } - tmp = &((CutsceneMiscObjectEntityType15*)this)->vars; - MemCopy(&tmp->arr[2], &tmp->arr[0], 0x1C); - super->x.HALF.HI = tmp->my_x; - super->y.HALF.HI = tmp->my_y; + tmp = ((CutsceneMiscObjectEntityType15*)this)->vars.arr; + MemCopy(&tmp[2], &tmp[0], 0x1C); + super->x.HALF.HI = tmp[10]; + super->y.HALF.HI = tmp[11]; super->z.HALF.HI = p->z.HALF.HI; - tmp->parent_x = p->x.HALF.HI; - tmp->parent_y = p->y.HALF.HI; + tmp[14] = p->x.HALF.HI; + tmp[15] = p->y.HALF.HI; } void sub_08095754(CutsceneMiscObjectEntity* this) { @@ -773,7 +767,7 @@ void sub_08095754(CutsceneMiscObjectEntity* this) { } } -void sub_0809577C(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type16(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->z.HALF.HI = -16; @@ -793,7 +787,7 @@ void sub_080957B4(CutsceneMiscObjectEntity* this) { } } -void sub_080957DC(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type17(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -814,7 +808,7 @@ void sub_08095810(CutsceneMiscObjectEntity* this) { } } -void sub_0809584C(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type18(CutsceneMiscObjectEntity* this) { u32 tmp, idx; idx = super->health; @@ -837,7 +831,7 @@ void sub_0809584C(CutsceneMiscObjectEntity* this) { super->type = tmp; } -void sub_080958D8(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type19(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -849,7 +843,7 @@ void sub_080958D8(CutsceneMiscObjectEntity* this) { sub_08095954(this); } -void sub_08095918(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type20(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; SetDefaultPriority(super, PRIO_PLAYER_EVENT); @@ -883,7 +877,7 @@ void sub_08095954(CutsceneMiscObjectEntity* this) { } } -void sub_080959CC(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type22(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 0; @@ -914,7 +908,7 @@ void sub_08095A68(CutsceneMiscObjectEntity* this) { } } -void sub_08095A8C(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type23(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: super->action++; @@ -947,7 +941,7 @@ void sub_08095A8C(CutsceneMiscObjectEntity* this) { } } -void sub_08095B48(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type24(CutsceneMiscObjectEntity* this) { Entity* p; u32 tmp; @@ -987,7 +981,7 @@ void sub_08095BE0(CutsceneMiscObjectEntity* this, u32 val) { } } -void sub_08095C00(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type25(CutsceneMiscObjectEntity* this) { if (super->action & 0x80) { DeleteThisEntity(); } else { @@ -1011,7 +1005,7 @@ void sub_08095C48(Entity* this) { } } -void sub_08095C68(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type27(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_080042D0(super, super->frameIndex, (u16)super->spriteIndex); @@ -1039,7 +1033,7 @@ void sub_08095CB0(CutsceneMiscObjectEntity* this) { } } -void sub_08095CE0(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type28(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 0; @@ -1074,7 +1068,7 @@ void sub_08095D8C(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { } } -void sub_08095DBC(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type30(CutsceneMiscObjectEntity* this) { if (gActiveScriptInfo.syncFlags & 0x10) DeleteThisEntity(); if (super->type2 == 0) { @@ -1141,7 +1135,7 @@ void sub_08095EAC(Entity* this, ScriptExecutionContext* ctx) { } #define local ((Type1F*)this) -void sub_08095F38(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type31(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action == 0) { @@ -1195,7 +1189,7 @@ void sub_08096028(CutsceneMiscObjectEntity* this) { CreateObject(CUTSCENE_MISC_OBJECT, 0x1F, type2); } -void sub_08096058(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type32(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -1205,7 +1199,7 @@ void sub_08096058(CutsceneMiscObjectEntity* this) { GetNextFrame(super); } -void sub_08096084(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type35(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -1239,7 +1233,7 @@ void sub_080960C4(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { } } -void sub_08096168(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type37(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 1; @@ -1263,7 +1257,7 @@ void sub_080961B0(CutsceneMiscObjectEntity* this) { } } -void sub_080961F4(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type38(CutsceneMiscObjectEntity* this) { super->spriteSettings.draw = 1; super->frameIndex = 0; } @@ -1290,11 +1284,11 @@ void sub_08096260(CutsceneMiscObjectEntity* this) { } } -void sub_08096284(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type41(CutsceneMiscObjectEntity* this) { sub_0809629C(this, 0xd); } -void sub_08096290(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type42(CutsceneMiscObjectEntity* this) { sub_0809629C(this, 0xe); } diff --git a/src/object/cutsceneOrchestrator.c b/src/object/cutsceneOrchestrator.c index cdd0a4eb..e844b93d 100644 --- a/src/object/cutsceneOrchestrator.c +++ b/src/object/cutsceneOrchestrator.c @@ -2,8 +2,9 @@ * @file cutsceneOrchestrator.c * @ingroup Objects * - * @brief CutsceneO rchestrator object + * @brief Cutscene Orchestrator object */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "hitbox.h" @@ -13,9 +14,9 @@ void CutsceneOrchestrator(Entity* this) { if (this->action == 0) { this->action = 1; this->hitbox = (Hitbox*)&gHitbox_2; - sub_0807DD50(this); + InitScriptForNPC(this); } else { - sub_0807DD94(this, NULL); + ExecuteScriptAndHandleAnimation(this, NULL); } } else { this->action = 1; diff --git a/src/object/deathFx.c b/src/object/deathFx.c index cf1d53ed..e6121ec0 100644 --- a/src/object/deathFx.c +++ b/src/object/deathFx.c @@ -5,11 +5,11 @@ * @brief Death Fx object */ #define NENT_DEPRECATED +#include "object/deathFx.h" #include "enemy.h" #include "entity.h" #include "functions.h" #include "global.h" -#include "object/deathFx.h" #include "sound.h" void sub_08081790(DeathFxObject* this); diff --git a/src/object/dirtParticle.c b/src/object/dirtParticle.c index 7e6b594d..8bf6bd31 100644 --- a/src/object/dirtParticle.c +++ b/src/object/dirtParticle.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/enemyItem.c b/src/object/enemyItem.c index 862f184e..3f199ff8 100644 --- a/src/object/enemyItem.c +++ b/src/object/enemyItem.c @@ -4,10 +4,8 @@ * * @brief Enemy Item object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/evilSpirit.c b/src/object/evilSpirit.c new file mode 100644 index 00000000..3b1a2d1e --- /dev/null +++ b/src/object/evilSpirit.c @@ -0,0 +1,214 @@ +#define NENT_DEPRECATED +#include "entity.h" +#include "functions.h" +#include "flags.h" +#include "object.h" + +typedef struct { + Entity base; + u8 filler[0xe]; + u16 unk76; + u16 unk78; + u16 unk7a; + u16 unk7c; + u8 filler2; + u8 unk7f; + s32 x; + s32 y; +} EvilSpiritEntity; + +void EvilSpirit_Init(EvilSpiritEntity*); +void EvilSpirit_Action1(EvilSpiritEntity*); +void EvilSpirit_Action2(EvilSpiritEntity*); +void EvilSpirit_Action3(EvilSpiritEntity*); + +void EvilSpirit(Entity* this) { + static void (*const EvilSpirit_Actions[])(EvilSpiritEntity*) = { + EvilSpirit_Init, + EvilSpirit_Action1, + EvilSpirit_Action2, + EvilSpirit_Action3, + }; + EvilSpirit_Actions[this->action]((EvilSpiritEntity*)this); + this->contactFlags = 0; + SetAffineInfo(this, ((EvilSpiritEntity*)this)->unk76, ((EvilSpiritEntity*)this)->unk7a, 0); +} + +void EvilSpirit_Init(EvilSpiritEntity* this) { + static const u16 gUnk_08120678[] = { 0x100, 0x110, 0x150, 0x1c0, 0x200 }; + u32 uVar1; + Entity* evilSpiritEnt; + u32 index; + + if (CheckLocalFlag(SORA_ELDER_RECOVER)) { + DeleteThisEntity(); + } + super->action = 1; + uVar1 = gUnk_08120678[super->type]; + this->unk7c = uVar1; + this->unk76 = uVar1; + this->unk7a = this->unk7c; + if (super->type == 0) { + this->x = super->x.WORD; + this->y = super->y.WORD; + super->spriteRendering.b3 = 0; + super->parent = super; + COLLISION_ON(super); + super->collisionFlags = 7; + super->hitType = 1; + super->flags2 = 4; + for (index = 0; index < 4; index++) { + evilSpiritEnt = CreateObjectWithParent(super, EVIL_SPIRIT, index + 1, 0); + super->child = evilSpiritEnt; + if (evilSpiritEnt != NULL) { + evilSpiritEnt->parent = super->parent; + super->child->child = super; + super->parent = super->child; + } + } + } else { + super->spriteRendering.b3 = 1; + } + InitializeAnimation(super, super->type); + EvilSpirit_Action1(this); +} + +void EvilSpirit_Action1(EvilSpiritEntity* this) { + s32 sVar3; + u32 dir; + s16 iVar5; + + if (super->type != 0) { + if (((EvilSpiritEntity*)super->child)->unk7f == 0) { + this->unk76 = this->unk7c; + this->unk7a = this->unk7c; + super->speed = 0x300; + super->direction = + CalculateDirectionFromOffsets(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80; + } else { + super->speed = 0x600; + dir = CalculateDirectionFromOffsets(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) ^ 0x80; + if (dir != super->direction) { + if ((u8)(dir - super->direction) > 0x80) { + super->direction += 3; + } else { + super->direction -= 3; + } + } + if ((gPlayerEntity.animationState & 2) == 0) { + this->unk76 = this->unk7c + 0x40; + } else { + this->unk76 = this->unk7c - 0x20; + this->unk7a = this->unk7c + 0x50; + ; + } + } + super->x = super->parent->x; + super->y = super->parent->y; + LinearMoveAngle(super, (int)super->speed, super->direction); + return; + } + + if ((super->contactFlags & 0x7f) == 0x13) { + super->direction++; + super->gustJarTolerance--; + this->unk7f = 1; + if ((gPlayerEntity.animationState & 2) == 0) { + this->unk76 = this->unk7c + 0x10; + } else { + this->unk76 = this->unk7c - 0x20; + this->unk7a = this->unk7c + 0x30; + } + } else { + super->direction = super->direction + 2; + super->gustJarTolerance = 0xf0; + this->unk7f = 0; + this->unk76 = this->unk7c; + this->unk7a = this->unk7c; + } + + if (super->gustJarTolerance == 0) { + super->action = 2; + this->unk7f = 0; + return; + } + + if ((super->direction + 0x40) * 0x1000000 >= 0) { + sVar3 = this->unk76; + if ((short)this->unk76 >= 1) { + this->unk76 = -sVar3; + } + } else { + sVar3 = this->unk76; + if (-1 >= (short)this->unk76) { + this->unk76 = -sVar3; + } + } + + sVar3 = FixedMul(gSineTable[super->direction], 0x2000); + iVar5 = FixedDiv(sVar3, 0x100); + super->x.WORD = this->x + (iVar5 << 8); + sVar3 = FixedMul(gSineTable[super->direction + 0x40], 0x1000); + iVar5 = FixedDiv(sVar3, 0x100); + super->y.WORD = this->y - (iVar5 << 8); +} + +void EvilSpirit_Action2(EvilSpiritEntity* this) { + u32 index; + + if ((super->contactFlags & 0x7f) != 0x13) { + super->action = 3; + } else { + if (sub_0806F3E4(super)) { + SetLocalFlag(SORA_ELDER_RECOVER); + SetRoomFlag(0); + + for (index = 0; index < 4; index++) { + Entity* ent = super->child; + super->child = ent->parent; + DeleteEntity(ent); + } + DeleteThisEntity(); + } + } +} + +void EvilSpirit_Action3(EvilSpiritEntity* this) { + short sVar2; + short iVar4; + int iVar6; + + super->direction = CalculateDirectionFromOffsets(this->x - super->x.WORD, this->y - super->y.WORD); + if ((super->contactFlags & 0x7f) == 0x13) { + super->speed = 0x100; + super->gustJarTolerance--; + this->unk7f = 1; + + if ((gPlayerEntity.animationState & 2) == 0) { + this->unk76 = this->unk7c + 0x10; + } else { + this->unk76 = this->unk7c - 0x20; + this->unk7a = this->unk7c + 0x30; + } + } else { + super->speed = 0x200; + super->gustJarTolerance = 0xf0; + this->unk7f = 0; + this->unk76 = this->unk7c; + this->unk7a = this->unk7c; + } + + if (super->gustJarTolerance == 0) { + super->action = 2; + this->unk7f = 0; + } else { + LinearMoveAngle(super, super->speed, super->direction); + super->direction ^= 0x80; + sVar2 = FixedMul(gSineTable[super->direction], 0x2000); + iVar6 = this->x + (FixedDiv(sVar2, 0x100) << 8); + sVar2 = FixedMul(gSineTable[super->direction + 0x40], 0x1000); + if (EntityWithinDistance(super, iVar6, this->y - (FixedDiv(sVar2, 0x100) << 8), 2)) { + super->action = 1; + } + } +} diff --git a/src/object/eyeSwitch.c b/src/object/eyeSwitch.c index 6a584d68..8769fd4f 100644 --- a/src/object/eyeSwitch.c +++ b/src/object/eyeSwitch.c @@ -19,20 +19,20 @@ typedef struct { u16 eyeSwitchFlags2; } EyeSwitchEntity; -void sub_080886A4(EyeSwitchEntity* this); -void sub_08088718(EyeSwitchEntity* this); -void sub_08088760(EyeSwitchEntity* this); -void sub_08088790(EyeSwitchEntity* this); -void sub_080887D8(EyeSwitchEntity* this); +void EyeSwitch_Init(EyeSwitchEntity* this); +void EyeSwitch_Action1(EyeSwitchEntity* this); +void EyeSwitch_Action2(EyeSwitchEntity* this); +void EyeSwitch_Action3(EyeSwitchEntity* this); +void EyeSwitch_Action4(EyeSwitchEntity* this); void EyeSwitch(Entity* this) { - static void (*const actionFuncs[])(EyeSwitchEntity*) = { - sub_080886A4, sub_08088718, sub_08088760, sub_08088790, sub_080887D8, + static void (*const EyeSwitch_Actions[])(EyeSwitchEntity*) = { + EyeSwitch_Init, EyeSwitch_Action1, EyeSwitch_Action2, EyeSwitch_Action3, EyeSwitch_Action4, }; - actionFuncs[this->action]((EyeSwitchEntity*)this); + EyeSwitch_Actions[this->action]((EyeSwitchEntity*)this); } -void sub_080886A4(EyeSwitchEntity* this) { +void EyeSwitch_Init(EyeSwitchEntity* this) { super->animationState = super->type & 3; super->spritePriority.b0 = 6; super->collisionFlags = 7; @@ -50,7 +50,7 @@ void sub_080886A4(EyeSwitchEntity* this) { } } -void sub_08088718(EyeSwitchEntity* this) { +void EyeSwitch_Action1(EyeSwitchEntity* this) { if ((super->contactFlags == 0x95 || super->contactFlags == 0x8e) && (DirectionRoundUp(super->contactedEntity->direction) >> 3 == (super->animationState & 3))) { super->action = 2; @@ -60,7 +60,7 @@ void sub_08088718(EyeSwitchEntity* this) { } } -void sub_08088760(EyeSwitchEntity* this) { +void EyeSwitch_Action2(EyeSwitchEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action = 3; @@ -69,7 +69,7 @@ void sub_08088760(EyeSwitchEntity* this) { } } -void sub_08088790(EyeSwitchEntity* this) { +void EyeSwitch_Action3(EyeSwitchEntity* this) { if (super->timer != 0) { if ((this->eyeSwitchFlags2 != this->eyeSwitchFlags) && (CheckFlags(this->eyeSwitchFlags))) { super->timer = 0; @@ -82,7 +82,7 @@ void sub_08088790(EyeSwitchEntity* this) { } } -void sub_080887D8(EyeSwitchEntity* this) { +void EyeSwitch_Action4(EyeSwitchEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action = 1; diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 256a505c..6465dad9 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -4,10 +4,8 @@ * * @brief Ezlo Cap object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "message.h" #include "object.h" diff --git a/src/object/ezloCapFlying.c b/src/object/ezloCapFlying.c index f2d40b72..d05ada5f 100644 --- a/src/object/ezloCapFlying.c +++ b/src/object/ezloCapFlying.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "new_player.h" #include "object.h" diff --git a/src/object/fairy.c b/src/object/fairy.c index 8b177ced..ba3b6703 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -4,11 +4,9 @@ * * @brief Fairy object */ - #define NENT_DEPRECATED #include "collision.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "item.h" #include "object.h" @@ -36,6 +34,8 @@ void Fairy_SubAction0(FairyEntity*); void Fairy_SubAction1(FairyEntity*); void Fairy_SubAction2(FairyEntity*); +extern void sub_08081404(Entity*, u32); + void Fairy(FairyEntity* this) { static void (*const Fairy_Actions[])(FairyEntity*) = { Fairy_Init, Fairy_Action1, Fairy_Action2, Fairy_Action3, Fairy_Action4, diff --git a/src/object/fan.c b/src/object/fan.c index f9ee5fc5..b1197147 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -9,7 +9,6 @@ #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "object.h" #include "player.h" #include "sound.h" diff --git a/src/object/fanWind.c b/src/object/fanWind.c index 9b8762f8..3f6d74b3 100644 --- a/src/object/fanWind.c +++ b/src/object/fanWind.c @@ -4,10 +4,10 @@ * * @brief Fan Wind object */ +#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "functions.h" -#include "global.h" void FanWind(Entity* this) { u8* collisionData; diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index 2a2602ae..2412f3e8 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -4,7 +4,6 @@ * * @brief Figurine Device object */ - #define NENT_DEPRECATED #include "figurineMenu.h" #include "fileselect.h" @@ -33,13 +32,13 @@ typedef struct { /*0x7e*/ u8 unk_7e[2]; /*0x80*/ u8 unk_80; #endif - /*0x81*/ u8 unk_81; + /*0x81*/ u8 shells; #ifdef EU - /*0x82*/ u8 unk_82; - /*0x83*/ u8 unk_83; + /*0x82*/ u8 prevChance; + /*0x83*/ u8 chance; #else - /*0x82*/ s8 unk_82; - /*0x83*/ s8 unk_83; + /*0x82*/ s8 prevChance; + /*0x83*/ s8 chance; #endif } FigurineDeviceEntity; @@ -48,14 +47,14 @@ extern u8 gUnk_020227F0; void sub_0808804C(FigurineDeviceEntity*); void sub_08087F58(FigurineDeviceEntity*); -void sub_08088328(FigurineDeviceEntity*); +void FigurineDevice_Draw(FigurineDeviceEntity*); void sub_0808826C(FigurineDeviceEntity*); void sub_080882A8(FigurineDeviceEntity*); void sub_080880D8(FigurineDeviceEntity*); -void sub_08087F94(FigurineDeviceEntity*, s32); -void sub_08088034(FigurineDeviceEntity*); +void FigurineDevice_ChangeShellAmount(FigurineDeviceEntity*, s32); +void FigurineDevice_PlayErrorSound(FigurineDeviceEntity*); bool32 sub_08088160(FigurineDeviceEntity*, s32); -void sub_08088424(FigurineDeviceEntity*); +void FigurineDevice_GetChanceBasedOffFigurineCount(FigurineDeviceEntity*); void FigurineDevice_Init(FigurineDeviceEntity*); void FigurineDevice_Action1(FigurineDeviceEntity*); void FigurineDevice_Action2(FigurineDeviceEntity*); @@ -110,7 +109,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) { case 3: super->timer = 30; super->subtimer = 0; - this->unk_81 = 1; + this->shells = 1; this->unk_7a = 0; this->unk_7b = 0; this->unk_80 = 0; @@ -127,8 +126,8 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) { AddInteractableCheckableObject(super); break; case 1: - if (super->interactType != 0) { - super->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; ResetPlayerAnimationAndAction(); if (CheckLocalFlag(SHOP07_TANA)) { this->unk_7a = 2; @@ -167,7 +166,7 @@ void FigurineDevice_Action2(FigurineDeviceEntity* this) { SetLocalFlag(SHOP07_TANA); case 1: this->unk_7a = 0; - sub_08088328((FigurineDeviceEntity*)super->child); + FigurineDevice_Draw((FigurineDeviceEntity*)super->child); ClearRoomFlag(0); entity = CreateObject(FIGURINE_DEVICE, 2, 0); if (entity != NULL) { @@ -235,7 +234,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) { return; } this->unk_7a = 1; - this->unk_81 = 1; + this->shells = 1; ClearRoomFlag(1); sub_0808826C(this); sub_080882A8(this); @@ -247,16 +246,16 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) { if (super->timer != 0) { super->timer--; } - if ((gInput.newKeys & 1) != 0) { + if ((gInput.newKeys & A_BUTTON) != 0) { SoundReq(SFX_TEXTBOX_SELECT); this->unk_7a = 2; super->timer = 60; sub_08050384(); return; } - old_81 = this->unk_81; + old_81 = this->shells; #ifndef EU - if ((gInput.heldKeys & 0x100) != 0) { + if ((gInput.heldKeys & R_BUTTON) != 0) { tmp = 10; } else { tmp = 1; @@ -266,26 +265,26 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) { #else switch (gInput.unk4 & 0xfffffeff) { #endif - case 0x40: - sub_08087F94(this, tmp); + case DPAD_UP: + FigurineDevice_ChangeShellAmount(this, tmp); break; - case 0x80: - sub_08087F94(this, -tmp); + case DPAD_DOWN: + FigurineDevice_ChangeShellAmount(this, -tmp); break; } - if (old_81 != this->unk_81) { + if (old_81 != this->shells) { sub_080882A8(this); } #else switch (gInput.unk4) { - case 0x40: - sub_08087F94(this, 1); + case DPAD_UP: + FigurineDevice_ChangeShellAmount(this, 1); break; - case 0x80: - sub_08087F94(this, -1); + case DPAD_DOWN: + FigurineDevice_ChangeShellAmount(this, -1); break; } - if (old_81 != this->unk_81) { + if (old_81 != this->shells) { sub_080882A8(this); } #endif @@ -299,7 +298,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) { gMessage.textWindowPosX = 1; gMessage.textWindowPosY = 0xc; #endif - gMessage.rupees = this->unk_81; + gMessage.rupees = this->shells; break; } } @@ -315,124 +314,124 @@ void sub_08087F58(FigurineDeviceEntity* this) { } } -void sub_08087F94(FigurineDeviceEntity* this, s32 param_2) { +void FigurineDevice_ChangeShellAmount(FigurineDeviceEntity* this, s32 shellDifference) { #ifdef EU - u32 uVar8; - u32 iVar9; + u32 newAmount; + u32 newChance; - iVar9 = this->unk_83 + param_2; + newChance = this->chance + shellDifference; if (CheckLocalFlag(SHOP07_COMPLETE)) { - sub_08088034(this); + FigurineDevice_PlayErrorSound(this); return; } - if (param_2 < 0) { - if (iVar9 < this->unk_82) { - if (this->unk_83 != this->unk_82) { - this->unk_83 = this->unk_82; - this->unk_81 = 1; + if (shellDifference < 0) { + if (newChance < this->prevChance) { + if (this->chance != this->prevChance) { + this->chance = this->prevChance; + this->shells = 1; SoundReq(SFX_TEXTBOX_CHOICE); } else { - sub_08088034(this); + FigurineDevice_PlayErrorSound(this); } } else { - this->unk_83 = iVar9; - this->unk_81 += param_2; + this->chance = newChance; + this->shells += shellDifference; SoundReq(SFX_TEXTBOX_CHOICE); } return; } - uVar8 = this->unk_81 + param_2; - if (uVar8 > (s32)gSave.stats.shells) { - if (gSave.stats.shells != this->unk_81) { - uVar8 = gSave.stats.shells; - param_2 = (gSave.stats.shells - this->unk_81); - iVar9 = this->unk_83 + param_2; + newAmount = this->shells + shellDifference; + if (newAmount > gSave.stats.shells) { + if (gSave.stats.shells != this->shells) { + newAmount = gSave.stats.shells; + shellDifference = (gSave.stats.shells - this->shells); + newChance = this->chance + shellDifference; } else { - sub_08088034(this); + FigurineDevice_PlayErrorSound(this); return; } - } else if (iVar9 > 100) { - if (this->unk_83 == 100) { - sub_08088034(this); + } else if (newChance > 100) { + if (this->chance == 100) { + FigurineDevice_PlayErrorSound(this); return; } else { - iVar9 = 100; - param_2 = (iVar9 - this->unk_83); - uVar8 = this->unk_81 + param_2; + newChance = 100; + shellDifference = (newChance - this->chance); + newAmount = this->shells + shellDifference; } } #else - s32 uVar8; - s32 iVar9; - s32 t1, t2; + s32 newAmount; + s32 newChance; + s32 prevChance, prevShells; if (CheckLocalFlag(SHOP07_COMPLETE)) { - sub_08088034(this); + FigurineDevice_PlayErrorSound(this); return; } - // This could probably be done without t1 and t2 - t1 = this->unk_83; - iVar9 = t1 + param_2; - if (param_2 < 0) { - if (iVar9 < this->unk_82) { - if (this->unk_83 != this->unk_82) { - this->unk_83 = this->unk_82; - this->unk_81 = 1; + // This could probably be done without prevChance and prevShells + prevChance = this->chance; + newChance = prevChance + shellDifference; + if (shellDifference < 0) { + if (newChance < this->prevChance) { + if (this->chance != this->prevChance) { + this->chance = this->prevChance; + this->shells = 1; SoundReq(SFX_TEXTBOX_CHOICE); } else { - sub_08088034(this); + FigurineDevice_PlayErrorSound(this); } } else { - this->unk_83 = iVar9; - this->unk_81 += param_2; + this->chance = newChance; + this->shells += shellDifference; SoundReq(SFX_TEXTBOX_CHOICE); } return; } - t2 = this->unk_81; - uVar8 = t2 + param_2; - if (uVar8 > gSave.stats.shells) { - if (gSave.stats.shells != this->unk_81) { - uVar8 = gSave.stats.shells; - param_2 = (gSave.stats.shells - this->unk_81); - iVar9 = t1 + param_2; + prevShells = this->shells; + newAmount = prevShells + shellDifference; + if (newAmount > gSave.stats.shells) { + if (gSave.stats.shells != this->shells) { + newAmount = gSave.stats.shells; + shellDifference = (gSave.stats.shells - this->shells); + newChance = prevChance + shellDifference; #ifdef JP - if (iVar9 > 100) { - iVar9 = 100; - param_2 = (iVar9 - t1); - uVar8 = t2 + param_2; + if (newChance > 100) { + newChance = 100; + shellDifference = (newChance - prevChance); + newAmount = prevShells + shellDifference; } #endif } else { - sub_08088034(this); + FigurineDevice_PlayErrorSound(this); return; } } #ifdef JP - else if (iVar9 > 100) { + else if (newChance > 100) { #else - if (iVar9 > 100) { + if (newChance > 100) { #endif - if (this->unk_83 == 100) { - sub_08088034(this); + if (this->chance == 100) { + FigurineDevice_PlayErrorSound(this); return; } else { - iVar9 = 100; - param_2 = (iVar9 - t1); - uVar8 = t2 + param_2; + newChance = 100; + shellDifference = (newChance - prevChance); + newAmount = prevShells + shellDifference; } } #endif - this->unk_83 = iVar9; - this->unk_81 = uVar8; + this->chance = newChance; + this->shells = newAmount; SoundReq(SFX_TEXTBOX_CHOICE); } -void sub_08088034(FigurineDeviceEntity* this) { +void FigurineDevice_PlayErrorSound(FigurineDeviceEntity* this) { if (super->timer == 0) { super->timer = 20; SoundReq(SFX_MENU_ERROR); @@ -475,26 +474,24 @@ void sub_080880D8(FigurineDeviceEntity* this) { it++; } if (++this->unk_7b == 4) { - if (gSave.field_0x9[0] != this->unk_80) { - if (gSave.field_0x9[0] != 0) { + if (gSave.available_figurines != this->unk_80) { + if (gSave.available_figurines != 0) { SetRoomFlag(6); } - gSave.field_0x9[0] = this->unk_80; + gSave.available_figurines = this->unk_80; } - if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.filler[0])) { + if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.figurineCount)) { ClearLocalFlag(SHOP07_COMPLETE); } } } -NONMATCH("asm/non_matching/figurineDevice/sub_08088160.inc", - bool32 sub_08088160(FigurineDeviceEntity* this, s32 param_2)) { - u8 bVar1; - bool32 condition; - u32 uVar3; +bool32 sub_08088160(FigurineDeviceEntity* this, s32 param_2) { bool32 result; const struct_080FC3E4* ptr; - u32 tmp; +#if !defined(JP) && !defined(EU) + u8 kinstoneId; +#endif ptr = &gUnk_080FC3E4[param_2]; result = FALSE; @@ -504,74 +501,81 @@ NONMATCH("asm/non_matching/figurineDevice/sub_08088160.inc", switch (ptr->unk_6) { case 0x8: case 0x40: - if (CheckLocalFlagByBank(ptr->bank, ptr->flag)) { + if (CheckLocalFlagByBank(ptr->bank, ptr->flag)) result = TRUE; - } - return result; break; case 0x10: - if (CheckKinstoneFused(gUnk_080FC3E4[param_2].flag)) { + if (CheckKinstoneFused(ptr->flag)) result = TRUE; - } - return result; break; default: - return result; + break; case 0x20: - switch (gUnk_080FC3E4[param_2].flag) { + switch (ptr->flag) { +#if defined(JP) || defined(EU) case 0: if (CheckKinstoneFused(KINSTONE_20) || CheckKinstoneFused(KINSTONE_10) || - CheckKinstoneFused(KINSTONE_19)) { + CheckKinstoneFused(KINSTONE_19)) result = TRUE; - } break; case 1: - if ((u8)this->unk_7c >= 5 && CheckKinstoneFused(KINSTONE_28)) { + if (this->unk_7c >= 5 && CheckKinstoneFused(KINSTONE_28)) result = TRUE; - } - break; +#else + case 0: + if (CheckKinstoneFused(KINSTONE_20) || CheckKinstoneFused(KINSTONE_10)) { + result = TRUE; + break; + } + kinstoneId = KINSTONE_19; + backward_tail_merge: + if (CheckKinstoneFused(kinstoneId)) + result = TRUE; + break; + case 1: + if (this->unk_7c >= 5) { + kinstoneId = KINSTONE_28; + goto backward_tail_merge; + } + break; +#endif case 2: if (CheckKinstoneFused(KINSTONE_54) || CheckKinstoneFused(KINSTONE_56) || - CheckKinstoneFused(KINSTONE_3D)) { + CheckKinstoneFused(KINSTONE_3D)) result = TRUE; - } break; case 3: if (CheckKinstoneFused(KINSTONE_3B) || CheckKinstoneFused(KINSTONE_4A) || - CheckKinstoneFused(KINSTONE_D)) { + CheckKinstoneFused(KINSTONE_D)) result = TRUE; - } break; case 4: if (CheckKinstoneFused(KINSTONE_49) || CheckKinstoneFused(KINSTONE_55) || - CheckKinstoneFused(KINSTONE_3C)) { + CheckKinstoneFused(KINSTONE_3C)) result = TRUE; - } break; +#if !defined(JP) && !defined(EU) case 5: - if (this->unk_7c >= 2 && CheckGlobalFlag(MACHI_MACHIHOKORI)) { + if (this->unk_7c >= 2 && CheckGlobalFlag(MACHI_MACHIHOKORI)) result = TRUE; - } - default: - return result; + break; +#endif } - break; } } return result; } -END_NONMATCH void sub_0808826C(FigurineDeviceEntity* this) { - s32 tmp = 0x64; - tmp *= ((this->unk_80 - gSave.stats.filler[0])); - tmp = tmp / this->unk_80; + s32 tmp = 100; + tmp *= this->unk_80 - gSave.stats.figurineCount; + tmp /= this->unk_80; if (tmp == 0 && !CheckLocalFlag(SHOP07_COMPLETE)) { tmp = 1; } - this->unk_83 = tmp; - this->unk_82 = this->unk_83; + this->chance = tmp; + this->prevChance = this->chance; } void sub_080882A8(FigurineDeviceEntity* this) { @@ -593,8 +597,8 @@ void sub_080882A8(FigurineDeviceEntity* this) { static const u16 gUnk_08120AE4[] = { TEXT_INDEX(TEXT_CARLOV, 0x18), TEXT_INDEX(TEXT_CARLOV, 0x19) }; u8* ptr; sub_08050384(); - sub_08057044(this->unk_81, gUnk_020227E8, 0x202020); - sub_08057044(this->unk_83, &gUnk_020227E8[1], 0x202020); + sub_08057044(this->shells, gUnk_020227E8, 0x202020); + sub_08057044(this->chance, &gUnk_020227E8[1], 0x202020); ptr = (u8*)0x02000000; if (ptr[7] == 0) { ShowTextBox(gUnk_08120AE4[super->type2], (Font*)&gUnk_08120AB4); // TODO convert data @@ -604,114 +608,114 @@ void sub_080882A8(FigurineDeviceEntity* this) { gScreen.bg0.updated = 1; } -void sub_08088328(FigurineDeviceEntity* this) { - u32 uVar2; - u32 uVar3; - u32 uVar5; - u32 uVar6; +void FigurineDevice_Draw(FigurineDeviceEntity* this) { + u32 isLucky; + u32 rand; + u32 prevFigurineIndex; + u32 figurineIndex; do { - uVar2 = Random(); - uVar2 &= 0x7f; - } while (uVar2 >= 100); - ModShells(-this->unk_81); - uVar3 = Random(); - uVar6 = (uVar3 & 0x7f) + 1; - uVar5 = uVar6; - sub_08088424(this); - if (uVar2 < this->unk_83) { - uVar2 = FALSE; + isLucky = Random(); + isLucky &= 0x7f; + } while (isLucky >= 100); + ModShells(-this->shells); + rand = Random(); + figurineIndex = (rand & 0x7f) + 1; + prevFigurineIndex = figurineIndex; + FigurineDevice_GetChanceBasedOffFigurineCount(this); + if (isLucky < this->chance) { + isLucky = FALSE; do { - if (uVar2) + if (isLucky) break; - if (uVar6 > 0x88) { - uVar6 = 1; + if (figurineIndex > 136) { + figurineIndex = 1; } - if (sub_08088160(this, uVar6) && ReadBit(&gSave.stats.filler4[4], uVar6) == 0) { - uVar2 = TRUE; + if (sub_08088160(this, figurineIndex) && ReadBit(gSave.figurines, figurineIndex) == 0) { + isLucky = TRUE; } else { - uVar6++; + figurineIndex++; } - } while (uVar5 != uVar6); + } while (prevFigurineIndex != figurineIndex); } else { - uVar2 = TRUE; + isLucky = TRUE; do { - if (!uVar2) + if (!isLucky) break; - if (uVar6 > 0x88) { - uVar6 = 1; + if (figurineIndex > 136) { + figurineIndex = 1; } - if (sub_08088160(this, uVar6) && ReadBit(&gSave.stats.filler4[4], uVar6) != 0) { - uVar2 = FALSE; + if (sub_08088160(this, figurineIndex) && ReadBit(gSave.figurines, figurineIndex) != 0) { + isLucky = FALSE; } else { - uVar6++; + figurineIndex++; } - } while (uVar5 != uVar6); + } while (prevFigurineIndex != figurineIndex); } - if (uVar2) { - gSave.stats.filler[0]++; - if (gSave.stats.filler[0] != this->unk_80) { + if (isLucky) { + gSave.stats.figurineCount++; + if (gSave.stats.figurineCount != this->unk_80) { SetRoomFlag(7); } else { SetLocalFlag(SHOP07_COMPLETE); SetRoomFlag(8); } } - this->unk_7d = uVar6; - ((FigurineDeviceEntity*)super->parent)->unk_7d = uVar6; + this->unk_7d = figurineIndex; + ((FigurineDeviceEntity*)super->parent)->unk_7d = figurineIndex; } -void sub_08088424(FigurineDeviceEntity* this) { - if (gSave.stats.filler[0] < 0x32) { - if (this->unk_83 < 0x0f) { - this->unk_83 = 0x0f; +void FigurineDevice_GetChanceBasedOffFigurineCount(FigurineDeviceEntity* this) { + if (gSave.stats.figurineCount < 50) { + if (this->chance < 15) { + this->chance = 15; } - } else if (gSave.stats.filler[0] < 0x50) { - if (this->unk_83 < 0xc) { - this->unk_83 = 0xc; + } else if (gSave.stats.figurineCount < 80) { + if (this->chance < 12) { + this->chance = 12; } - } else if (gSave.stats.filler[0] < 0x6e) { - if (this->unk_83 < 9) { - this->unk_83 = 9; + } else if (gSave.stats.figurineCount < 110) { + if (this->chance < 9) { + this->chance = 9; } } else { - if (this->unk_83 < 6) { - this->unk_83 = 6; + if (this->chance < 6) { + this->chance = 6; } } } -void sub_08088478(void) { +void FigurineDevice_NoFigurinesLeftMessage(void) { u32 messageIndex; - bool32 set0x10 = FALSE; + bool32 isUnlucky = FALSE; if (!CheckRoomFlag(8)) { if (!CheckRoomFlag(7)) { - messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x22); - set0x10 = TRUE; + messageIndex = TEXT_INDEX(TEXT_CARLOV, 34); // Oh! Looks like you've already got that... + isUnlucky = TRUE; } else { - messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x25); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 37); // Congratulations! I'll keep the figurine... } } else { - switch (gSave.stats.filler[0]) { - case 0x88: - gSave.stats.filler[1] = 0xff; - messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x29); + switch (gSave.stats.figurineCount) { + case 136: + gSave.stats._hasAllFigurines = 0xff; + messageIndex = TEXT_INDEX(TEXT_CARLOV, 41); // No way! Congratulations! You've collected every... break; - case 0x82: + case 130: if (gSave.saw_staffroll) { - messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x27); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 39); // ...just gotten the last ... I'll make some more... } else { - messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x28); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 40); // ...You've now collected all of the figurines... } break; default: - messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x27); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 39); // ...you've just gotten the last figurine... } } MessageFromTarget(messageIndex); gMessage.textWindowPosX = 1; - gMessage.textWindowPosY = 0xc; - if (set0x10) { + gMessage.textWindowPosY = 12; + if (isUnlucky) { gMessage.rupees = 5; } #ifndef EU @@ -719,65 +723,65 @@ void sub_08088478(void) { #endif } -void sub_08088504(void) { - u32 index; - switch (gSave.stats.filler[0]) { - case 0x88: - index = TEXT_INDEX(TEXT_CARLOV, 0x2f); +void FigurineDevice_NothingNewToDrawMessage(void) { + u32 messageIndex; + switch (gSave.stats.figurineCount) { + case 136: + messageIndex = TEXT_INDEX(TEXT_CARLOV, 47); // How do you like that Carlov Medal... break; - case 0x82: - index = TEXT_INDEX(TEXT_CARLOV, 0x14); + case 130: + messageIndex = TEXT_INDEX(TEXT_CARLOV, 20); // ...won all the figurines I made so far. ... draw anyway? break; default: - index = TEXT_INDEX(TEXT_CARLOV, 0x11); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 17); // ...don't have any new figurines yet ... draw anyway? break; } - MessageFromTarget(index); + MessageFromTarget(messageIndex); gMessage.textWindowPosX = 1; - gMessage.textWindowPosY = 0xc; + gMessage.textWindowPosY = 12; } -void sub_08088544(void) { - u32 index; - if (gSave.stats.filler[0] != 0x82) { - index = TEXT_INDEX(TEXT_CARLOV, 0xe); +void FigurineDevice_NewFigurinesMessage(void) { + u32 messageIndex; + if (gSave.stats.figurineCount != 130) { + messageIndex = TEXT_INDEX(TEXT_CARLOV, 14); // ...I made a new figurine... } else { - index = TEXT_INDEX(TEXT_CARLOV, 0x15); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 21); // ...I've got something new ... final series... } - MessageFromTarget(index); + MessageFromTarget(messageIndex); gMessage.textWindowPosX = 1; - gMessage.textWindowPosY = 0xc; + gMessage.textWindowPosY = 12; } -void sub_08088574(void) { - u32 index; +void FigurineDevice_TryAgainMessage(void) { + u32 messageIndex; #ifdef EU - if (CheckRoomFlag(0xa)) { + if (CheckRoomFlag(10)) { #else if (CheckRoomFlag(9)) { #endif if (CheckLocalFlag(SHOP07_COMPLETE)) { - index = TEXT_INDEX(TEXT_CARLOV, 0x13); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 19); // ...already have all ... still want to have a try? } else { - index = TEXT_INDEX(TEXT_CARLOV, 0x0c); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 12); // Want to try another drawing? } } else { - index = TEXT_INDEX(TEXT_CARLOV, 0x0b); + messageIndex = TEXT_INDEX(TEXT_CARLOV, 11); // ...Do you want to try for another one? } - MessageFromTarget(index); + MessageFromTarget(messageIndex); gMessage.textWindowPosX = 1; - gMessage.textWindowPosY = 0xc; + gMessage.textWindowPosY = 12; } -void sub_080885B0(void) { +void FigurineDevice_LostOrFinishedMessage(void) { if (!CheckRoomFlag(8)) { if (!CheckRoomFlag(7)) { ModRupees(5); - MessageFromTarget(TEXT_INDEX(TEXT_CARLOV, 0x26)); + MessageFromTarget(TEXT_INDEX(TEXT_CARLOV, 38)); // I hope you keep collecting ... come back again! gMessage.textWindowPosX = 1; - gMessage.textWindowPosY = 0xc; + gMessage.textWindowPosY = 12; } - } else if (gSave.stats.filler[1] != 0) { + } else if (gSave.stats._hasAllFigurines != 0) { // GOT ALL THEM FIGURINES (: gSave.stats.hasAllFigurines = 1; CreateItemEntity(ITEM_QST_CARLOV_MEDAL, 0, 0); @@ -789,7 +793,8 @@ void sub_080885B0(void) { #ifndef EU void sub_0808861C(FigurineDeviceEntity* this, ScriptExecutionContext* context) { - context->condition = CheckPlayerInRegion(0xa8, 0x54, 0xc, 8); + // If I understand this correctly then it checks if the player is at the lever + context->condition = CheckPlayerInRegion(168, 84, 12, 8); #ifdef JP if ((gPlayerEntity.animationState != 0)) { #else @@ -802,7 +807,7 @@ void sub_0808861C(FigurineDeviceEntity* this, ScriptExecutionContext* context) { #if !defined(JP) void sub_08088658(FigurineDeviceEntity* this, ScriptExecutionContext* context) { - context->condition = CheckPlayerInRegion(0x78, 0x78, 0x10, 8); + context->condition = CheckPlayerInRegion(120, 120, 16, 8); // And this is if the player is at the door if (gPlayerEntity.z.HALF.HI != 0) { context->condition = 0; } diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 984582d5..ffb63ed0 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -4,6 +4,7 @@ * * @brief File Screen Objects object */ +#define NENT_DEPRECATED #include "fileselect.h" #include "functions.h" #include "main.h" @@ -11,30 +12,39 @@ #include "object.h" #include "player.h" -extern u32 sub_080041EC(int, int); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u16 unk_6a; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u8 unused1[2]; + /*0x70*/ u8 unk_70; +} FileScreenObjectsEntity; + +extern u32 sub_080041EC(s32, s32); static bool32 sub_0808E950(void); -static void sub_0808EABC(Entity*); -static Entity* sub_0808EC80(int); -static u32 sub_0808EF6C(Entity*); -static void sub_0808EFF0(Entity*); -static void sub_0808EA28(Entity*); -static void sub_0808E7D8(Entity*); -static void sub_0808E988(Entity*); -static void sub_0808E9F4(Entity*); -static void sub_0808EBB8(Entity*); -static void sub_0808ECBC(Entity*); -static void sub_0808ED64(Entity*); -static void sub_0808E9F4(Entity*); -static void sub_0808ED98(Entity*); -static void sub_0808EE00(Entity*); -static void nullsub_522(Entity*); -static void sub_0808EB74(Entity*); -static void sub_0808EE98(Entity*); -static void sub_0808EED8(Entity*); -static void sub_0808EF24(Entity*); -static void sub_0808E818(Entity*); -static void sub_0808E7F0(Entity*); +static void sub_0808EABC(FileScreenObjectsEntity*); +static Entity* sub_0808EC80(s32); +static u32 sub_0808EF6C(FileScreenObjectsEntity*); +static void sub_0808EFF0(FileScreenObjectsEntity*); +static void FileScreenObjects_Type0(FileScreenObjectsEntity*); +static void FileScreenObjects_Type23(FileScreenObjectsEntity*); +static void FileScreenObjects_Type24(FileScreenObjectsEntity*); +static void FileScreenObjects_Type25(FileScreenObjectsEntity*); +static void FileScreenObjects_Type16(FileScreenObjectsEntity*); +static void FileScreenObjects_Type4(FileScreenObjectsEntity*); +static void FileScreenObjects_Type8(FileScreenObjectsEntity*); +static void FileScreenObjects_Type25(FileScreenObjectsEntity*); +static void FileScreenObjects_Type9(FileScreenObjectsEntity*); +static void FileScreenObjects_Type10(FileScreenObjectsEntity*); +static void FileScreenObjects_Type17(FileScreenObjectsEntity*); +static void FileScreenObjects_Type15(FileScreenObjectsEntity*); +static void FileScreenObjects_Type18(FileScreenObjectsEntity*); +static void FileScreenObjects_Type19(FileScreenObjectsEntity*); +static void FileScreenObjects_Type21(FileScreenObjectsEntity*); +static void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity*); +static void FileScreenObjects_Type23_Init(FileScreenObjectsEntity*); typedef struct { u8 unk0; @@ -52,58 +62,61 @@ typedef struct { u8 unk7; } struct_08121D54; -extern const int gUnk_08133368[]; +extern const s32 gUnk_08133368[]; -void FileScreenObjects(Entity* this) { - static void (*const gUnk_08121C64[])(Entity*) = { - sub_0808EA28, sub_0808EA28, sub_0808EA28, sub_0808EA28, sub_0808ECBC, sub_0808ECBC, sub_0808ECBC, - sub_0808ECBC, sub_0808ED64, sub_0808ED98, sub_0808EE00, sub_0808EE00, sub_0808EE00, sub_0808EE00, - sub_0808EE00, sub_0808EB74, sub_0808EBB8, nullsub_522, sub_0808EE98, sub_0808EED8, sub_0808EED8, - sub_0808EF24, sub_0808EF24, sub_0808E7D8, sub_0808E988, sub_0808E9F4, +void FileScreenObjects(FileScreenObjectsEntity* this) { + static void (*const FileScreenObjects_Types[])(FileScreenObjectsEntity*) = { + FileScreenObjects_Type0, FileScreenObjects_Type0, FileScreenObjects_Type0, FileScreenObjects_Type0, + FileScreenObjects_Type4, FileScreenObjects_Type4, FileScreenObjects_Type4, FileScreenObjects_Type4, + FileScreenObjects_Type8, FileScreenObjects_Type9, FileScreenObjects_Type10, FileScreenObjects_Type10, + FileScreenObjects_Type10, FileScreenObjects_Type10, FileScreenObjects_Type10, FileScreenObjects_Type15, + FileScreenObjects_Type16, FileScreenObjects_Type17, FileScreenObjects_Type18, FileScreenObjects_Type19, + FileScreenObjects_Type19, FileScreenObjects_Type21, FileScreenObjects_Type21, FileScreenObjects_Type23, + FileScreenObjects_Type24, FileScreenObjects_Type25, }; - if (this->health == 0) { + if (super->health == 0) { sub_0808EFF0(this); } - gUnk_08121C64[this->type](this); - if (this->animIndex < 64) { - UpdateAnimationSingleFrame(this); + FileScreenObjects_Types[super->type](this); + if (super->animIndex < 64) { + UpdateAnimationSingleFrame(super); } } -void sub_0808E7D8(Entity* this) { - static void (*const gUnk_08121CCC[])(Entity*) = { - sub_0808E7F0, - sub_0808E818, +void FileScreenObjects_Type23(FileScreenObjectsEntity* this) { + static void (*const FileScreenObjects_Type23_Actions[])(FileScreenObjectsEntity*) = { + FileScreenObjects_Type23_Init, + FileScreenObjects_Type23_LinkPreview, }; - gUnk_08121CCC[this->action](this); + FileScreenObjects_Type23_Actions[super->action](this); } -void sub_0808E7F0(Entity* this) { - LoadSwapGFX(this, 1, 2); - this->palette.b.b0 = 0xF; - this->spriteSettings.draw = 0; - this->type2 = 0xFF; - this->action = 1; +void FileScreenObjects_Type23_Init(FileScreenObjectsEntity* this) { + LoadSwapGFX(super, 1, 2); + super->palette.b.b0 = 0xF; + super->spriteSettings.draw = 0; + super->type2 = 0xFF; + super->action = 1; } -void sub_0808E818(Entity* this) { +void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity* this) { u32 var0; u32 offset; if (!sub_0808E950()) { - int var2 = -1; - this->type2 = var2; - this->field_0x68.HWORD = var2; - this->field_0x6a.HWORD = var2; - this->spriteSettings.draw = 0; + s32 var2 = -1; + super->type2 = var2; + this->unk_68 = var2; + this->unk_6a = var2; + super->spriteSettings.draw = 0; return; } - if (this->type2 != gMapDataBottomSpecial.unk6) { - this->type2 = gMapDataBottomSpecial.unk6; - this->field_0x68.HWORD = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100; - this->field_0x70.BYTES.byte0 = 4; - this->animationState = 2; + if (super->type2 != gMapDataBottomSpecial.unk6) { + super->type2 = gMapDataBottomSpecial.unk6; + this->unk_68 = CheckGlobalFlag(EZERO_1ST) == 0 ? ANIM_DEFAULT_NOCAP : ANIM_DEFAULT; + this->unk_70 = 4; + super->animationState = PAS_SOUTH; offset = gUnk_08133368[GetPlayerPalette(TRUE) - 22] & 0xFFFFFF; LoadPalettes(&gGlobalGfxAndPalettes[offset], 31, 1); } @@ -112,33 +125,33 @@ void sub_0808E818(Entity* this) { if (gInput.heldKeys & L_BUTTON) { switch (gInput.newKeys) { case DPAD_UP: - this->animationState = 0; + super->animationState = PAS_NORTH; break; case DPAD_RIGHT: - this->animationState = 1; + super->animationState = PAS_EAST; break; case DPAD_DOWN: - this->animationState = 2; + super->animationState = PAS_SOUTH; break; case DPAD_LEFT: - this->animationState = 3; + super->animationState = PAS_WEST; break; case B_BUTTON: - this->field_0x70.BYTES.byte0 = this->field_0x70.BYTES.byte0 ? 0 : 4; + this->unk_70 = this->unk_70 ? 0 : 4; break; } } } - this->spriteSettings.flipX = this->animationState == 3; - var0 = this->field_0x68.HWORD + this->field_0x70.BYTES.byte0 + this->animationState; - if (this->field_0x6a.HWORD != var0) { - this->field_0x6a.HWORD = var0; - this->spriteIndex = var0 >> 8; - InitAnimationForceUpdate(this, (u8)var0); + super->spriteSettings.flipX = super->animationState == 3; + var0 = this->unk_68 + this->unk_70 + super->animationState; + if (this->unk_6a != var0) { + this->unk_6a = var0; + super->spriteIndex = var0 >> 8; + InitAnimationForceUpdate(super, (u8)var0); } - this->spriteSettings.draw = 2; + super->spriteSettings.draw = 2; } static bool32 sub_0808E950(void) { @@ -155,20 +168,20 @@ static bool32 sub_0808E950(void) { return result; } -void sub_0808E988(Entity* this) { - if (this->action == 0) { - this->action = 1; +void FileScreenObjects_Type24(FileScreenObjectsEntity* this) { + if (super->action == 0) { + super->action = 1; #ifdef EU - this->spriteIndex = 0x141; + super->spriteIndex = 0x141; #else - this->spriteIndex = 0x142; + super->spriteIndex = 0x142; #endif - this->type2 = 0xFF; - LoadSwapGFX(this, 1, 3); + super->type2 = 0xFF; + LoadSwapGFX(super, 1, 3); } if (sub_0808E950()) { - int i; + s32 i; for (i = 6; i != 0; i--) { if (GetInventoryValue(i)) { break; @@ -176,42 +189,42 @@ void sub_0808E988(Entity* this) { } if (i != 0) { - if (this->type2 != i) { - InitAnimationForceUpdate(this, i); + if (super->type2 != i) { + InitAnimationForceUpdate(super, i); } - this->spriteSettings.draw = 2; + super->spriteSettings.draw = 2; return; } } - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } -void sub_0808E9F4(Entity* this) { +void FileScreenObjects_Type25(FileScreenObjectsEntity* this) { if (sub_0808E950() && gSave.saw_staffroll) { - this->spriteSettings.draw = 2; + super->spriteSettings.draw = 2; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } } -void sub_0808EA28(Entity* this) { +void FileScreenObjects_Type0(FileScreenObjectsEntity* this) { u32 var0; u32 var1; - if (this->type == 3) { + if (super->type == 3) { if (gSaveHeader->language > LANGUAGE_EN) { - this->spriteSettings.draw = 2; + super->spriteSettings.draw = 2; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } } - if (this->type == gMapDataBottomSpecial.unk6) { + if (super->type == gMapDataBottomSpecial.unk6) { var0 = 12; var1 = 1; } else { - if (gUI.lastState == 5 && this->type == gMapDataBottomSpecial.unk7) { + if (gUI.lastState == 5 && super->type == gMapDataBottomSpecial.unk7) { var0 = 13; var1 = 2; } else { @@ -220,16 +233,16 @@ void sub_0808EA28(Entity* this) { } } - this->palette.b.b0 = var0; - this->spriteRendering.b3 = var1; + super->palette.b.b0 = var0; + super->spriteRendering.b3 = var1; sub_0808EABC(this); gMapDataBottomSpecial.isTransitioning |= sub_0808EF6C(this); } -void sub_0808EABC(Entity* this) { - int var0 = -72; - int var1 = this->type * 32 + 40; - int var2 = gMapDataBottomSpecial.unk6 == this->type; +void sub_0808EABC(FileScreenObjectsEntity* this) { + s32 var0 = -72; + s32 var1 = super->type * 32 + 40; + s32 var2 = gMapDataBottomSpecial.unk6 == super->type; switch (gUI.lastState) { case 0: var0 = 24; @@ -244,7 +257,7 @@ void sub_0808EABC(Entity* this) { } break; case 5: - switch (gGenericMenu.unk10.a[this->type]) { + switch (gGenericMenu.unk10.a[super->type]) { case 0: var0 = 42; var1 = 40; @@ -253,7 +266,7 @@ void sub_0808EABC(Entity* this) { case 2: var0 = 20; var1 = 144; - var1 -= (gGenericMenu.unk16 - gGenericMenu.unk10.a[this->type]) * 32; + var1 -= (gGenericMenu.unk16 - gGenericMenu.unk10.a[super->type]) * 32; break; } break; @@ -271,24 +284,24 @@ void sub_0808EABC(Entity* this) { break; } - this->field_0x68.HWORD = var0; - this->field_0x6a.HWORD = var1; + this->unk_68 = var0; + this->unk_6a = var1; } -void sub_0808EB74(Entity* this) { +void FileScreenObjects_Type15(FileScreenObjectsEntity* this) { Entity* entity = sub_0808EC80(gMapDataBottomSpecial.unk6); if (entity != NULL) { - this->x.WORD = entity->x.WORD; - this->y.WORD = entity->y.WORD; - this->spriteRendering.b3 = entity->spriteRendering.b3; - SortEntityBelow(entity, this); + super->x.WORD = entity->x.WORD; + super->y.WORD = entity->y.WORD; + super->spriteRendering.b3 = entity->spriteRendering.b3; + SortEntityBelow(entity, super); } else { - this->x.HALF.HI = 0xF000; - this->y.HALF.HI = 0xF000; + super->x.HALF.HI = 0xF000; + super->y.HALF.HI = 0xF000; } } -void sub_0808EBB8(Entity* this) { +void FileScreenObjects_Type16(FileScreenObjectsEntity* this) { u32 var0; u32 x, y; Entity* entity; @@ -331,19 +344,19 @@ void sub_0808EBB8(Entity* this) { default: entity = sub_0808EC80(var0); if (entity != NULL) { - SortEntityBelow(entity, this); - this->spriteRendering.b3 = entity->spriteRendering.b3; + SortEntityBelow(entity, super); + super->spriteRendering.b3 = entity->spriteRendering.b3; x = entity->x.HALF.HI; y = entity->y.HALF.HI; } break; } - this->x.HALF.HI = x; - this->y.HALF.HI = y; + super->x.HALF.HI = x; + super->y.HALF.HI = y; } -static Entity* sub_0808EC80(int form) { +static Entity* sub_0808EC80(s32 form) { Entity* entityA = (Entity*)&gEntityLists[6]; Entity* entityB = entityA->next; while (entityB != entityA) { @@ -355,7 +368,7 @@ static Entity* sub_0808EC80(int form) { return NULL; } -void sub_0808ECBC(Entity* this) { +void FileScreenObjects_Type4(FileScreenObjectsEntity* this) { static const struct_08121CD4 gUnk_08121CD4[][4] = { { { 0x9, 0x18, 0xb0 }, { 0x9, 0x60, 0xb0 }, { 0x9, 0xa8, 0xb0 }, { 0x9, 0x40, 0xb0 } }, { { 0x0, 0x18, 0x90 }, { 0x1, 0x60, 0x90 }, { 0x2, 0xa8, 0x90 }, { 0x9, 0x40, 0xb0 } }, @@ -363,9 +376,9 @@ void sub_0808ECBC(Entity* this) { { { 0x9, 0x18, 0xb0 }, { 0x9, 0x60, 0xb0 }, { 0x1, 0x88, 0x90 }, { 0x0, 0x40, 0x90 } }, { { 0x0, 0x18, 0x90 }, { 0x9, 0x60, 0xb0 }, { 0x9, 0xa8, 0xb0 }, { 0x9, 0x40, 0xb0 } } }; - int var0; - int var1; - int var2; + s32 var0; + s32 var1; + s32 var2; const struct_08121CD4* var3; var0 = gMenu.column_idx; @@ -388,66 +401,66 @@ void sub_0808ECBC(Entity* this) { break; } - var2 = this->type - 4; + var2 = super->type - 4; var3 = &gUnk_08121CD4[var1][var2]; - this->field_0x68.HWORD = var3->unk1; - this->field_0x6a.HWORD = var3->unk2; + this->unk_68 = var3->unk1; + this->unk_6a = var3->unk2; if (var3->unk0 == var0) { - this->palette.b.b0 = 13; + super->palette.b.b0 = 13; } else { - this->palette.b.b0 = 14; + super->palette.b.b0 = 14; } gMapDataBottomSpecial.isTransitioning |= sub_0808EF6C(this); } -void sub_0808ED64(Entity* this) { - int y = 255; +void FileScreenObjects_Type8(FileScreenObjectsEntity* this) { + s32 y = 255; if (gUI.lastState == 1 && gGenericMenu.unk10.a[1] != 5) { - this->x.HALF.HI = gGenericMenu.unk10.a[0] * 16 + 28; + super->x.HALF.HI = gGenericMenu.unk10.a[0] * 16 + 28; y = gGenericMenu.unk10.a[1] * 16 + 58; } - this->y.HALF.HI = y; + super->y.HALF.HI = y; } -void sub_0808ED98(Entity* this) { +void FileScreenObjects_Type9(FileScreenObjectsEntity* this) { static const s8 gUnk_08121D10[] = { 0, -1, -3, -2, -2, -1, 0, 0, }; - int y; + s32 y; if (gUI.lastState != 1) { - this->field_0x68.HWORD = 27; + this->unk_68 = 27; y = -10; } else { u32 var0 = gGenericMenu.unk10.a[3]; if (var0 > 5) { var0 = 5; } - this->field_0x68.HWORD = var0 * 8 + 27; + this->unk_68 = var0 * 8 + 27; y = 24; } - this->y.HALF.HI = y; - this->field_0x6a.HWORD = y; - this->subtimer++; - this->spriteOffsetY = gUnk_08121D10[(this->subtimer / 4) & 0x7]; + super->y.HALF.HI = y; + this->unk_6a = y; + super->subtimer++; + super->spriteOffsetY = gUnk_08121D10[(super->subtimer / 4) & 0x7]; sub_0808EF6C(this); } -void sub_0808EE00(Entity* this) { +void FileScreenObjects_Type10(FileScreenObjectsEntity* this) { static const u16 gUnk_08121D18[][8] = { { 0x2c, 0x54, 0x7c, 0xa4, 0xcc, 0x0, 0x0, 0x0 }, { 0xfff, 0x2e, 0x62, 0x96, 0xca, 0x0, 0x0, 0x0 } }; static const u8 gUnk_08121D38[][8] = { { 12, 13, 14, 16, 17, 0, 0, 0 }, { -1, 14, 15, 16, 17, 0, 0, 0 }, }; - int var0, var1, var2; + s32 var0, var1, var2; var0 = ((SaveHeader*)0x2000000)->language != 0; - var1 = this->type - 10; - this->frameIndex = gUnk_08121D38[var0][var1]; - this->x.HALF.HI = gUnk_08121D18[var0][var1]; - this->field_0x68.HWORD = gUnk_08121D18[var0][var1]; + var1 = super->type - 10; + super->frameIndex = gUnk_08121D38[var0][var1]; + super->x.HALF.HI = gUnk_08121D18[var0][var1]; + this->unk_68 = gUnk_08121D18[var0][var1]; var1 -= var0; if (gUI.lastState != 1) { var1 = 128; @@ -456,81 +469,81 @@ void sub_0808EE00(Entity* this) { var2 = 140; } - this->field_0x6a.HWORD = var2; - this->palette.b.b0 = gGenericMenu.unk10.a[1] == 5 && var1 == gGenericMenu.unk10.a[2] ? 11 : 9; + this->unk_6a = var2; + super->palette.b.b0 = gGenericMenu.unk10.a[1] == 5 && var1 == gGenericMenu.unk10.a[2] ? 11 : 9; gMapDataBottomSpecial.isTransitioning |= sub_0808EF6C(this); } -void nullsub_522(Entity* this) { +void FileScreenObjects_Type17(FileScreenObjectsEntity* this) { } -void sub_0808EE98(Entity* this) { +void FileScreenObjects_Type18(FileScreenObjectsEntity* this) { static const u8 gUnk_08121D48[] = { 0x28, 0x27, 0x28, 0x28, 0x28, 0x2a, 0x29, 0x28, 0xff, 0x0, 0x0, 0x0 }; - this->timer = gUI.lastState; - this->frameIndex = gUnk_08121D48[this->timer]; - if (this->timer != 2) { - this->field_0x68.HWORD = 96; + super->timer = gUI.lastState; + super->frameIndex = gUnk_08121D48[super->timer]; + if (super->timer != 2) { + this->unk_68 = 96; } else { - this->field_0x68.HWORD = -96; + this->unk_68 = -96; } sub_0808EF6C(this); } -void sub_0808EED8(Entity* this) { - int var0; +void FileScreenObjects_Type19(FileScreenObjectsEntity* this) { + s32 var0; if (gUI.lastState != 3) { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } else { - this->spriteSettings.draw = 2; - var0 = this->type - 19; - this->palette.b.b0 = gMenu.column_idx == var0 ? 4 : 3; + super->spriteSettings.draw = 2; + var0 = super->type - 19; + super->palette.b.b0 = gMenu.column_idx == var0 ? 4 : 3; } } -void sub_0808EF24(Entity* this) { - int var0; +void FileScreenObjects_Type21(FileScreenObjectsEntity* this) { + s32 var0; if (gUI.lastState != 3) { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } else { - this->spriteSettings.draw = 2; - if (this->type == 21) { + super->spriteSettings.draw = 2; + if (super->type == 21) { var0 = ((SaveHeader*)0x2000000)->msg_speed; } else { var0 = ((SaveHeader*)0x2000000)->brightness; } - this->frameIndex = this->lastFrameIndex + var0; + super->frameIndex = super->lastFrameIndex + var0; } } -static u32 sub_0808EF6C(Entity* this) { - int var0; +static u32 sub_0808EF6C(FileScreenObjectsEntity* this) { + s32 var0; u32 var1; - int var2; + s32 var2; u32 var3; - int var4; + s32 var4; s16 var5; s16 var6; - int var7; + s32 var7; - var6 = this->field_0x68.HWORD; - var0 = var6 - this->x.HALF.HI; + var6 = this->unk_68; + var0 = var6 - super->x.HALF.HI; var1 = var0; if (var0 < 0) { var1 = -var0; } if (var1 < 2) { - this->x.WORD = var6 << 16; + super->x.WORD = var6 << 16; var0 = 0; } - var5 = this->field_0x6a.HWORD; - var2 = var5 - this->y.HALF.HI; + var5 = this->unk_6a; + var2 = var5 - super->y.HALF.HI; var3 = var2; if (var2 < 0) { var3 = -var2; } if (var3 < 2) { - this->y.WORD = var5 << 16; + super->y.WORD = var5 << 16; var2 = 0; } @@ -541,16 +554,16 @@ static u32 sub_0808EF6C(Entity* this) { var4 = var7 = sub_080041EC(var0, var2); var4 += 128; var7 = var4 + var7 * 16; - if (this->field_0x6c.HWORD < var7) { - var7 = this->field_0x6c.HWORD; + if (this->unk_6c < var7) { + var7 = this->unk_6c; } - this->speed = var7; - this->direction = CalculateDirectionFromOffsets(var0, var2) >> 3; - LinearMoveUpdate(this); + super->speed = var7; + super->direction = CalculateDirectionFromOffsets(var0, var2) >> 3; + LinearMoveUpdate(super); return 1; } -static void sub_0808EFF0(Entity* this) { +static void sub_0808EFF0(FileScreenObjectsEntity* this) { static const struct_08121D54 gUnk_08121D54[] = { { 0x800, -0x40, 0x28, 2, 4, 1, 0x80 }, { 0x800, -0x40, 0x48, 2, 4, 1, 0x81 }, { 0x800, -0x40, 0x68, 2, 4, 1, 0x82 }, { 0x800, -0x40, 0x88, 2, 4, 1, 0x83 }, @@ -569,26 +582,26 @@ static void sub_0808EFF0(Entity* this) { const struct_08121D54* var0; u8 var1; - this->spriteSettings.draw = 2; - this->speed = 0x400; - this->health = 1; - this->frameIndex = 0xFF; - this->animIndex = 0xFF; - var0 = &gUnk_08121D54[this->type]; - this->x.HALF.HI = var0->unk2; - this->field_0x68.HWORD = var0->unk2; - this->y.HALF.HI = var0->unk4; - this->field_0x6a.HWORD = var0->unk4; - this->spriteRendering.b3 = var0->unk6_0; - this->spritePriority.b0 = var0->unk6_3; - this->spriteOrientation.flipY = var0->unk6_6; - this->field_0x6c.HWORD = var0->unk0; + super->spriteSettings.draw = 2; + super->speed = 0x400; + super->health = 1; + super->frameIndex = 0xFF; + super->animIndex = 0xFF; + var0 = &gUnk_08121D54[super->type]; + super->x.HALF.HI = var0->unk2; + this->unk_68 = var0->unk2; + super->y.HALF.HI = var0->unk4; + this->unk_6a = var0->unk4; + super->spriteRendering.b3 = var0->unk6_0; + super->spritePriority.b0 = var0->unk6_3; + super->spriteOrientation.flipY = var0->unk6_6; + this->unk_6c = var0->unk0; var1 = var0->unk7; if (var1 & 0x80) { var1 &= ~(0x80); - this->frameIndex = var1; - this->lastFrameIndex = var1; + super->frameIndex = var1; + super->lastFrameIndex = var1; } else { - InitAnimationForceUpdate(this, var1); + InitAnimationForceUpdate(super, var1); } } diff --git a/src/object/fireballChain.c b/src/object/fireballChain.c index 4e5577a5..3e9905a7 100644 --- a/src/object/fireballChain.c +++ b/src/object/fireballChain.c @@ -11,7 +11,7 @@ #include "projectile.h" #include "projectile/winder.h" -void FireballChain(Entity* thisx) { +void FireballChain(Entity* this) { WinderEntity* newSegment; Entity* parent; Entity* child; @@ -33,11 +33,11 @@ void FireballChain(Entity* thisx) { newSegment->base.type = i; newSegment->base.parent = parent; newSegment->base.child = child; - CopyPosition(thisx, &newSegment->base); + CopyPosition(this, &newSegment->base); for (j = 0, tmp = newSegment->positions; j < WINDER_NUM_SEGMENTS; j++) { - *tmp++ = thisx->x.HALF.HI; - *tmp++ = thisx->y.HALF.HI; + *tmp++ = this->x.HALF.HI; + *tmp++ = this->y.HALF.HI; } child = &newSegment->base; diff --git a/src/object/fireplace.c b/src/object/fireplace.c index 32000490..719ab4c9 100644 --- a/src/object/fireplace.c +++ b/src/object/fireplace.c @@ -4,54 +4,61 @@ * * @brief Fireplace object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "tiles.h" -void Fireplace_Action1(Entity* this); -void sub_0809B7DC(Entity* this); -void sub_0809B7C0(Entity* this); -void Fireplace_Init(Entity* this); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[30]; + /*0x86*/ u16 unk_86; +} FireplaceEntity; -void Fireplace(Entity* e) { - static void (*const Fireplace_Actions[])(Entity*) = { +void Fireplace_Action1(FireplaceEntity* this); +void sub_0809B7DC(FireplaceEntity* this); +void sub_0809B7C0(FireplaceEntity* this); +void Fireplace_Init(FireplaceEntity* this); + +void Fireplace(FireplaceEntity* this) { + static void (*const Fireplace_Actions[])(FireplaceEntity*) = { Fireplace_Init, Fireplace_Action1, }; - Fireplace_Actions[e->action](e); + Fireplace_Actions[super->action](this); } -void Fireplace_Init(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->speed = 0x80; - if (CheckFlags(this->field_0x86.HWORD)) { +void Fireplace_Init(FireplaceEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + super->speed = 0x80; + if (CheckFlags(this->unk_86)) { sub_0809B7DC(this); DeleteThisEntity(); } else { - sub_0807B7D8(0x30b, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); - SetMetaTile(SPECIAL_META_TILE_97, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + sub_0807B7D8(0x30b, TILE(super->x.HALF.HI, super->y.HALF.HI), 2); + SetMetaTile(SPECIAL_META_TILE_97, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); } Fireplace_Action1(this); } -void Fireplace_Action1(Entity* this) { +void Fireplace_Action1(FireplaceEntity* this) { sub_0809B7C0(this); - if (this->timer) { - SetFlag(this->field_0x86.HWORD); + if (super->timer) { + SetFlag(this->unk_86); DeleteThisEntity(); } } -void sub_0809B7C0(Entity* this) { - u32 tileType = GetMetaTileTypeByEntity(this); +void sub_0809B7C0(FireplaceEntity* this) { + u32 tileType = GetMetaTileTypeByEntity(super); if (tileType != SPECIAL_META_TILE_97 && tileType != SPECIAL_META_TILE_98) { sub_0809B7DC(this); } } -void sub_0809B7DC(Entity* this) { - sub_0807B7D8(0xc3 << 2, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); - SetMetaTile(SPECIAL_META_TILE_98, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); - this->timer = 1; +void sub_0809B7DC(FireplaceEntity* this) { + sub_0807B7D8(0xc3 << 2, TILE(super->x.HALF.HI, super->y.HALF.HI), 2); + SetMetaTile(SPECIAL_META_TILE_98, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); + super->timer = 1; } diff --git a/src/object/flame.c b/src/object/flame.c index 7f2508b5..b31ae8a2 100644 --- a/src/object/flame.c +++ b/src/object/flame.c @@ -4,101 +4,107 @@ * * @brief Flame object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "sound.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[30]; + /*0x86*/ u16 unk_86; +} FlameEntity; + extern void sub_0807AB44(Entity*, s32, s32); -void (*const Flame_Actions[])(Entity*); +void (*const Flame_Actions[])(FlameEntity*); -void Flame(Entity* this) { - Flame_Actions[this->action](this); +void Flame(FlameEntity* this) { + Flame_Actions[super->action](this); } -void Flame_Init(Entity* this) { - this->action = 1; - this->spriteSettings.draw = TRUE; - if (this->type2 != 0) { - this->timer = this->type2; +void Flame_Init(FlameEntity* this) { + super->action = 1; + super->spriteSettings.draw = TRUE; + if (super->type2 != 0) { + super->timer = super->type2; } - InitializeAnimation(this, 0); - switch (this->type) { + InitializeAnimation(super, 0); + switch (super->type) { case 1: - this->y.HALF.HI -= 8; - this->timer = 40; + super->y.HALF.HI -= 8; + super->timer = 40; break; case 2: - this->timer = 15; - sub_08004168(this); + super->timer = 15; + sub_08004168(super); break; case 3: - CopyPosition(this->parent, this); + CopyPosition(super->parent, super); break; case 4: - if (!CheckFlags(this->field_0x86.HWORD)) { - this->spriteSettings.draw = FALSE; - this->subAction = 1; + if (!CheckFlags(this->unk_86)) { + super->spriteSettings.draw = FALSE; + super->subAction = 1; return; } } EnqueueSFX(SFX_124); } -void Flame_Action1(Entity* this) { +void Flame_Action1(FlameEntity* this) { u32 val; - GetNextFrame(this); + GetNextFrame(super); - switch (this->type) { + switch (super->type) { case 0: default: - if (this->type2 == 0) + if (super->type2 == 0) return; case 1: case 2: - if (this->timer-- != 0) + if (super->timer-- != 0) return; - if (this->type == 2) { - sub_0807B7D8(((u16*)this->child)[3], COORD_TO_TILE(this), this->collisionLayer); - sub_0807AB44(this, 0, 0x10); - sub_0807AB44(this, 0, -0x10); - sub_0807AB44(this, 0x10, 0); - sub_0807AB44(this, -0x10, 0); + if (super->type == 2) { + sub_0807B7D8(((u16*)super->child)[3], COORD_TO_TILE(super), super->collisionLayer); + sub_0807AB44(super, 0, 0x10); + sub_0807AB44(super, 0, -0x10); + sub_0807AB44(super, 0x10, 0); + sub_0807AB44(super, -0x10, 0); } DeleteThisEntity(); break; case 3: - if (this->parent->next == NULL) { + if (super->parent->next == NULL) { DeleteThisEntity(); } - if (--this->timer == 0) { + if (--super->timer == 0) { DeleteThisEntity(); } - CopyPosition(this->parent, this); + CopyPosition(super->parent, super); break; case 4: - val = CheckFlags(this->field_0x86.HWORD); - if (this->subAction == 0) { + val = CheckFlags(this->unk_86); + if (super->subAction == 0) { if (val) return; - this->subAction = 1; - this->spriteSettings.draw = 0; + super->subAction = 1; + super->spriteSettings.draw = 0; } else { if (!val) return; - this->subAction = 0; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 0); + super->subAction = 0; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 0); EnqueueSFX(SFX_124); } break; } } -void (*const Flame_Actions[])(Entity*) = { +void (*const Flame_Actions[])(FlameEntity*) = { Flame_Init, Flame_Action1, }; diff --git a/src/object/floatingBlock.c b/src/object/floatingBlock.c index 79b784b5..7457797f 100644 --- a/src/object/floatingBlock.c +++ b/src/object/floatingBlock.c @@ -4,6 +4,7 @@ * * @brief Floating Block object */ +#define NENT_DEPRECATED #include "object.h" void FloatingBlock(Entity* this) { diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c index 15919a40..76f00964 100644 --- a/src/object/floatingPlatform.c +++ b/src/object/floatingPlatform.c @@ -1,10 +1,10 @@ -#define NENT_DEPRECATED /** * @file floatingPlatform.c * @ingroup Objects * * @brief Floating Platform object */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "object.h" @@ -15,20 +15,20 @@ typedef struct { u16 unk70; } FloatingPlatformEntity; -void sub_080860D8(FloatingPlatformEntity*); -void sub_0808611C(FloatingPlatformEntity*); +void FloatingPlatform_Init(FloatingPlatformEntity*); +void FloatingPlatform_Action1(FloatingPlatformEntity*); bool32 sub_08086168(FloatingPlatformEntity*); void FloatingPlatform(Entity* this) { - static void (*const actionFuncs[])(FloatingPlatformEntity*) = { - sub_080860D8, - sub_0808611C, + static void (*const FloatingPlatform_Action[])(FloatingPlatformEntity*) = { + FloatingPlatform_Init, + FloatingPlatform_Action1, }; - actionFuncs[this->action]((FloatingPlatformEntity*)this); + FloatingPlatform_Action[this->action]((FloatingPlatformEntity*)this); } -void sub_080860D8(FloatingPlatformEntity* this) { +void FloatingPlatform_Init(FloatingPlatformEntity* this) { super->action = 1; super->speed = 0x100; super->spriteSettings.draw = 1; @@ -38,7 +38,7 @@ void sub_080860D8(FloatingPlatformEntity* this) { UpdateRailMovement(super, (u16**)&super->child, &this->unk70); } -void sub_0808611C(FloatingPlatformEntity* this) { +void FloatingPlatform_Action1(FloatingPlatformEntity* this) { bool32 iVar2 = sub_08086168(this); if (super->timer != 0 && super->parent->timer == 0) { diff --git a/src/object/fourElements.c b/src/object/fourElements.c index 62694322..8576cf97 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -4,11 +4,9 @@ * * @brief Four Elements object */ - #define NENT_DEPRECATED #include "collision.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "message.h" #include "object.h" diff --git a/src/object/frozenFlower.c b/src/object/frozenFlower.c index 0b93b1de..d046715c 100644 --- a/src/object/frozenFlower.c +++ b/src/object/frozenFlower.c @@ -4,6 +4,7 @@ * * @brief Frozen Flower object */ +#define NENT_DEPRECATED #include "object.h" void FrozenFlower_Init(Entity*); diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 9bde8f4a..7aaaac94 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -7,7 +7,6 @@ #define NENT_DEPRECATED #include "enemy/octorokBoss.h" #include "functions.h" -#include "global.h" #include "message.h" #include "object.h" diff --git a/src/object/furniture.c b/src/object/furniture.c index ecc36629..d3b3f652 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -193,12 +193,12 @@ static void sub_08090E4C(FurnitureEntity*); static void sub_08090CDC(u32, u32, u32); void Furniture(Entity* this) { - static FurnitureAction* const sFurnitureActions[] = { + static FurnitureAction* const Furniture_Actions[] = { FurnitureInit, FurnitureUpdate, }; - sFurnitureActions[this->action]((FurnitureEntity*)this); + Furniture_Actions[this->action]((FurnitureEntity*)this); } static void FurnitureInit(FurnitureEntity* this) { diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c index a685704b..92199533 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -4,23 +4,24 @@ * * @brief Giant Leaf object */ +#define NENT_DEPRECATED #include "map.h" #include "object.h" -void sub_0808D618(Entity* ent); +void sub_0808D618(Entity* this); -void GiantLeaf(Entity* ent) { - if (ent->action == 0) { - ent->action = 1; - ent->spriteSettings.draw = 1; - ent->spriteRendering.b3 = 3; - ent->spritePriority.b0 = 7; - ent->frameIndex = ent->type; - sub_0808D618(ent); +void GiantLeaf(Entity* this) { + if (this->action == 0) { + this->action = 1; + this->spriteSettings.draw = 1; + this->spriteRendering.b3 = 3; + this->spritePriority.b0 = 7; + this->frameIndex = this->type; + sub_0808D618(this); } } -void sub_0808D618(Entity* ent) { +void sub_0808D618(Entity* this) { static const s16 gUnk_08121750[] = { 0x41, 0x40, 0x3f, 0x3e, 0x1, 0x0, -0x1, -0x2, -0x3e, -0x3f, -0x40, -0x41, -0x7e, }; @@ -31,9 +32,9 @@ void sub_0808D618(Entity* ent) { const s16* arr; u32 i; - arr = (ent->type != 0) ? gUnk_0812176A : gUnk_08121750; - tilePos = (((ent->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | - ((((ent->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64); + arr = (this->type != 0) ? gUnk_0812176A : gUnk_08121750; + tilePos = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | + ((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64); for (i = 0; i < 13; i++) { SetMetaTile(16500, tilePos + arr[i], LAYER_BOTTOM); diff --git a/src/object/giantRock.c b/src/object/giantRock.c index c8a5747e..9c7cf68f 100644 --- a/src/object/giantRock.c +++ b/src/object/giantRock.c @@ -4,6 +4,7 @@ * * @brief Giant Rock object */ +#define NENT_DEPRECATED #include "entity.h" void GiantRock(Entity* this) { diff --git a/src/object/giantRock2.c b/src/object/giantRock2.c index 7e0073b2..8c0a21a7 100644 --- a/src/object/giantRock2.c +++ b/src/object/giantRock2.c @@ -16,15 +16,15 @@ typedef struct { u16 metaTilePos; } GiantRock2Entity; -void GiantRock2_Init(GiantRock2Entity*); -void GiantRock2_Idle(GiantRock2Entity*); +void GiantRock2_Init(GiantRock2Entity* this); +void GiantRock2_Idle(GiantRock2Entity* this); void GiantRock2(Entity* this) { - static void (*const actionFuncs[])(GiantRock2Entity*) = { + static void (*const GiantRock2_Action[])(GiantRock2Entity*) = { GiantRock2_Init, GiantRock2_Idle, }; - actionFuncs[this->action]((GiantRock2Entity*)this); + GiantRock2_Action[this->action]((GiantRock2Entity*)this); } void GiantRock2_Init(GiantRock2Entity* this) { diff --git a/src/object/giantTwig.c b/src/object/giantTwig.c index 1e130405..3acf592b 100644 --- a/src/object/giantTwig.c +++ b/src/object/giantTwig.c @@ -4,7 +4,6 @@ * * @brief Giant Twig object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/graveyardKey.c b/src/object/graveyardKey.c index e4c4f2ef..bef307ed 100644 --- a/src/object/graveyardKey.c +++ b/src/object/graveyardKey.c @@ -45,21 +45,26 @@ void GraveyardKey_Action2(Entity*, const struct_gUnk_08123FB0*); void GraveyardKey_Action3(Entity*, const struct_gUnk_08123FB0*); static const struct_gUnk_08123FB0 gUnk_08123FB0[] = { - { sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, - 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x63, 0x63, 0x10, 0, 0x1800, 0, 0x18, + { sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x13, + Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_HEART_PIECE, ITEM_HEART_PIECE, 0x10, 0, 0x1800, 0, 0x18, #if defined(JP) || defined(DEMO_JP) || defined(EU) 0xCD, #else 0xd0, #endif 0, 0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0xf, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0x2, Q_16_16(1.0), 0x1800, 0x140, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0xd, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x1a, Q_16_16(1.0), 0x1800, 0x100, 0x40, 0x4021, 0x1, 0x0 }, - { sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 }, - { NULL, NULL, 0, 0, 0, 0, 0x0, 0x5c, 0x5c, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0xf, Q_16_16(1.0), 0x1800, + 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x2, Q_16_16(1.0), 0x1800, + 0x140, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0xd, Q_16_16(1.0), 0x1800, + 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x1a, Q_16_16(1.0), 0x1800, + 0x100, 0x40, 0x4021, 0x1, 0x0 }, + { sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x13, Q_16_16(1.0), 0x1800, + 0x60, 0x40, 0x4021, 0x1, 0x0 }, + { NULL, NULL, 0, 0, 0, 0, 0, ITEM_KINSTONE, ITEM_KINSTONE, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 }, }; void GraveyardKey(Entity* this) { @@ -85,10 +90,10 @@ void GraveyardKey_Init(Entity* this, const struct_gUnk_08123FB0* param_2) { this->y.HALF.HI -= param_2->y; this->z.WORD = 0; this->timer = param_2->timer; - if ((this->direction & 0x80)) { + if ((this->direction & DIR_NOT_MOVING_CHECK)) { dir = this->direction; - if (dir == 0x81) { - this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ 0x10; + if (dir == (DIR_NOT_MOVING_CHECK | 0x1)) { + this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ DirectionSouth; } } UpdateSpriteForCollisionLayer(this); diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index fa4266c5..6820317a 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -4,28 +4,37 @@ * * @brief Great Fairy object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "save.h" #include "screen.h" #include "script.h" -void GreatFairy_InitializeAnimation(Entity*); -Entity* GreatFairy_CreateForm(Entity*, u32, u32); -void sub_080873D0(Entity*); -extern void (*const GreatFairy_Main[])(Entity*); -extern void (*const GreatFairy_Behaviors[])(Entity*); -extern void (*const GreatFairy_WingsBehaviors[])(Entity*); -extern void (*const GreatFairy_WakeBehaviors[])(Entity*); -extern void (*const GreatFairy_MiniBehaviors[])(Entity*); -extern void (*const GreatFairy_MiniAffineBehaviors[])(Entity*); -extern void (*const GreatFairy_DropletBehaviors[])(Entity*); -extern void (*const GreatFairy_RippleBehaviors[])(Entity*); -extern void (*const GreatFairy_BigRippleBehaviors[])(Entity*); -extern void (*const GreatFairy_EnergyBehaviors[])(Entity*); -extern void (*const GreatFairy_Form1Behaviors[])(Entity*); -extern void (*const GreatFairy_Form2Behaviors[])(Entity*); -extern void (*const gUnk_081207A4[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ s16 unk_68; + /*0x6a*/ s16 unk_6a; + /*0x6c*/ u8 unused1[24]; + /*0x84*/ u16 unk_84; +} GreatFairyEntity; + +void GreatFairy_InitializeAnimation(GreatFairyEntity*); +Entity* GreatFairy_CreateForm(GreatFairyEntity*, u32, u32); +void sub_080873D0(GreatFairyEntity*); +extern void (*const GreatFairy_Main[])(GreatFairyEntity*); +extern void (*const GreatFairy_Behaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_WingsBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_WakeBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_MiniBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_MiniAffineBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_DropletBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_RippleBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_BigRippleBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_EnergyBehaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_Form1Behaviors[])(GreatFairyEntity*); +extern void (*const GreatFairy_Form2Behaviors[])(GreatFairyEntity*); +extern void (*const gUnk_081207A4[])(GreatFairyEntity*); extern const s16 GreatFairy_RippleOffsets[10]; extern u8 gUnk_0812079C[8]; @@ -45,21 +54,21 @@ enum { }; // Main -void GreatFairy(Entity* this) { - if (this->action == 0) { +void GreatFairy(GreatFairyEntity* this) { + if (super->action == 0) { s32 temp = 11; - this->type2 = this->type % temp; + super->type2 = super->type % temp; } - GreatFairy_Main[this->type2](this); + GreatFairy_Main[super->type2](this); } // Behaviors -void GreatFairy_CallBehavior(Entity* this) { - GreatFairy_Behaviors[this->action](this); +void GreatFairy_CallBehavior(GreatFairyEntity* this) { + GreatFairy_Behaviors[super->action](this); if ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) < 168) { - gRoomControls.camera_target = this; + gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 2; } else { gRoomControls.camera_target = &gPlayerEntity; @@ -68,13 +77,13 @@ void GreatFairy_CallBehavior(Entity* this) { } // Init -void GreatFairy_Init(Entity* this) { +void GreatFairy_Init(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->timer = 0; - this->cutsceneBeh.HWORD = 290; + super->timer = 0; + this->unk_84 = 290; } -void GreatFairy_DormantUpdate(Entity* this) { +void GreatFairy_DormantUpdate(GreatFairyEntity* this) { u16* pFrame; // r1@2 s32 frame; // r1@4 Entity* ripple; // r5@16 @@ -82,13 +91,13 @@ void GreatFairy_DormantUpdate(Entity* this) { if (!CheckRoomFlag(0)) return; - pFrame = &this->cutsceneBeh.HWORD; + pFrame = &this->unk_84; if (*pFrame != 0) { --*pFrame; } switch (*pFrame) { case 0: - this->action = 2; + super->action = 2; break; case 130: case 150: @@ -97,421 +106,421 @@ void GreatFairy_DormantUpdate(Entity* this) { case 289: ripple = GreatFairy_CreateForm(this, RIPPLE, 0); if (ripple) { - PositionRelative(this, ripple, Q_16_16(GreatFairy_RippleOffsets[this->timer]), - Q_16_16(GreatFairy_RippleOffsets[this->timer + 1])); - this->timer += 2; + PositionRelative(super, ripple, Q_16_16(GreatFairy_RippleOffsets[super->timer]), + Q_16_16(GreatFairy_RippleOffsets[super->timer + 1])); + super->timer += 2; break; } } } -void GreatFairy_CreateBigRipple(Entity* this) { +void GreatFairy_CreateBigRipple(GreatFairyEntity* this) { Entity* ripple; ripple = GreatFairy_CreateForm(this, BIGRIPPLE, 0); if (ripple != NULL) { - PositionRelative(this, ripple, 0, Q_16_16(8.0)); - this->action = 3; + PositionRelative(super, ripple, 0, Q_16_16(8.0)); + super->action = 3; } } // Great Fairy spawning in update -void GreatFairy_SpawningUpdate(Entity* this) { +void GreatFairy_SpawningUpdate(GreatFairyEntity* this) { Entity* mini; u32 var; if (gRoomVars.animFlags & 1) { mini = GreatFairy_CreateForm(this, WAKE, 0); //??? if (mini != NULL) { - CopyPosition(this, mini); + CopyPosition(super, mini); SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 4); SoundReq(SFX_145); - this->action = 4; - this->timer = 60; - this->spriteSettings.draw = 1; + super->action = 4; + super->timer = 60; + super->spriteSettings.draw = 1; } } } -void GreatFairy_MiniUpdate(Entity* this) { +void GreatFairy_MiniUpdate(GreatFairyEntity* this) { Entity* target; - GetNextFrame(this); - if (this->timer != 0) { - --this->timer; + GetNextFrame(super); + if (super->timer != 0) { + --super->timer; } else { target = GreatFairy_CreateForm(this, WINGS, 0); if (target != NULL) { - PositionRelative(this, target, 0, Q_16_16(-20.0)); - this->action = 5; - this->timer = 120; - this->subtimer = 0; + PositionRelative(super, target, 0, Q_16_16(-20.0)); + super->action = 5; + super->timer = 120; + super->subtimer = 0; } } } // This is the great fairy's "normal" form -void GreatFairy_FinalUpdate(Entity* this) { +void GreatFairy_FinalUpdate(GreatFairyEntity* this) { Entity* target; - if (this->timer != 0) { - --this->timer; + if (super->timer != 0) { + --super->timer; } else { - if ((this->subtimer == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) { - PositionRelative(this, target, 0, Q_16_16(-76.0)); - target->parent = this; - this->subtimer = 1; + if ((super->subtimer == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) { + PositionRelative(super, target, 0, Q_16_16(-76.0)); + target->parent = super; + super->subtimer = 1; } } - GetNextFrame(this); + GetNextFrame(super); } -void GreatFairy_WingsCallBehavior(Entity* this) { - GreatFairy_WingsBehaviors[this->action](this); +void GreatFairy_WingsCallBehavior(GreatFairyEntity* this) { + GreatFairy_WingsBehaviors[super->action](this); } -void GreatFairy_WingsInit(Entity* this) { +void GreatFairy_WingsInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spritePriority.b0 = 5; - this->spriteSettings.draw = 1; - this->spriteRendering.alphaBlend = 1; + super->spritePriority.b0 = 5; + super->spriteSettings.draw = 1; + super->spriteRendering.alphaBlend = 1; gScreen.controls.layerFXControl = 0xF40; gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 8); - this->speed = 1024; - SetAffineInfo(this, 1024, 256, 0); + super->speed = 1024; + SetAffineInfo(super, 1024, 256, 0); } -void GreatFairy_WingsUpdate(Entity* this) { - this->speed -= 32; - if (this->speed == 256) { - this->action = 2; - sub_0805EC60(this); +void GreatFairy_WingsUpdate(GreatFairyEntity* this) { + super->speed -= 32; + if (super->speed == 256) { + super->action = 2; + sub_0805EC60(super); gRoomVars.animFlags |= 32; gActiveScriptInfo.syncFlags |= 4; } else { - SetAffineInfo(this, this->speed, 256, 0); + SetAffineInfo(super, super->speed, 256, 0); } } -void nullsub_116(Entity* this) { +void nullsub_116(GreatFairyEntity* this) { } // The wake that appears beneath the Great Fairy as she stands in the water -void GreatFairy_WakeCallBehavior(Entity* this) { - GreatFairy_WakeBehaviors[this->action](this); +void GreatFairy_WakeCallBehavior(GreatFairyEntity* this) { + GreatFairy_WakeBehaviors[super->action](this); } -void GreatFairy_WakeInit(Entity* this) { +void GreatFairy_WakeInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 6; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 6; } -void GreatFairy_WakeUpdate(Entity* this) { - GetNextFrame(this); +void GreatFairy_WakeUpdate(GreatFairyEntity* this) { + GetNextFrame(super); } // The miniature sprite that emerges from the water when Great Fairy is spawned -void GreatFairy_MiniCallBehavior(Entity* this) { - GreatFairy_MiniBehaviors[this->action](this); +void GreatFairy_MiniCallBehavior(GreatFairyEntity* this) { + GreatFairy_MiniBehaviors[super->action](this); } -void GreatFairy_MiniInit(Entity* this) { +void GreatFairy_MiniInit(GreatFairyEntity* this) { Entity* aff; aff = GreatFairy_CreateForm(this, MINIAFFINE, 0); if (aff != NULL) { - CopyPosition(this, aff); - aff->parent = this; + CopyPosition(super, aff); + aff->parent = super; GreatFairy_InitializeAnimation(this); - this->spriteSettings.draw = 1; - this->subtimer = 0; + super->spriteSettings.draw = 1; + super->subtimer = 0; } } // Spawns a droplet of water once it reaches a certain height -void GreatFairy_MiniRisingUpdate(Entity* this) { +void GreatFairy_MiniRisingUpdate(GreatFairyEntity* this) { Entity* target; - GetNextFrame(this); - this->z.WORD -= Q_16_16(0.5); - if (this->z.HALF.HI == -20) { - this->action = 2; + GetNextFrame(super); + super->z.WORD -= Q_16_16(0.5); + if (super->z.HALF.HI == -20) { + super->action = 2; SoundReq(SFX_HEART_CONTAINER_SPAWN); } else { - if (((this->z.HALF.HI == -10) && (this->subtimer == 0)) && + if (((super->z.HALF.HI == -10) && (super->subtimer == 0)) && (target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) { - PositionRelative(this, target, 0, Q_16_16(4.0)); - this->subtimer = 1; + PositionRelative(super, target, 0, Q_16_16(4.0)); + super->subtimer = 1; } } } // Deletes itself -void GreatFairy_MiniRemoveMe(Entity* this) { - GetNextFrame(this); +void GreatFairy_MiniRemoveMe(GreatFairyEntity* this) { + GetNextFrame(super); sub_080873D0(this); if (gRoomVars.animFlags & 1) { - DeleteEntity(this); + DeleteEntity(super); } } // Same as mini Great Fairy except it is able to stretch -void GreatFairy_MiniAffineCallBehavior(Entity* this) { - GreatFairy_MiniAffineBehaviors[this->action](this); +void GreatFairy_MiniAffineCallBehavior(GreatFairyEntity* this) { + GreatFairy_MiniAffineBehaviors[super->action](this); } -void GreatFairy_MiniAffineInit(Entity* this) { +void GreatFairy_MiniAffineInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spritePriority.b0 = 6; - this->spriteSettings.draw = 1; + super->spritePriority.b0 = 6; + super->spriteSettings.draw = 1; } // Getting ready for affine transformation -void GreatFairy_MiniAffineInit2(Entity* this) { - Entity* parent = this->parent; +void GreatFairy_MiniAffineInit2(GreatFairyEntity* this) { + Entity* parent = super->parent; - CopyPosition(parent, this); + CopyPosition(parent, super); - if (this->z.HALF.HI == -20) { - this->action = 2; - this->timer = 90; - this->speed = 4096; - this->spriteRendering.b0 = 3; - SetAffineInfo(this, 256, 256, 0); + if (super->z.HALF.HI == -20) { + super->action = 2; + super->timer = 90; + super->speed = 4096; + super->spriteRendering.b0 = 3; + SetAffineInfo(super, 256, 256, 0); } } // Mini great fairy stretch -void GreatFairy_MiniAffineUpdate(Entity* this) { - if (--this->timer == 0) { +void GreatFairy_MiniAffineUpdate(GreatFairyEntity* this) { + if (--super->timer == 0) { gRoomVars.animFlags |= 1; - this->action = 3; - sub_0805EC60(this); + super->action = 3; + sub_0805EC60(super); } else { - this->speed -= 24; - SetAffineInfo(this, 256, this->speed >> 4, 0); + super->speed -= 24; + SetAffineInfo(super, 256, super->speed >> 4, 0); } } // The droplet that falls off of the mini Great Fairy emerging from the water -void GreatFairy_DropletCallBehavior(Entity* this) { - GreatFairy_DropletBehaviors[this->action](this); +void GreatFairy_DropletCallBehavior(GreatFairyEntity* this) { + GreatFairy_DropletBehaviors[super->action](this); } -void GreatFairy_DropletInit(Entity* this) { +void GreatFairy_DropletInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.draw = 1; - this->z.HALF.HI = 0; - this->spritePriority.b0 = 5; + super->spriteSettings.draw = 1; + super->z.HALF.HI = 0; + super->spritePriority.b0 = 5; SoundReq(SFX_140); } -void GreatFairy_DropletUpdate(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - DeleteEntity(this); +void GreatFairy_DropletUpdate(GreatFairyEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + DeleteEntity(super); } } // Ripples that appear before the great fairy emerges -void GreatFairy_RippleCallBehavior(Entity* this) { - GreatFairy_RippleBehaviors[this->action](this); +void GreatFairy_RippleCallBehavior(GreatFairyEntity* this) { + GreatFairy_RippleBehaviors[super->action](this); } -void GreatFairy_RippleInit(Entity* this) { +void GreatFairy_RippleInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 6; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 6; } -void GreatFairy_RippleUpdate(Entity* this) { +void GreatFairy_RippleUpdate(GreatFairyEntity* this) { if (gRoomVars.animFlags & 2) { - DeleteEntity(this); + DeleteEntity(super); } else { - GetNextFrame(this); + GetNextFrame(super); } } // Big ripple that appears in the spot where the fairy emerges from -void GreatFairy_BigRippleCallBehavior(Entity* this) { - GreatFairy_BigRippleBehaviors[this->action](this); +void GreatFairy_BigRippleCallBehavior(GreatFairyEntity* this) { + GreatFairy_BigRippleBehaviors[super->action](this); } -void GreatFairy_BigRippleInit(Entity* this) { +void GreatFairy_BigRippleInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->timer = 120; - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 5; + super->timer = 120; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 5; SoundReq(SFX_TELEPORTER); } -void GreatFairy_BigRippleUpdate(Entity* this) { +void GreatFairy_BigRippleUpdate(GreatFairyEntity* this) { Entity* target; - GetNextFrame(this); - if (this->timer != 0) { - --this->timer; + GetNextFrame(super); + if (super->timer != 0) { + --super->timer; } else { target = GreatFairy_CreateForm(this, MINI, 0); if (target != NULL) { - PositionRelative(this, target, 0, Q_16_16(-8.0)); + PositionRelative(super, target, 0, Q_16_16(-8.0)); gRoomVars.animFlags |= 2; - DeleteEntity(this); + DeleteEntity(super); } } } // Energy bands that surround the mini Great Fairy as it is transforming -void GreatFairy_EnergyCallBehavior(Entity* this) { - GreatFairy_EnergyBehaviors[this->action](this); +void GreatFairy_EnergyCallBehavior(GreatFairyEntity* this) { + GreatFairy_EnergyBehaviors[super->action](this); } -void GreatFairy_EnergyInit(Entity* this) { +void GreatFairy_EnergyInit(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 5; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 5; } -void GreatFairy_EnergyUpdate(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - DeleteEntity(this); +void GreatFairy_EnergyUpdate(GreatFairyEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + DeleteEntity(super); } } -void sub_08087114(Entity* this) { - if (this->type2 == 0) { - GreatFairy_Form1Behaviors[this->action](this); +void sub_08087114(GreatFairyEntity* this) { + if (super->type2 == 0) { + GreatFairy_Form1Behaviors[super->action](this); } else { - GreatFairy_Form2Behaviors[this->action](this); - GetNextFrame(this); + GreatFairy_Form2Behaviors[super->action](this); + GetNextFrame(super); } } -void sub_08087150(Entity* this) { +void sub_08087150(GreatFairyEntity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.draw = 1; - this->spriteOrientation.flipY = 0; - this->spriteRendering.b3 = 0; - this->spritePriority.b0 = 3; - this->speed = 0x80; - this->direction = 0x10; - this->palette.b.b4 = gUnk_0812079C[0]; - this->palette.b.b0 = gUnk_0812079C[0]; + super->spriteSettings.draw = 1; + super->spriteOrientation.flipY = 0; + super->spriteRendering.b3 = 0; + super->spritePriority.b0 = 3; + super->speed = 0x80; + super->direction = 0x10; + super->palette.b.b4 = gUnk_0812079C[0]; + super->palette.b.b0 = gUnk_0812079C[0]; } -void nullsub_516(Entity* this) { +void nullsub_516(GreatFairyEntity* this) { } -void sub_080871A8(Entity* this) { - if (--this->timer == 0) { - this->action = 3; - this->timer = 60; +void sub_080871A8(GreatFairyEntity* this) { + if (--super->timer == 0) { + super->action = 3; + super->timer = 60; gRoomVars.animFlags |= 4; } } -void sub_080871D0(Entity* this) { - if (--this->timer == 0) { +void sub_080871D0(GreatFairyEntity* this) { + if (--super->timer == 0) { gRoomVars.animFlags |= 8; - DeleteEntity(this); + DeleteEntity(super); } } -void sub_080871F8(Entity* this) { - Entity* temp = this->child; +void sub_080871F8(GreatFairyEntity* this) { + Entity* temp = super->child; - if ((temp->x.HALF.HI == this->x.HALF.HI) && (temp->y.HALF.HI - 32 == this->y.HALF.HI)) { - this->action = 2; + if ((temp->x.HALF.HI == super->x.HALF.HI) && (temp->y.HALF.HI - 32 == super->y.HALF.HI)) { + super->action = 2; } else { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32); - LinearMoveUpdate(this); + super->direction = + CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32); + LinearMoveUpdate(super); } } -void sub_08087240(Entity* this) { +void sub_08087240(GreatFairyEntity* this) { if (gRoomVars.animFlags & 4) { - this->action = 3; - this->timer = 20; - this->direction = 16; + super->action = 3; + super->timer = 20; + super->direction = 16; } } -void sub_08087264(Entity* this) { - if (this->timer != 0) { - this->timer--; - LinearMoveUpdate(this); +void sub_08087264(GreatFairyEntity* this) { + if (super->timer != 0) { + super->timer--; + LinearMoveUpdate(super); } } -void sub_0808727C(Entity* this) { - if (--this->timer == 0) { - DeleteEntity(this); +void sub_0808727C(GreatFairyEntity* this) { + if (--super->timer == 0) { + DeleteEntity(super); } } -void sub_08087294(Entity* this) { - gUnk_081207A4[this->action](this); +void sub_08087294(GreatFairyEntity* this) { + gUnk_081207A4[super->action](this); } -void sub_080872AC(Entity* this) { - this->spriteSettings.draw = 1; - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 0; - this->field_0x68.HWORD = this->x.HALF.HI; - this->field_0x6a.HWORD = this->y.HALF.HI; - this->direction = (u8)Random() & 0x1F; - this->speed = 32; +void sub_080872AC(GreatFairyEntity* this) { + super->spriteSettings.draw = 1; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 0; + this->unk_68 = super->x.HALF.HI; + this->unk_6a = super->y.HALF.HI; + super->direction = (u8)Random() & 0x1F; + super->speed = 32; GreatFairy_InitializeAnimation(this); } -void sub_080872F8(Entity* this) { +void sub_080872F8(GreatFairyEntity* this) { s32 temp; - LinearMoveUpdate(this); - GetNextFrame(this); - if (((u16)(this->field_0x68.HWORD - this->x.HALF.HI) > 0xc) || - ((u16)(this->field_0x6a.HWORD - this->y.HALF.HI) > 0xc)) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, (s16)this->field_0x68.HWORD, - (s16)this->field_0x6a.HWORD); - this->direction = (this->direction + gUnk_081207AC[Random() & 3]) & 0x1f; + LinearMoveUpdate(super); + GetNextFrame(super); + if (((u16)(this->unk_68 - super->x.HALF.HI) > 0xc) || ((u16)(this->unk_6a - super->y.HALF.HI) > 0xc)) { + super->direction = + CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, (s16)this->unk_68, (s16)this->unk_6a); + super->direction = (super->direction + gUnk_081207AC[Random() & 3]) & 0x1f; } - temp = gSineTable[this->timer + 64]; - this->z.HALF.HI = (temp >> 6) - 8; - this->timer++; + temp = gSineTable[super->timer + 64]; + super->z.HALF.HI = (temp >> 6) - 8; + super->timer++; } -void GreatFairy_InitializeAnimation(Entity* this) { +void GreatFairy_InitializeAnimation(GreatFairyEntity* this) { s32 temp = 11; - this->action = 1; - this->type2 = this->type % temp; - this->collisionLayer = 2; - InitializeAnimation(this, this->type2); - SetDefaultPriority(this, PRIO_MESSAGE); + super->action = 1; + super->type2 = super->type % temp; + super->collisionLayer = 2; + InitializeAnimation(super, super->type2); + SetDefaultPriority(super, PRIO_MESSAGE); } -Entity* GreatFairy_CreateForm(Entity* this, u32 curForm, u32 parameter) { +Entity* GreatFairy_CreateForm(GreatFairyEntity* this, u32 curForm, u32 parameter) { s32 nextForm; Entity* ent; - nextForm = this->type; + nextForm = super->type; nextForm /= 11; ent = CreateObject(GREAT_FAIRY, (u8)nextForm * 11 + curForm, parameter); return ent; } -void sub_080873D0(Entity* this) { +void sub_080873D0(GreatFairyEntity* this) { Entity* ent; - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { ent = GreatFairy_CreateForm(this, 8, 0); if (ent != NULL) { - CopyPosition(this, ent); - this->timer = 48; + CopyPosition(super, ent); + super->timer = 48; } } } @@ -527,11 +536,11 @@ void sub_080873FC(void) { } } -void sub_08087424(Entity* this, ScriptExecutionContext* context) { +void sub_08087424(GreatFairyEntity* this, ScriptExecutionContext* context) { Entity* ent; ResetPlayerAnimationAndAction(); - ent = CreateObject(THUNDERBOLD, 0, 0); + ent = CreateObject(THUNDERBOLT, 0, 0); if (ent != NULL) { ent->parent = &gPlayerEntity; CopyPosition(&gPlayerEntity, ent); @@ -548,7 +557,7 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) { } } -void sub_0808747C(Entity* this, ScriptExecutionContext* context) { +void sub_0808747C(GreatFairyEntity* this, ScriptExecutionContext* context) { u32 iVar1 = 0; iVar1 = (u32)FindEntity(OBJECT, SPECIAL_FX, 0x6, 0xb, 0x0); @@ -558,7 +567,7 @@ void sub_0808747C(Entity* this, ScriptExecutionContext* context) { context->condition = iVar1; } -void (*const GreatFairy_Main[])(Entity*) = { +void (*const GreatFairy_Main[])(GreatFairyEntity*) = { GreatFairy_CallBehavior, GreatFairy_WingsCallBehavior, GreatFairy_WakeCallBehavior, @@ -572,7 +581,7 @@ void (*const GreatFairy_Main[])(Entity*) = { sub_08087294, }; -void (*const GreatFairy_Behaviors[])(Entity*) = { +void (*const GreatFairy_Behaviors[])(GreatFairyEntity*) = { GreatFairy_Init, GreatFairy_DormantUpdate, GreatFairy_CreateBigRipple, GreatFairy_SpawningUpdate, GreatFairy_MiniUpdate, GreatFairy_FinalUpdate, }; @@ -581,57 +590,57 @@ const s16 GreatFairy_RippleOffsets[10] = { 0, 0, -32, -8, 16, 20, 24, -12, -16, 24, }; -void (*const GreatFairy_WingsBehaviors[])(Entity*) = { +void (*const GreatFairy_WingsBehaviors[])(GreatFairyEntity*) = { GreatFairy_WingsInit, GreatFairy_WingsUpdate, nullsub_116, }; -void (*const GreatFairy_WakeBehaviors[])(Entity*) = { +void (*const GreatFairy_WakeBehaviors[])(GreatFairyEntity*) = { GreatFairy_WakeInit, GreatFairy_WakeUpdate, }; -void (*const GreatFairy_MiniBehaviors[])(Entity*) = { +void (*const GreatFairy_MiniBehaviors[])(GreatFairyEntity*) = { GreatFairy_MiniInit, GreatFairy_MiniRisingUpdate, GreatFairy_MiniRemoveMe, }; -void (*const GreatFairy_MiniAffineBehaviors[])(Entity*) = { +void (*const GreatFairy_MiniAffineBehaviors[])(GreatFairyEntity*) = { GreatFairy_MiniAffineInit, GreatFairy_MiniAffineInit2, GreatFairy_MiniAffineUpdate, - DeleteEntity, + (void (*)(GreatFairyEntity*))DeleteEntity, }; -void (*const GreatFairy_DropletBehaviors[])(Entity*) = { +void (*const GreatFairy_DropletBehaviors[])(GreatFairyEntity*) = { GreatFairy_DropletInit, GreatFairy_DropletUpdate, }; -void (*const GreatFairy_RippleBehaviors[])(Entity*) = { +void (*const GreatFairy_RippleBehaviors[])(GreatFairyEntity*) = { GreatFairy_RippleInit, GreatFairy_RippleUpdate, }; -void (*const GreatFairy_BigRippleBehaviors[])(Entity*) = { +void (*const GreatFairy_BigRippleBehaviors[])(GreatFairyEntity*) = { GreatFairy_BigRippleInit, GreatFairy_BigRippleUpdate, }; -void (*const GreatFairy_EnergyBehaviors[])(Entity*) = { +void (*const GreatFairy_EnergyBehaviors[])(GreatFairyEntity*) = { GreatFairy_EnergyInit, GreatFairy_EnergyUpdate, }; -void (*const GreatFairy_Form1Behaviors[])(Entity*) = { +void (*const GreatFairy_Form1Behaviors[])(GreatFairyEntity*) = { sub_08087150, nullsub_516, sub_080871A8, sub_080871D0, }; -void (*const GreatFairy_Form2Behaviors[])(Entity*) = { +void (*const GreatFairy_Form2Behaviors[])(GreatFairyEntity*) = { sub_08087150, sub_080871F8, sub_08087240, sub_08087264, sub_0808727C, }; diff --git a/src/object/gustJarParticle.c b/src/object/gustJarParticle.c index 4cbcb580..4c03551f 100644 --- a/src/object/gustJarParticle.c +++ b/src/object/gustJarParticle.c @@ -5,11 +5,11 @@ * @brief Gust Jar Particle object */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" #include "asm.h" -#include "room.h" +#include "entity.h" #include "physics.h" +#include "player.h" +#include "room.h" void GustJarParticle_Init(Entity*); void GustJarParticle_Action1(Entity*); diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 103352ce..a5c34d89 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -9,7 +9,6 @@ #include "enemy/gyorg.h" #include "entity.h" #include "functions.h" -#include "global.h" #include "object.h" #include "room.h" #include "screen.h" diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index a0694601..95d1b074 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -4,6 +4,7 @@ * * @brief HeartContainer object */ +#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "flags.h" @@ -11,12 +12,19 @@ #include "item.h" #include "sound.h" -static void HeartContainer_Init(Entity*); -static void HeartContainer_Action1(Entity*); -static void HeartContainer_Action2(Entity*); -static void HeartContainer_Action3(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} HeartContainerEntity; -static void (*const HeartContainer_Actions[])(Entity*) = { +static void HeartContainer_Init(HeartContainerEntity* this); +static void HeartContainer_Action1(HeartContainerEntity* this); +static void HeartContainer_Action2(HeartContainerEntity* this); +static void HeartContainer_Action3(HeartContainerEntity* this); + +static void (*const HeartContainer_Actions[])(HeartContainerEntity*) = { HeartContainer_Init, HeartContainer_Action1, HeartContainer_Action2, @@ -25,49 +33,49 @@ static void (*const HeartContainer_Actions[])(Entity*) = { const Hitbox3D gUnk_08121C58 = { 0, -3, { 5, 3, 3, 5 }, 6, 6, 12, {} }; -void HeartContainer(Entity* this) { - HeartContainer_Actions[this->action](this); +void HeartContainer(HeartContainerEntity* this) { + HeartContainer_Actions[super->action](this); } -static void HeartContainer_Init(Entity* this) { - if (CheckFlags(this->cutsceneBeh.HWORD)) { +static void HeartContainer_Init(HeartContainerEntity* this) { + if (CheckFlags(this->unk_84)) { DeleteThisEntity(); } - this->action = 1; - this->type = 0x62; - this->spriteSettings.draw = 0; - this->hitbox = (Hitbox*)&gUnk_08121C58; - this->collisionLayer = 3; - this->updatePriority = PRIO_NO_BLOCK; + super->action = 1; + super->type = 0x62; + super->spriteSettings.draw = 0; + super->hitbox = (Hitbox*)&gUnk_08121C58; + super->collisionLayer = 3; + super->updatePriority = PRIO_NO_BLOCK; } -static void HeartContainer_Action1(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD)) { - this->action = 2; - this->spriteSettings.draw = 1; - this->spriteRendering.b0 = 3; +static void HeartContainer_Action1(HeartContainerEntity* this) { + if (CheckFlags(this->unk_86)) { + super->action = 2; + super->spriteSettings.draw = 1; + super->spriteRendering.b0 = 3; HeartContainer_Action2(this); } } -static void HeartContainer_Action2(Entity* this) { - int var0 = 0x400 - this->subtimer * 8; +static void HeartContainer_Action2(HeartContainerEntity* this) { + int var0 = 0x400 - super->subtimer * 8; if (var0 > 0x100) { - this->subtimer++; - SetAffineInfo(this, var0, var0, 0); + super->subtimer++; + SetAffineInfo(super, var0, var0, 0); } else { - this->action = 3; - this->collisionFlags |= 0x10; - sub_0805EC60(this); + super->action = 3; + super->collisionFlags |= 0x10; + sub_0805EC60(super); SoundReq(SFX_HEART_CONTAINER_SPAWN); } - sub_08080CB4(this); + sub_08080CB4(super); } -static void HeartContainer_Action3(Entity* this) { - sub_08080CB4(this); - if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) { - SetFlag(this->cutsceneBeh.HWORD); +static void HeartContainer_Action3(HeartContainerEntity* this) { + sub_08080CB4(super); + if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(super)) { + SetFlag(this->unk_84); CreateItemEntity(ITEM_HEART_CONTAINER, 0, 0); DeleteThisEntity(); } diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c index 5c19bde6..2f482dfe 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -4,52 +4,61 @@ * * @brief Hidden Ladder Down object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" #include "functions.h" #include "tiles.h" -void HiddenLadderDown_Init(Entity*); -void HiddenLadderDown_Action1(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u8 unused2[20]; + /*0x86*/ u16 unk_86; +} HiddenLadderDownEntity; -void HiddenLadderDown(Entity* this) { - static void (*const HiddenLadderDown_Actions[])(Entity*) = { +void HiddenLadderDown_Init(HiddenLadderDownEntity* this); +void HiddenLadderDown_Action1(HiddenLadderDownEntity* this); + +void HiddenLadderDown(HiddenLadderDownEntity* this) { + static void (*const HiddenLadderDown_Actions[])(HiddenLadderDownEntity*) = { HiddenLadderDown_Init, HiddenLadderDown_Action1, }; - if (this->action < 2) { - HiddenLadderDown_Actions[this->action](this); + if (super->action < 2) { + HiddenLadderDown_Actions[super->action](this); } } -void HiddenLadderDown_Init(Entity* this) { +void HiddenLadderDown_Init(HiddenLadderDownEntity* this) { u16* puVar3; - this->action = 1; - this->spritePriority.b0 = 7; - this->animIndex = 0; - this->field_0x70.HALF.LO = COORD_TO_TILE(this); - puVar3 = &this->field_0x70.HALF.LO; - if (CheckFlags(this->field_0x86.HWORD) != 0) { - this->action = 2; - this->spriteSettings.draw = TRUE; - SetMetaTileType(META_TILE_TYPE_418, *puVar3 + TILE_POS(-1, -1), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_419, *puVar3 + TILE_POS(0, -1), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_420, *puVar3 + TILE_POS(1, -1), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_421, *puVar3 + TILE_POS(-1, 0), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_422, *puVar3 + TILE_POS(0, 0), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_423, *puVar3 + TILE_POS(1, 0), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_424, *puVar3 + TILE_POS(-1, 1), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_425, *puVar3 + TILE_POS(0, 1), this->collisionLayer); - SetMetaTileType(META_TILE_TYPE_426, *puVar3 + TILE_POS(1, 1), this->collisionLayer); + super->action = 1; + super->spritePriority.b0 = 7; + super->animIndex = 0; + this->unk_70 = COORD_TO_TILE(super); + puVar3 = &this->unk_70; + if (CheckFlags(this->unk_86) != 0) { + super->action = 2; + super->spriteSettings.draw = TRUE; + SetMetaTileType(META_TILE_TYPE_418, *puVar3 + TILE_POS(-1, -1), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_419, *puVar3 + TILE_POS(0, -1), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_420, *puVar3 + TILE_POS(1, -1), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_421, *puVar3 + TILE_POS(-1, 0), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_422, *puVar3 + TILE_POS(0, 0), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_423, *puVar3 + TILE_POS(1, 0), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_424, *puVar3 + TILE_POS(-1, 1), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_425, *puVar3 + TILE_POS(0, 1), super->collisionLayer); + SetMetaTileType(META_TILE_TYPE_426, *puVar3 + TILE_POS(1, 1), super->collisionLayer); } } -void HiddenLadderDown_Action1(Entity* this) { - if (GetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) { - this->action = 2; - this->spriteSettings.draw = TRUE; - SetFlag(this->field_0x86.HWORD); +void HiddenLadderDown_Action1(HiddenLadderDownEntity* this) { + if (GetMetaTileType(this->unk_70, super->collisionLayer) == 0x1a6) { + super->action = 2; + super->spriteSettings.draw = TRUE; + SetFlag(this->unk_86); } } diff --git a/src/object/hitSwitch.c b/src/object/hitSwitch.c index 0b32dce4..a0931519 100644 --- a/src/object/hitSwitch.c +++ b/src/object/hitSwitch.c @@ -4,40 +4,49 @@ * * @brief Hit Switch object */ +#define NENT_DEPRECATED #include "entity.h" #include "physics.h" -void HitSwitch(Entity* this) { - Entity* parent = this->parent; +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; + /*0x76*/ u8 unk_76; +} HitSwitchEntity; + +void HitSwitch(HitSwitchEntity* this) { + Entity* parent = super->parent; if (parent->next == NULL) { DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - this->field_0x76.HALF.LO = parent->animationState; - this->field_0x74.HALF.LO = this->spriteOffsetX; - this->field_0x74.HALF.HI = this->spriteOffsetY; - InitializeAnimation(this, this->animationState); + if (super->action == 0) { + super->action = 1; + this->unk_76 = parent->animationState; + this->unk_74 = super->spriteOffsetX; + this->unk_75 = super->spriteOffsetY; + InitializeAnimation(super, super->animationState); } - if (parent->animationState != this->field_0x76.HALF.LO) { + if (parent->animationState != this->unk_76) { DeleteThisEntity(); } - this->spriteSettings.draw = parent->spriteSettings.draw; - CopyPositionAndSpriteOffset(parent, this); - this->spriteOffsetX += this->field_0x74.HALF.LO; - this->spriteOffsetY += this->field_0x74.HALF.HI; - if (this->animationState != 2) { - this->y.HALF.HI++; - this->spriteOffsetY--; + super->spriteSettings.draw = parent->spriteSettings.draw; + CopyPositionAndSpriteOffset(parent, super); + super->spriteOffsetX += this->unk_74; + super->spriteOffsetY += this->unk_75; + if (super->animationState != 2) { + super->y.HALF.HI++; + super->spriteOffsetY--; } else { - this->y.HALF.HI--; - this->spriteOffsetY++; + super->y.HALF.HI--; + super->spriteOffsetY++; } - GetNextFrame(this); - if (this->frame & 0x80) { + GetNextFrame(super); + if (super->frame & 0x80) { DeleteThisEntity(); } } diff --git a/src/object/hittableLever.c b/src/object/hittableLever.c index 293035a8..d92fbfa3 100644 --- a/src/object/hittableLever.c +++ b/src/object/hittableLever.c @@ -4,11 +4,9 @@ * * @brief Hittable Lever object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 332a3ab4..5b0a94f6 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -4,16 +4,25 @@ * * @brief House Door Exterior object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "npc.h" #include "object.h" #include "room.h" #include "script.h" #include "sound.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u16 unk_6a; + /*0x6c*/ u8 unk_6c; + /*0x6d*/ u8 unused1[23]; + /*0x84*/ ScriptExecutionContext* context; +} HouseDoorExteriorEntity; + typedef struct { /*0x00*/ u16 unk0; /*0x02*/ u16 unk2; @@ -24,62 +33,57 @@ typedef struct { /*0x08*/ u8* unk8; } unk_DoorProperty; -typedef struct { - /*0x00*/ u8 filler0[0x8]; - /*0x08*/ u32 unk8; -} unk_80868EC; - -static void sub_080868EC(Entity* entity, unk_80868EC* arg1); +static void sub_080868EC(Entity* entity, ScriptExecutionContext* context); static bool32 sub_080867CC(u32); -void sub_0808681C(Entity*); -void sub_080866D8(Entity*); -void sub_080867E4(Entity*); -void sub_080868B0(Entity*); -static u8 sub_08086954(Entity*); +void HouseDoorExterior_Type2(HouseDoorExteriorEntity* this); +void HouseDoorExterior_Type0(HouseDoorExteriorEntity* this); +void HouseDoorExterior_Type1(HouseDoorExteriorEntity* this); +void HouseDoorExterior_Type3(HouseDoorExteriorEntity* this); +static u8 sub_08086954(HouseDoorExteriorEntity* this); static const Hitbox gUnk_081206AC = { 0, -5, { 5, 3, 3, 5 }, 10, 4 }; -void HouseDoorExterior(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { - sub_080866D8, - sub_080867E4, - sub_0808681C, - sub_080868B0, +void HouseDoorExterior(HouseDoorExteriorEntity* this) { + static void (*const HouseDoorExterior_Types[])(HouseDoorExteriorEntity*) = { + HouseDoorExterior_Type0, + HouseDoorExterior_Type1, + HouseDoorExterior_Type2, + HouseDoorExterior_Type3, }; - typeFuncs[this->type2](this); + HouseDoorExterior_Types[super->type2](this); } -void sub_080866D8(Entity* this) { +void HouseDoorExterior_Type0(HouseDoorExteriorEntity* this) { unk_DoorProperty* prop; - Entity* entity; + HouseDoorExteriorEntity* entity; u32 i; - if (this->action == 0) { - this->action = 1; - *((u32*)(&this->field_0x68)) = 0; - this->field_0x6c.HALF.LO = this->timer; - SetDefaultPriority(this, PRIO_PLAYER_EVENT); + if (super->action == 0) { + super->action = 1; + *((u32*)(&this->unk_68)) = 0; + this->unk_6c = super->timer; + SetDefaultPriority(super, PRIO_PLAYER_EVENT); } - prop = GetCurrentRoomProperty(this->field_0x6c.HALF.LO); + prop = GetCurrentRoomProperty(this->unk_6c); for (i = 0; prop->unk0 != 0xFFFF && i < 32; prop++, i++) { int mask = 1 << i; - if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) && + if ((*((u32*)(&this->unk_68)) & mask) == 0 && sub_080867CC(prop->unk5) && CheckRegionOnScreen(prop->unk0, prop->unk2, 32, 32)) { - entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6); + entity = (HouseDoorExteriorEntity*)CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6); if (entity != NULL) { - entity->field_0x6c.HALF.LO = i; - entity->x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16; - entity->y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32; - entity->parent = this; - entity->field_0x68.HWORD = prop->unk0; - entity->field_0x6a.HWORD = prop->unk2; - entity->collisionLayer = prop->unk4; - entity->subAction = prop->unk5; - UpdateSpriteForCollisionLayer(entity); - *((u32*)(&this->field_0x68)) |= mask; + entity->unk_6c = i; + entity->base.x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16; + entity->base.y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32; + entity->base.parent = super; + entity->unk_68 = prop->unk0; + entity->unk_6a = prop->unk2; + entity->base.collisionLayer = prop->unk4; + entity->base.subAction = prop->unk5; + UpdateSpriteForCollisionLayer(&entity->base); + *((u32*)(&this->unk_68)) |= mask; if (prop->unk8) { - *((ScriptExecutionContext**)(&entity->cutsceneBeh)) = StartCutscene(entity, (u16*)prop->unk8); + entity->context = StartCutscene(&entity->base, (u16*)prop->unk8); } } } @@ -96,63 +100,64 @@ static bool32 sub_080867CC(u32 arg0) { return CheckGlobalFlag(TATEKAKE_HOUSE); } -void sub_080867E4(Entity* this) { - if (!CheckRegionOnScreen(this->field_0x68.HWORD, this->field_0x6a.HWORD, 32, 32)) { - *((u32*)(&this->parent->field_0x68)) = *((u32*)(&this->parent->field_0x68)) & ~(1 << this->field_0x6c.HALF.LO); +void HouseDoorExterior_Type1(HouseDoorExteriorEntity* this) { + if (!CheckRegionOnScreen(this->unk_68, this->unk_6a, 32, 32)) { + *((u32*)(&((HouseDoorExteriorEntity*)super->parent)->unk_68)) = + *((u32*)(&((HouseDoorExteriorEntity*)super->parent)->unk_68)) & ~(1 << this->unk_6c); DeleteThisEntity(); } - sub_0808681C(this); + HouseDoorExterior_Type2(this); } -void sub_0808681C(Entity* this) { - switch (this->action) { +void HouseDoorExterior_Type2(HouseDoorExteriorEntity* this) { + switch (super->action) { case 0: - this->action = 1; - this->timer = 8; - this->spriteSettings.draw = 1; - this->frameIndex = 0; - this->hitbox = (Hitbox*)&gUnk_081206AC; - if (this->subAction == 1) { - this->action = 2; - this->frameIndex = 1; + super->action = 1; + super->timer = 8; + super->spriteSettings.draw = 1; + super->frameIndex = 0; + super->hitbox = (Hitbox*)&gUnk_081206AC; + if (super->subAction == 1) { + super->action = 2; + super->frameIndex = 1; } - if (this->flags & ENT_SCRIPTED) { - this->action = 2; + if (super->flags & ENT_SCRIPTED) { + super->action = 2; } break; case 1: if (!sub_08086954(this)) { - this->action++; - this->frameIndex = 1; + super->action++; + super->frameIndex = 1; sub_08078AC0(16, 0, 1); SoundReq(SFX_111); } break; } - if (this->flags & ENT_SCRIPTED) { - ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh); - sub_080868EC(this, *(void**)&this->cutsceneBeh); + if (super->flags & ENT_SCRIPTED) { + ExecuteScript(super, this->context); + sub_080868EC(super, this->context); } } -void sub_080868B0(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->spriteSettings.draw = 1; - this->hitbox = (Hitbox*)&gUnk_081206AC; - this->timer = 8; +void HouseDoorExterior_Type3(HouseDoorExteriorEntity* this) { + if (super->action == 0) { + super->action = 1; + super->spriteSettings.draw = 1; + super->hitbox = (Hitbox*)&gUnk_081206AC; + super->timer = 8; } - ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh); - sub_080868EC(this, *(void**)&this->cutsceneBeh); + ExecuteScript(super, this->context); + sub_080868EC(super, this->context); } -static void sub_080868EC(Entity* entity, unk_80868EC* arg1) { - u32 var0 = arg1->unk8; - arg1->unk8 = 0; - while (var0 != 0) { - u32 rightMostSetBit = var0 & (~var0 + 1); - var0 ^= rightMostSetBit; +static void sub_080868EC(Entity* entity, ScriptExecutionContext* context) { + u32 postScriptActions = context->postScriptActions; + context->postScriptActions = 0; + while (postScriptActions != 0) { + u32 rightMostSetBit = postScriptActions & (~postScriptActions + 1); + postScriptActions ^= rightMostSetBit; switch (rightMostSetBit) { case 0x80: entity->frameIndex = 0; @@ -168,30 +173,30 @@ static void sub_080868EC(Entity* entity, unk_80868EC* arg1) { } } -void sub_0808692C(Entity* this) { - this->flags &= ~ENT_SCRIPTED; - this->type2 = 2; - this->action = (this->frameIndex == 0) ? 1 : 2; - this->subAction = 0; - this->timer = 8; +void sub_0808692C(HouseDoorExteriorEntity* this) { + super->flags &= ~ENT_SCRIPTED; + super->type2 = 2; + super->action = (super->frameIndex == 0) ? 1 : 2; + super->subAction = 0; + super->timer = 8; } -static u8 sub_08086954(Entity* this) { - if (sub_0800445C(this)) { - if (GetAnimationStateInRectRadius(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && +static u8 sub_08086954(HouseDoorExteriorEntity* this) { + if (sub_0800445C(super)) { + if (GetAnimationStateInRectRadius(super, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && (u16)gPlayerState.playerInput.heldInput == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) { - this->timer--; + super->timer--; } } else { - this->timer = 8; + super->timer = 8; } - return this->timer; + return super->timer; } -void sub_080869A4(Entity* this, ScriptExecutionContext* context) { +void sub_080869A4(HouseDoorExteriorEntity* this, ScriptExecutionContext* context) { context->condition = 0; if (!sub_08086954(this)) { - this->timer = 8; + super->timer = 8; context->condition = 1; } } diff --git a/src/object/houseDoorInterior.c b/src/object/houseDoorInterior.c index 50e8a7ba..8e69feef 100644 --- a/src/object/houseDoorInterior.c +++ b/src/object/houseDoorInterior.c @@ -33,12 +33,12 @@ static const HouseDoorInteriorFrameIndices_struct HouseDoorInteriorFrameIndices[ }; void HouseDoorInterior(Entity* this) { - static void (*const actionFuncs[])(HouseDoorInteriorEntity*) = { + static void (*const HouseDoorInterior_Actions[])(HouseDoorInteriorEntity*) = { HouseDoorInterior_Init, HouseDoorInterior_Action1, HouseDoorInterior_Delete, }; - actionFuncs[this->action]((HouseDoorInteriorEntity*)this); + HouseDoorInterior_Actions[this->action]((HouseDoorInteriorEntity*)this); } typedef struct { diff --git a/src/object/houseSign.c b/src/object/houseSign.c index b8972164..4353e3ad 100644 --- a/src/object/houseSign.c +++ b/src/object/houseSign.c @@ -4,20 +4,28 @@ * * @brief HouseSign object */ -#include "entity.h" +#define NENT_DEPRECATED #include "asm.h" +#include "entity.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ s16 unk_80; + /*0x82*/ s16 unk_82; +} HouseSignEntity; /* This object is created by HouseSignManager. It checks whether the 0x10 x 0x10 rect at field_0x80, field_0x82 is still on the screen. -If not, then it deletes itself and unsets the this->type2 bit in the managers field_0x20 bitfield. +If not, then it deletes itself and unsets the super->type2 bit in the managers field_0x20 bitfield. */ -void HouseSign(Entity* this) { - if (this->action == 0) { - this->action = 1; +void HouseSign(HouseSignEntity* this) { + if (super->action == 0) { + super->action = 1; } - if (CheckRectOnScreen((s16)this->field_0x80.HWORD, (s16)this->field_0x82.HWORD, 0x10, 0x10) == 0) { - this->parent->zVelocity &= ~(1 << this->type2); + if (CheckRectOnScreen(this->unk_80, this->unk_82, 0x10, 0x10) == 0) { + super->parent->zVelocity &= ~(1 << super->type2); DeleteThisEntity(); } } diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index d9615ea4..c0712e1f 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -4,10 +4,8 @@ * * @brief Item for Sale object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "kinstone.h" #include "message.h" @@ -88,15 +86,15 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { gHUD.rActionPlayerState = 2; } else { if (super->type == 0x36) { - if (super->interactType != 0) { - super->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; super->action = 3; gRoomVars.animFlags = 1; gPlayerState.queued_action = PLAYER_08070E9C; } } else { - if (super->interactType != 0) { - super->interactType = 0; + if (super->interactType != INTERACTION_NONE) { + super->interactType = INTERACTION_NONE; super->subAction = 1; sub_08078B48(); ResetActiveItems(); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 20e5a9ac..55762e21 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -4,6 +4,8 @@ * * @brief Item On Ground object */ +#define NENT_DEPRECATED +#include "object/itemOnGround.h" #include "collision.h" #include "entity.h" #include "flags.h" @@ -16,40 +18,41 @@ #include "sound.h" #include "tiles.h" -void sub_08081150(Entity*); +void sub_08081150(ItemOnGroundEntity* this); u8 sub_0808147C(u32); -void sub_080814A4(Entity*); -u32 sub_080814C0(Entity*); -void sub_08081500(Entity*); -void sub_0808153C(Entity*); -void sub_08081598(Entity*); -void sub_080813BC(Entity*); -void sub_080810FC(Entity*); -void ItemOnGround_Init(Entity*); -void ItemOnGround_Action1(Entity*); -void ItemOnGround_Action2(Entity*); -void ItemOnGround_Action3(Entity*); -void ItemOnGround_Action4(Entity*); -void sub_080810A8(Entity*); -void sub_080810FC(Entity*); -void sub_08081150(Entity*); -void sub_08081134(Entity*); -void sub_08081188(Entity*); -void sub_080811AC(Entity*); -void sub_080811C8(Entity*); -void sub_080811D8(Entity*); -void sub_08081248(Entity*); -void sub_0808126C(Entity*); -void sub_0808127C(Entity*); -void nullsub_113(Entity*); -void sub_080812A0(Entity*); -void sub_080812A8(Entity*); -void sub_080812E8(Entity*); -void nullsub_510(Entity*); -void sub_080813D4(Entity*); -void sub_080813E8(Entity*); -void sub_080813F0(Entity*); -bool32 CheckShouldPlayItemGetCutscene(Entity*); +void sub_080814A4(ItemOnGroundEntity* this); +u32 sub_080814C0(ItemOnGroundEntity* this); +void sub_08081500(ItemOnGroundEntity* this); +void sub_0808153C(ItemOnGroundEntity* this); +void sub_08081598(ItemOnGroundEntity* this); +void sub_080813BC(ItemOnGroundEntity* this); +void sub_080810FC(ItemOnGroundEntity* this); +void ItemOnGround_Init(ItemOnGroundEntity* this); +void ItemOnGround_Action1(ItemOnGroundEntity* this); +void ItemOnGround_Action2(ItemOnGroundEntity* this); +void ItemOnGround_Action3(ItemOnGroundEntity* this); +void ItemOnGround_Action4(ItemOnGroundEntity* this); +void sub_080810A8(ItemOnGroundEntity* this); +void sub_080810FC(ItemOnGroundEntity* this); +void sub_08081150(ItemOnGroundEntity* this); +void sub_08081134(ItemOnGroundEntity* this); +void sub_08081188(ItemOnGroundEntity* this); +void sub_080811AC(ItemOnGroundEntity* this); +void sub_080811C8(ItemOnGroundEntity* this); +void sub_080811D8(ItemOnGroundEntity* this); +void sub_08081248(ItemOnGroundEntity* this); +void sub_0808126C(ItemOnGroundEntity* this); +void sub_0808127C(ItemOnGroundEntity* this); +void nullsub_113(ItemOnGroundEntity* this); +void sub_080812A0(ItemOnGroundEntity* this); +void sub_080812A8(ItemOnGroundEntity* this); +void sub_080812E8(ItemOnGroundEntity* this); +void nullsub_510(ItemOnGroundEntity* this); +void sub_080813D4(ItemOnGroundEntity* this); +void sub_080813E8(ItemOnGroundEntity* this); +void sub_080813F0(ItemOnGroundEntity* this); +bool32 CheckShouldPlayItemGetCutscene(ItemOnGroundEntity* this); +void sub_08081404(ItemOnGroundEntity*, u32); typedef struct { u8 unk0[2]; @@ -58,18 +61,18 @@ typedef struct { u8 unk5[3]; } Unk_0811E84C; -void ItemOnGround(Entity* this) { - static void (*const ItemOnGround_Actions[])(Entity*) = { +void ItemOnGround(ItemOnGroundEntity* this) { + static void (*const ItemOnGround_Actions[])(ItemOnGroundEntity*) = { ItemOnGround_Init, ItemOnGround_Action1, ItemOnGround_Action2, ItemOnGround_Action3, ItemOnGround_Action4, }; - if (this->contactFlags & 0x80) { - switch (this->contactFlags & 0x7F) { + if (super->contactFlags & 0x80) { + switch (super->contactFlags & 0x7F) { case 20: - this->action = 3; - COLLISION_OFF(this); - this->spriteSettings.draw = 1; - this->collisionFlags |= 0x10; - this->child = this->contactedEntity; + super->action = 3; + COLLISION_OFF(super); + super->spriteSettings.draw = 1; + super->collisionFlags |= 0x10; + super->child = super->contactedEntity; break; case 0: case 1: @@ -87,38 +90,38 @@ void ItemOnGround(Entity* this) { } } - if (sub_0806F520(this)) { + if (sub_0806F520(super)) { sub_080813BC(this); } else { - ItemOnGround_Actions[this->action](this); + ItemOnGround_Actions[super->action](this); } - if (this->type == 0x5C) { + if (super->type == 0x5C) { gRoomVars.field_0x4++; } - sub_08080CB4(this); + sub_08080CB4(super); } -void ItemOnGround_Init(Entity* this) { - static void (*const gUnk_0811E7E8[])(Entity*) = { +void ItemOnGround_Init(ItemOnGroundEntity* this) { + static void (*const gUnk_0811E7E8[])(ItemOnGroundEntity*) = { sub_080810A8, sub_080810FC, sub_08081150, sub_08081134, sub_08081188, sub_080810A8, sub_080810A8, sub_080811AC, sub_080811C8, sub_080811D8, sub_080810A8, }; - if (this->field_0x86.HWORD && CheckFlags(this->field_0x86.HWORD)) { + if (this->unk_86 && CheckFlags(this->unk_86)) { DeleteThisEntity(); } - if (this->type != ITEM_FAIRY) { - this->spriteSettings.draw = 1; - this->spritePriority.b1 = 3; - this->spriteSettings.shadow = 0; - this->hitType = 7; - this->collisionFlags = 0x47; - this->hurtType = 0x44; - this->health = 0xFF; - this->hitbox = (Hitbox*)&gUnk_080FD1A8; - switch (this->type) { + if (super->type != ITEM_FAIRY) { + super->spriteSettings.draw = 1; + super->spritePriority.b1 = 3; + super->spriteSettings.shadow = 0; + super->hitType = 7; + super->collisionFlags = 0x47; + super->hurtType = 0x44; + super->health = 0xFF; + super->hitbox = (Hitbox*)&gUnk_080FD1A8; + switch (super->type) { case ITEM_SHELLS: case ITEM_RUPEE1: case ITEM_RUPEE5: @@ -129,144 +132,144 @@ void ItemOnGround_Init(Entity* this) { case ITEM_BOMBS5: case ITEM_ARROWS5: case ITEM_HEART: - this->flags2 = 0x17; + super->flags2 = 0x17; break; default: - this->flags2 = 0x11; + super->flags2 = 0x11; break; } - this->field_0x68.HALF.HI = this->timer; - this->field_0x6a.HALF.LO = 0; - this->field_0x6c.HWORD = 0; - this->field_0x68.HALF.LO = 0; - this->timer = 0; - SetDefaultPriority(this, PRIO_NO_BLOCK); - this->gustJarFlags = sub_0808147C(this->type); - gUnk_0811E7E8[this->field_0x68.HALF.HI](this); + this->unk_69 = super->timer; + this->unk_6a = 0; + this->unk_6c = 0; + this->unk_68 = 0; + super->timer = 0; + SetDefaultPriority(super, PRIO_NO_BLOCK); + super->gustJarFlags = sub_0808147C(super->type); + gUnk_0811E7E8[this->unk_69](this); } else { Entity* entity = CreateObject(FAIRY, 0x60, 0); if (entity != NULL) { entity->timer = 0; - if (this->timer == 1) { + if (super->timer == 1) { entity->type2 = 2; } - CopyPosition(this, entity); + CopyPosition(super, entity); DeleteThisEntity(); } } } -void sub_080810A8(Entity* this) { - this->action = 1; +void sub_080810A8(ItemOnGroundEntity* this) { + super->action = 1; sub_080814A4(this); - if (this->direction & 0x80) { - this->direction &= 0x1F; - if (this->speed == 0) { - this->speed = 0x100; + if (super->direction & 0x80) { + super->direction &= 0x1F; + if (super->speed == 0) { + super->speed = 0x100; } } else { - this->direction |= 0xFF; + super->direction |= 0xFF; } - if (this->zVelocity == 0) { - this->zVelocity = Q_16_16(1.875); + if (super->zVelocity == 0) { + super->zVelocity = Q_16_16(1.875); } - if (this->collisionLayer == 2) { - ResolveCollisionLayer(this); + if (super->collisionLayer == 2) { + ResolveCollisionLayer(super); } } -void sub_080810FC(Entity* this) { - if (this->type != ITEM_HEART) { +void sub_080810FC(ItemOnGroundEntity* this) { + if (super->type != ITEM_HEART) { sub_08081598(this); } else { - this->action = 2; - this->subAction = 0; - COLLISION_ON(this); - this->flags2 = 0x11; - CopyPosition(&gPlayerEntity, this); + super->action = 2; + super->subAction = 0; + COLLISION_ON(super); + super->flags2 = 0x11; + CopyPosition(&gPlayerEntity, super); } } -void sub_08081134(Entity* this) { +void sub_08081134(ItemOnGroundEntity* this) { sub_080814A4(this); - this->field_0x6c.HWORD += 80; + this->unk_6c += 80; sub_08081150(this); } -void sub_08081150(Entity* this) { - this->action = 2; - COLLISION_ON(this); - this->z.HALF.HI = -0x80; - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 1; +void sub_08081150(ItemOnGroundEntity* this) { + super->action = 2; + COLLISION_ON(super); + super->z.HALF.HI = -0x80; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; SoundReq(SFX_12D); } -void sub_08081188(Entity* this) { - this->action = 2; - COLLISION_ON(this); - if (this->collisionLayer == 2) { - ResolveCollisionLayer(this); +void sub_08081188(ItemOnGroundEntity* this) { + super->action = 2; + COLLISION_ON(super); + if (super->collisionLayer == 2) { + ResolveCollisionLayer(super); } } -void sub_080811AC(Entity* this) { - this->action = 2; - this->spriteSettings.draw = 0; - this->field_0x6e.HWORD = GetMetaTileTypeByEntity(this); +void sub_080811AC(ItemOnGroundEntity* this) { + super->action = 2; + super->spriteSettings.draw = 0; + this->unk_6e = GetMetaTileTypeByEntity(super); } -void sub_080811C8(Entity* this) { - this->action = 2; - this->spriteSettings.draw = 0; +void sub_080811C8(ItemOnGroundEntity* this) { + super->action = 2; + super->spriteSettings.draw = 0; } -void sub_080811D8(Entity* this) { +void sub_080811D8(ItemOnGroundEntity* this) { sub_08081188(this); SoundReq(SFX_215); } -void ItemOnGround_Action1(Entity* this) { - if (this->field_0x68.HALF.HI != 6) { - ProcessMovement2(this); +void ItemOnGround_Action1(ItemOnGroundEntity* this) { + if (this->unk_69 != 6) { + ProcessMovement2(super); } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } - GravityUpdate(this, Q_8_8(40.0)); - if (this->zVelocity <= 0) { - this->action = 2; - COLLISION_ON(this); + GravityUpdate(super, Q_8_8(40.0)); + if (super->zVelocity <= 0) { + super->action = 2; + COLLISION_ON(super); sub_080814A4(this); } } -void ItemOnGround_Action2(Entity* this) { - static void (*const gUnk_0811E814[])(Entity*) = { +void ItemOnGround_Action2(ItemOnGroundEntity* this) { + static void (*const gUnk_0811E814[])(ItemOnGroundEntity*) = { sub_08081248, sub_08081248, sub_0808126C, sub_0808127C, nullsub_113, sub_080812A0, sub_08081248, sub_080812A8, sub_080812E8, nullsub_510, sub_08081248, }; - gUnk_0811E814[this->field_0x68.HALF.HI](this); + gUnk_0811E814[this->unk_69](this); } -void sub_08081248(Entity* this) { +void sub_08081248(ItemOnGroundEntity* this) { sub_08081500(this); if (sub_080814C0(this)) { sub_08081404(this, 0); } else { - sub_0800442E(this); + sub_0800442E(super); } } -void sub_0808126C(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_0808126C(ItemOnGroundEntity* this) { + UpdateAnimationSingleFrame(super); sub_0808153C(this); } -void sub_0808127C(Entity* this) { +void sub_0808127C(ItemOnGroundEntity* this) { if (sub_080814C0(this)) { sub_08081404(this, 0); } else { @@ -274,112 +277,112 @@ void sub_0808127C(Entity* this) { } } -void nullsub_113(Entity* this) { +void nullsub_113(ItemOnGroundEntity* this) { } -void sub_080812A0(Entity* this) { +void sub_080812A0(ItemOnGroundEntity* this) { sub_08081500(this); } -void sub_080812A8(Entity* this) { - if (GetCollisionDataAtEntity(this) != COLLISION_DATA_15 && - this->field_0x6e.HWORD != GetMetaTileTypeByEntity(this)) { - this->direction = 0; - this->speed = 0; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.HI = 0; +void sub_080812A8(ItemOnGroundEntity* this) { + if (GetCollisionDataAtEntity(super) != COLLISION_DATA_15 && + this->unk_6e != GetMetaTileTypeByEntity(super)) { + super->direction = 0; + super->speed = 0; + super->spriteSettings.draw = 1; + this->unk_69 = 0; sub_080810A8(this); } } -void sub_080812E8(Entity* this) { +void sub_080812E8(ItemOnGroundEntity* this) { PlayerState* playerState = &gPlayerState; #ifdef EU - if ((playerState->swim_state & 0x80) && IsColliding(this, &gPlayerEntity)) { + if ((playerState->swim_state & 0x80) && IsColliding(super, &gPlayerEntity)) { #else if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 && - IsColliding(this, &gPlayerEntity)) { + IsColliding(super, &gPlayerEntity)) { #endif sub_080810FC(this); } } -void nullsub_510(Entity* this) { +void nullsub_510(ItemOnGroundEntity* this) { } -void ItemOnGround_Action3(Entity* this) { - Entity* other = this->child; +void ItemOnGround_Action3(ItemOnGroundEntity* this) { + Entity* other = super->child; if (!(other->kind == PLAYER_ITEM && other->id == 3)) { sub_08081404(this, 0); } else { - CopyPosition(other, this); - this->z.HALF.HI--; + CopyPosition(other, super); + super->z.HALF.HI--; other = &gPlayerEntity; - if (IsColliding(this, other)) { + if (IsColliding(super, other)) { sub_080810FC(this); } } } -void ItemOnGround_Action4(Entity* this) { - if (--this->timer) { - Entity* other = this->child; - this->x.WORD = other->x.WORD; - this->y.WORD = other->y.WORD; - this->spriteOrientation.flipY = other->spriteOrientation.flipY; - this->spriteRendering.b3 = other->spriteRendering.b3; - GravityUpdate(this, Q_8_8(40.0)); +void ItemOnGround_Action4(ItemOnGroundEntity* this) { + if (--super->timer) { + Entity* other = super->child; + super->x.WORD = other->x.WORD; + super->y.WORD = other->y.WORD; + super->spriteOrientation.flipY = other->spriteOrientation.flipY; + super->spriteRendering.b3 = other->spriteRendering.b3; + GravityUpdate(super, Q_8_8(40.0)); } else { sub_08081404(this, 1); } } -void sub_080813BC(Entity* this) { - static void (*const subActionFuncs[])(Entity*) = { +void sub_080813BC(ItemOnGroundEntity* this) { + static void (*const subActionFuncs[])(ItemOnGroundEntity*) = { sub_080813D4, sub_080813E8, sub_080813F0, }; - subActionFuncs[this->subAction](this); + subActionFuncs[super->subAction](this); } -void sub_080813D4(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 1; - this->spriteSettings.draw = 1; +void sub_080813D4(ItemOnGroundEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 1; + super->spriteSettings.draw = 1; } -void sub_080813E8(Entity* this) { - sub_0806F4E8(this); +void sub_080813E8(ItemOnGroundEntity* this) { + sub_0806F4E8(super); } -void sub_080813F0(Entity* this) { - if (sub_0806F3E4(this)) { +void sub_080813F0(ItemOnGroundEntity* this) { + if (sub_0806F3E4(super)) { sub_080810FC(this); } } -void sub_08081404(Entity* this, u32 arg1) { - if (arg1 && this->field_0x86.HWORD) { - SetFlag(this->field_0x86.HWORD); +void sub_08081404(ItemOnGroundEntity* this, u32 arg1) { + if (arg1 && this->unk_86) { + SetFlag(this->unk_86); } DeleteThisEntity(); } -bool32 sub_08081420(Entity* this) { +bool32 sub_08081420(ItemOnGroundEntity* this) { if (CheckShouldPlayItemGetCutscene(this)) { - SetDefaultPriority(this, PRIO_PLAYER_EVENT); - CreateItemEntity(this->type, this->type2, 0); + SetDefaultPriority(super, PRIO_PLAYER_EVENT); + CreateItemEntity(super->type, super->type2, 0); return TRUE; } else { - GiveItem(this->type, this->type2); + GiveItem(super->type, super->type2); return FALSE; } } -bool32 CheckShouldPlayItemGetCutscene(Entity* this) { - return ((gItemMetaData[this->type].unk3 & 0x2) || !GetInventoryValue(this->type)); +bool32 CheckShouldPlayItemGetCutscene(ItemOnGroundEntity* this) { + return ((gItemMetaData[super->type].unk3 & 0x2) || !GetInventoryValue(super->type)); } static const Unk_0811E84C gUnk_0811E84C[118] = { @@ -412,79 +415,79 @@ void sub_0808148C(u32 arg0) { } } -void sub_080814A4(Entity* this) { - if (this->field_0x68.HALF.HI == 10) { - this->field_0x6c.HWORD = 120; +void sub_080814A4(ItemOnGroundEntity* this) { + if (this->unk_69 == 10) { + this->unk_6c = 120; } else { - this->field_0x6c.HWORD = 600; + this->unk_6c = 600; } } -u32 sub_080814C0(Entity* this) { +u32 sub_080814C0(ItemOnGroundEntity* this) { if (!AnyPrioritySet()) { - if (--this->field_0x6c.HWORD == 0) { + if (--this->unk_6c == 0) { return TRUE; } - if (this->field_0x6c.HWORD < 90) { - this->spriteSettings.draw ^= 1; + if (this->unk_6c < 90) { + super->spriteSettings.draw ^= 1; } } return FALSE; } -void sub_08081500(Entity* this) { - if (this->field_0x68.HALF.LO == 0) { - u32 var0 = sub_080044EC(this, 0x2800); +void sub_08081500(ItemOnGroundEntity* this) { + if (this->unk_68 == 0) { + u32 var0 = sub_080044EC(super, 0x2800); if (var0 == 0) { - this->field_0x68.HALF.LO = 1; + this->unk_68 = 1; } else { if (var0 == 1) { - sub_0808148C(this->type); - UpdateSpriteForCollisionLayer(this); + sub_0808148C(super->type); + UpdateSpriteForCollisionLayer(super); } - ProcessMovement2(this); + ProcessMovement2(super); } } } -void sub_0808153C(Entity* this) { - if (this->field_0x68.HALF.LO > 1) +void sub_0808153C(ItemOnGroundEntity* this) { + if (this->unk_68 > 1) return; - if (this->field_0x68.HALF.LO == 0) { - if (!GravityUpdate(this, Q_8_8(16.0)) && !sub_0800442E(this)) { - this->field_0x68.HALF.LO = 1; - this->zVelocity = Q_16_16(1.875); - sub_0808148C(this->type); - UpdateSpriteForCollisionLayer(this); + if (this->unk_68 == 0) { + if (!GravityUpdate(super, Q_8_8(16.0)) && !sub_0800442E(super)) { + this->unk_68 = 1; + super->zVelocity = Q_16_16(1.875); + sub_0808148C(super->type); + UpdateSpriteForCollisionLayer(super); } } else { - if (!GravityUpdate(this, Q_8_8(40.0))) { - this->field_0x68.HALF.LO = 2; - sub_0808148C(this->type); + if (!GravityUpdate(super, Q_8_8(40.0))) { + this->unk_68 = 2; + sub_0808148C(super->type); } } } -void sub_08081598(Entity* this) { - if (this->health == 0) { +void sub_08081598(ItemOnGroundEntity* this) { + if (super->health == 0) { sub_08081404(this, 1); } - COLLISION_OFF(this); - this->action = 4; - this->timer = 14; - this->zVelocity = Q_16_16(2.0); - this->spriteSettings.draw = 1; - this->spritePriority.b1 = 2; - this->spritePriority.b0 = 3; - this->child = &gPlayerEntity; - CopyPosition(this->child, this); - this->z.HALF.HI -= 4; - if (this->type != 0x5F && sub_08081420(this)) { + COLLISION_OFF(super); + super->action = 4; + super->timer = 14; + super->zVelocity = Q_16_16(2.0); + super->spriteSettings.draw = 1; + super->spritePriority.b1 = 2; + super->spritePriority.b0 = 3; + super->child = &gPlayerEntity; + CopyPosition(super->child, super); + super->z.HALF.HI -= 4; + if (super->type != 0x5F && sub_08081420(this)) { sub_08081404(this, 1); } } diff --git a/src/object/jailBars.c b/src/object/jailBars.c index 9bdd2ca3..d7bb0d2d 100644 --- a/src/object/jailBars.c +++ b/src/object/jailBars.c @@ -4,6 +4,7 @@ * * @brief Jail Bars object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -11,56 +12,62 @@ #include "sound.h" #include "tiles.h" -static void SetJailBarTiles(Entity*, u32); -void JailBars_Init(Entity*); -void JailBars_Action1(Entity*); -void JailBars_Action2(Entity*); -void JailBars_Action3(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[30]; + /*0x86*/ u16 unk_86; +} JailBarsEntity; -void JailBars(Entity* this) { - static void (*const JailBars_Actions[])(Entity*) = { +static void SetJailBarTiles(JailBarsEntity* this, u32); +void JailBars_Init(JailBarsEntity* this); +void JailBars_Action1(JailBarsEntity* this); +void JailBars_Action2(JailBarsEntity* this); +void JailBars_Action3(JailBarsEntity* this); + +void JailBars(JailBarsEntity* this) { + static void (*const JailBars_Actions[])(JailBarsEntity*) = { JailBars_Init, JailBars_Action1, JailBars_Action2, JailBars_Action3, }; - JailBars_Actions[this->action](this); + JailBars_Actions[super->action](this); } -void JailBars_Init(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD) == 0) { - this->action = 1; +void JailBars_Init(JailBarsEntity* this) { + if (CheckFlags(this->unk_86) == 0) { + super->action = 1; SetJailBarTiles(this, 0); } else { - this->action = 3; - InitializeAnimation(this, 1); + super->action = 3; + InitializeAnimation(super, 1); SetJailBarTiles(this, 1); } - this->spriteSettings.draw = 3; // ??? - this->collisionLayer = 1; - UpdateSpriteForCollisionLayer(this); + super->spriteSettings.draw = 3; // ??? + super->collisionLayer = 1; + UpdateSpriteForCollisionLayer(super); } -void JailBars_Action1(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD) != 0) { - this->action = 2; +void JailBars_Action1(JailBarsEntity* this) { + if (CheckFlags(this->unk_86) != 0) { + super->action = 2; SetJailBarTiles(this, 1); SoundReq(SFX_10B); } } -void JailBars_Action2(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 3; - InitializeAnimation(this, 1); +void JailBars_Action2(JailBarsEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 3; + InitializeAnimation(super, 1); } } -void JailBars_Action3(Entity* this) { +void JailBars_Action3(JailBarsEntity* this) { } -static void SetJailBarTiles(Entity* this, u32 arg1) { +static void SetJailBarTiles(JailBarsEntity* this, u32 arg1) { static const s16 gUnk_08124960[] = { SPECIAL_META_TILE_35, -0x3, @@ -97,5 +104,5 @@ static void SetJailBarTiles(Entity* this, u32 arg1) { if (arg1 == 1) { puVar1 = gUnk_0812497A; } - SetMultipleTiles((const TileData*)puVar1, COORD_TO_TILE(this), 1); + SetMultipleTiles((const TileData*)puVar1, COORD_TO_TILE(super), 1); } diff --git a/src/object/japaneseSubtitle.c b/src/object/japaneseSubtitle.c index 5d66eb04..745b7b1a 100644 --- a/src/object/japaneseSubtitle.c +++ b/src/object/japaneseSubtitle.c @@ -21,14 +21,14 @@ void JapaneseSubtitle_Type3(Entity*); const u16 gUnk_08124B10[] = { 0x40, 0x58, 0x68, 0x80, 0x94, 0xA8, 0xB0, 0x0 }; void JapaneseSubtitle(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { + static void (*const JapaneseSubtitle_Types[])(Entity*) = { JapaneseSubtitle_Type0, JapaneseSubtitle_Type1, JapaneseSubtitle_Type2, JapaneseSubtitle_Type3, }; - typeFuncs[this->type]((Entity*)this); + JapaneseSubtitle_Types[this->type]((Entity*)this); } void JapaneseSubtitle_Type0(Entity* this) { diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index b0979864..28512994 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -4,120 +4,128 @@ * * @brief Jar Portal object */ +#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "object.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unused1[19]; + /*0x7c*/ u8 unk_7c; +} JarPortalEntity; + extern u32 PortalReadyForMinish(void); -u32 sub_0808C128(Entity*); -void sub_0808C13C(Entity*); -void JarPortal_Init(Entity*); -void JarPortal_Action1(Entity*); -void JarPortal_Action2(Entity*); -void JarPortal_Action3(Entity*); -void JarPortal_Action4(Entity*); -void sub_0808C148(Entity*, bool32); -void sub_0808C01C(Entity*, u32); +u32 sub_0808C128(JarPortalEntity* this); +void sub_0808C13C(JarPortalEntity* this); +void JarPortal_Init(JarPortalEntity* this); +void JarPortal_Action1(JarPortalEntity* this); +void JarPortal_Action2(JarPortalEntity* this); +void JarPortal_Action3(JarPortalEntity* this); +void JarPortal_Action4(JarPortalEntity* this); +void sub_0808C148(JarPortalEntity* this, bool32); +void sub_0808C01C(JarPortalEntity* this, u32); -void JarPortal(Entity* this) { - static void (*const JarPortal_Actions[])(Entity*) = { +void JarPortal(JarPortalEntity* this) { + static void (*const JarPortal_Actions[])(JarPortalEntity*) = { JarPortal_Init, JarPortal_Action1, JarPortal_Action2, JarPortal_Action3, JarPortal_Action4, }; - JarPortal_Actions[this->action](this); + JarPortal_Actions[super->action](this); } -void JarPortal_Init(Entity* this) { - COLLISION_ON(this); - this->hitType = 1; - this->collisionFlags = 0x47; - this->hurtType = 0x44; - this->flags2 = 0x80; - this->field_0x68.HALF.LO = 0; - if (CheckLocalFlag(this->type)) { - if (this->field_0x7c.BYTES.byte0 != 0) { - this->action = 1; - InitAnimationForceUpdate(this, 0); +void JarPortal_Init(JarPortalEntity* this) { + COLLISION_ON(super); + super->hitType = 1; + super->collisionFlags = 0x47; + super->hurtType = 0x44; + super->flags2 = 0x80; + this->unk_68 = 0; + if (CheckLocalFlag(super->type)) { + if (this->unk_7c != 0) { + super->action = 1; + InitAnimationForceUpdate(super, 0); } else { - this->action = 3; - InitAnimationForceUpdate(this, 1); + super->action = 3; + InitAnimationForceUpdate(super, 1); } } else { - if (this->field_0x7c.BYTES.byte0 == 0) { - this->action = 1; - InitAnimationForceUpdate(this, 0); + if (this->unk_7c == 0) { + super->action = 1; + InitAnimationForceUpdate(super, 0); } else { - this->action = 3; - InitAnimationForceUpdate(this, 1); + super->action = 3; + InitAnimationForceUpdate(super, 1); } } } -void JarPortal_Action1(Entity* this) { +void JarPortal_Action1(JarPortalEntity* this) { if (sub_0808C128(this)) { - this->action++; + super->action++; sub_0808C13C(this); - if (this->field_0x7c.BYTES.byte0 == 0) { - SetLocalFlag(this->type); + if (this->unk_7c == 0) { + SetLocalFlag(super->type); } else { - ClearLocalFlag(this->type); + ClearLocalFlag(super->type); } sub_0808C148(this, FALSE); } sub_0808C01C(this, 0); } -void JarPortal_Action2(Entity* this) { - GravityUpdate(this, Q_8_8(32.0)); - switch (this->subAction) { +void JarPortal_Action2(JarPortalEntity* this) { + GravityUpdate(super, Q_8_8(32.0)); + switch (super->subAction) { case 0: - if (this->zVelocity < Q_16_16(1.5)) { - ++this->subAction; - InitAnimationForceUpdate(this, 2); + if (super->zVelocity < Q_16_16(1.5)) { + ++super->subAction; + InitAnimationForceUpdate(super, 2); } break; case 1: - UpdateAnimationSingleFrame(this); - if (!this->z.HALF.HI) { - ++this->subAction; - this->zVelocity = Q_16_16(0.5); + UpdateAnimationSingleFrame(super); + if (!super->z.HALF.HI) { + ++super->subAction; + super->zVelocity = Q_16_16(0.5); } break; case 2: - UpdateAnimationSingleFrame(this); - if (!this->z.HALF.HI) { - ++this->action; - this->subtimer = 0; - InitAnimationForceUpdate(this, 1); + UpdateAnimationSingleFrame(super); + if (!super->z.HALF.HI) { + ++super->action; + super->subtimer = 0; + InitAnimationForceUpdate(super, 1); sub_0808C148(this, TRUE); } break; } } -void JarPortal_Action3(Entity* this) { +void JarPortal_Action3(JarPortalEntity* this) { if (sub_0808C128(this)) { - ++this->action; + ++super->action; sub_0808C13C(this); - if (!this->field_0x7c.BYTES.byte0) - ClearLocalFlag(this->type); + if (!this->unk_7c) + ClearLocalFlag(super->type); else - SetLocalFlag(this->type); + SetLocalFlag(super->type); sub_0808C148(this, FALSE); } sub_0808C01C(this, 1); } -void sub_0808C01C(Entity* this, u32 r1) { - if (CheckPlayerProximity(this->x.HALF.HI - 0x18, this->y.HALF.HI - 0x18, 0x30, 0x30)) { +void sub_0808C01C(JarPortalEntity* this, u32 r1) { + if (CheckPlayerProximity(super->x.HALF.HI - 0x18, super->y.HALF.HI - 0x18, 0x30, 0x30)) { u32 type; - gArea.portal_x = this->x.HALF.HI; - gArea.portal_y = this->y.HALF.HI; + gArea.portal_x = super->x.HALF.HI; + gArea.portal_y = super->y.HALF.HI; gArea.portal_exit_dir = 2; - type = 4; + type = PT_JAR; if (r1 != 0) - type = 2; + type = PT_2; gArea.portal_type = type; if (r1 == 1) { if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) { @@ -127,62 +135,62 @@ void sub_0808C01C(Entity* this, u32 r1) { gArea.portal_mode = 3; } } - CreateMagicSparkles(this->x.HALF.HI, this->y.HALF.HI, this->collisionLayer); - if (this->subtimer == 0) { - this->subtimer = 1; + CreateMagicSparkles(super->x.HALF.HI, super->y.HALF.HI, super->collisionLayer); + if (super->subtimer == 0) { + super->subtimer = 1; SoundReq(SFX_NEAR_PORTAL); } } } } -void JarPortal_Action4(Entity* this) { - GravityUpdate(this, Q_8_8(32.0)); - switch (this->subAction) { +void JarPortal_Action4(JarPortalEntity* this) { + GravityUpdate(super, Q_8_8(32.0)); + switch (super->subAction) { case 0: - if (this->zVelocity < Q_16_16(1.5)) { - this->subAction = 1; - InitAnimationForceUpdate(this, 3); + if (super->zVelocity < Q_16_16(1.5)) { + super->subAction = 1; + InitAnimationForceUpdate(super, 3); } break; case 1: - UpdateAnimationSingleFrame(this); - if (!this->z.HALF.HI) { - ++this->subAction; - this->zVelocity = Q_16_16(0.5); + UpdateAnimationSingleFrame(super); + if (!super->z.HALF.HI) { + ++super->subAction; + super->zVelocity = Q_16_16(0.5); } break; case 2: - UpdateAnimationSingleFrame(this); - if (!this->z.HALF.HI) { - this->action = 1; - InitAnimationForceUpdate(this, 0); + UpdateAnimationSingleFrame(super); + if (!super->z.HALF.HI) { + super->action = 1; + InitAnimationForceUpdate(super, 0); sub_0808C148(this, TRUE); } break; } } -u32 sub_0808C128(Entity* this) { - return this->contactFlags == 157; +u32 sub_0808C128(JarPortalEntity* this) { + return super->contactFlags == 157; } -void sub_0808C13C(Entity* this) { - this->subAction = 0; - this->zVelocity = Q_16_16(2.5); +void sub_0808C13C(JarPortalEntity* this) { + super->subAction = 0; + super->zVelocity = Q_16_16(2.5); } -void sub_0808C148(Entity* this, bool32 setTiles) { - u32 tilePos = COORD_TO_TILE(this); +void sub_0808C148(JarPortalEntity* this, bool32 setTiles) { + u32 tilePos = COORD_TO_TILE(super); if (!setTiles) { - SetMetaTile(SPECIAL_META_TILE_146, tilePos + TILE_POS(-1, 0), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_147, tilePos + TILE_POS(0, 0), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_148, tilePos + TILE_POS(-1, 1), this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_149, tilePos + TILE_POS(0, 1), this->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_146, tilePos + TILE_POS(-1, 0), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_147, tilePos + TILE_POS(0, 0), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_148, tilePos + TILE_POS(-1, 1), super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_149, tilePos + TILE_POS(0, 1), super->collisionLayer); } else { - RestorePrevTileEntity(tilePos + TILE_POS(-1, 0), this->collisionLayer); - RestorePrevTileEntity(tilePos + 0, this->collisionLayer); - RestorePrevTileEntity(tilePos + TILE_POS(-1, 1), this->collisionLayer); - RestorePrevTileEntity(tilePos + TILE_POS(0, 1), this->collisionLayer); + RestorePrevTileEntity(tilePos + TILE_POS(-1, 0), super->collisionLayer); + RestorePrevTileEntity(tilePos + 0, super->collisionLayer); + RestorePrevTileEntity(tilePos + TILE_POS(-1, 1), super->collisionLayer); + RestorePrevTileEntity(tilePos + TILE_POS(0, 1), super->collisionLayer); } } diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index 6e338810..98a0d543 100644 --- a/src/object/keyStealingTakkuri.c +++ b/src/object/keyStealingTakkuri.c @@ -4,10 +4,8 @@ * * @brief Key Stealing Takkuri object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { @@ -478,8 +476,8 @@ void sub_0809E1F0(KeyStealingTakkuriEntity* this) { } void sub_0809E210(KeyStealingTakkuriEntity* this) { - gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, super)) & 0xfe; - gPlayerState.animation = 0x100; + gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, super)) & 0xfe; + gPlayerState.animation = ANIM_DEFAULT; } void sub_0809E238(KeyStealingTakkuriEntity* this) { diff --git a/src/object/kinstoneSpark.c b/src/object/kinstoneSpark.c index dc8b5693..9591b100 100644 --- a/src/object/kinstoneSpark.c +++ b/src/object/kinstoneSpark.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "kinstone.h" #include "object.h" diff --git a/src/object/ladderHoleInBookshelf.c b/src/object/ladderHoleInBookshelf.c index dd55d741..9c856fe8 100644 --- a/src/object/ladderHoleInBookshelf.c +++ b/src/object/ladderHoleInBookshelf.c @@ -4,6 +4,7 @@ * * @brief Ladder Hole In Bookshelf object */ +#define NENT_DEPRECATED #include "entity.h" #include "player.h" diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c index d43324f1..4af652e7 100644 --- a/src/object/ladderUp.c +++ b/src/object/ladderUp.c @@ -4,6 +4,7 @@ * * @brief Ladder Up object */ +#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/lamp.c b/src/object/lamp.c index 1992f36a..705d43e5 100644 --- a/src/object/lamp.c +++ b/src/object/lamp.c @@ -4,6 +4,7 @@ * * @brief Lamp object */ +#define NENT_DEPRECATED #include "entity.h" void Lamp_Init(Entity* this); diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c index a79e8c4f..be968d08 100644 --- a/src/object/lavaPlatform.c +++ b/src/object/lavaPlatform.c @@ -4,10 +4,8 @@ * * @brief Lava Platform object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/lightDoor.c b/src/object/lightDoor.c index f6c6753a..3b99e841 100644 --- a/src/object/lightDoor.c +++ b/src/object/lightDoor.c @@ -4,7 +4,6 @@ * * @brief Light Door object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/lightRay.c b/src/object/lightRay.c index c1e58d1a..bd437bc6 100644 --- a/src/object/lightRay.c +++ b/src/object/lightRay.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" #include "screen.h" diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index 4a1abf7c..9117cfe8 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -4,6 +4,7 @@ * * @brief Lightable Switch object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" @@ -14,154 +15,163 @@ #include "sound.h" #include "tiles.h" -static void sub_0809EB30(Entity*); -static void sub_0809EAD8(Entity*); -static void sub_0809EABC(Entity*); -static void LightableSwitch_Type0(Entity*); -static void LightableSwitch_Type1(Entity*); -static void LightableSwitch_Type0_Init(Entity*); -static void LightableSwitch_Type0_Action1(Entity*); -static void LightableSwitch_Type1_Action3(Entity*); -static void LightableSwitch_Type1_Action2(Entity*); -static void LightableSwitch_Type1_Action1(Entity*); -static void LightableSwitch_Type1_Init(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u8 unused2[14]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} LightableSwitchEntity; -void LightableSwitch(Entity* this) { - static void (*const LightableSwitch_Types[])(Entity*) = { +static void sub_0809EB30(LightableSwitchEntity* this); +static void sub_0809EAD8(LightableSwitchEntity* this); +static void sub_0809EABC(LightableSwitchEntity* this); +static void LightableSwitch_Type0(LightableSwitchEntity* this); +static void LightableSwitch_Type1(LightableSwitchEntity* this); +static void LightableSwitch_Type0_Init(LightableSwitchEntity* this); +static void LightableSwitch_Type0_Action1(LightableSwitchEntity* this); +static void LightableSwitch_Type1_Action3(LightableSwitchEntity* this); +static void LightableSwitch_Type1_Action2(LightableSwitchEntity* this); +static void LightableSwitch_Type1_Action1(LightableSwitchEntity* this); +static void LightableSwitch_Type1_Init(LightableSwitchEntity* this); + +void LightableSwitch(LightableSwitchEntity* this) { + static void (*const LightableSwitch_Types[])(LightableSwitchEntity*) = { LightableSwitch_Type0, LightableSwitch_Type1, }; - LightableSwitch_Types[this->type](this); + LightableSwitch_Types[super->type](this); sub_0809EB30(this); } -void LightableSwitch_Type0(Entity* this) { - static void (*const LightableSwitch_Type0_Actions[])(Entity*) = { +void LightableSwitch_Type0(LightableSwitchEntity* this) { + static void (*const LightableSwitch_Type0_Actions[])(LightableSwitchEntity*) = { LightableSwitch_Type0_Init, LightableSwitch_Type0_Action1, }; - LightableSwitch_Type0_Actions[this->action](this); + LightableSwitch_Type0_Actions[super->action](this); } -void LightableSwitch_Type0_Init(Entity* this) { - this->action = 1; - COLLISION_ON(this); - this->frameIndex = 0; - this->collisionFlags = 7; - this->hurtType = 0x48; - this->hitType = 0x28; - this->flags2 = 10; - this->hitbox = (Hitbox*)&gHitbox_0; +void LightableSwitch_Type0_Init(LightableSwitchEntity* this) { + super->action = 1; + COLLISION_ON(super); + super->frameIndex = 0; + super->collisionFlags = 7; + super->hurtType = 0x48; + super->hitType = 0x28; + super->flags2 = 10; + super->hitbox = (Hitbox*)&gHitbox_0; sub_0809EAD8(this); - UpdateSpriteForCollisionLayer(this); + UpdateSpriteForCollisionLayer(super); sub_0809EABC(this); } -void LightableSwitch_Type0_Action1(Entity* this) { +void LightableSwitch_Type0_Action1(LightableSwitchEntity* this) { - if ((this->contactFlags & 0x80) != 0) { - if (CheckFlags(this->field_0x86.HWORD) != 0) { - ClearFlag(this->field_0x86.HWORD); + if ((super->contactFlags & 0x80) != 0) { + if (CheckFlags(this->unk_86) != 0) { + ClearFlag(this->unk_86); } else { - SetFlag(this->field_0x86.HWORD); + SetFlag(this->unk_86); } EnqueueSFX(SFX_110); } sub_0809EABC(this); } -static void sub_0809EABC(Entity* this) { +static void sub_0809EABC(LightableSwitchEntity* this) { bool32 anySet = 0; - if (CheckFlags(this->field_0x86.HWORD)) { + if (CheckFlags(this->unk_86)) { anySet = 1; } - if (this->frameIndex != anySet) { - this->frameIndex = anySet; + if (super->frameIndex != anySet) { + super->frameIndex = anySet; } } -static void sub_0809EAD8(Entity* this) { +static void sub_0809EAD8(LightableSwitchEntity* this) { u8 bVar1; Entity* pEVar2; - if (this->type2 != 0) { + if (super->type2 != 0) { - this->child = GetCurrentRoomProperty(this->type2); - UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); + super->child = GetCurrentRoomProperty(super->type2); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); } else { - SetMetaTile(SPECIAL_META_TILE_80, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_80, COORD_TO_TILE(super), super->collisionLayer); } } -static void sub_0809EB30(Entity* this) { +static void sub_0809EB30(LightableSwitchEntity* this) { u16 uVar1; u16* puVar2; - if (this->type2 != 0) { - if ((this->direction & 0x80) == 0) { - LinearMoveUpdate(this); + if (super->type2 != 0) { + if ((super->direction & 0x80) == 0) { + LinearMoveUpdate(super); } - puVar2 = &this->field_0x74.HWORD; + puVar2 = &this->unk_74; if (!--*puVar2) { - UpdateRailMovement(this, (u16**)&this->child, puVar2); + UpdateRailMovement(super, (u16**)&super->child, puVar2); } } } -void LightableSwitch_Type1(Entity* this) { - static void (*const LightableSwitch_Type1_Actions[])(Entity*) = { +void LightableSwitch_Type1(LightableSwitchEntity* this) { + static void (*const LightableSwitch_Type1_Actions[])(LightableSwitchEntity*) = { LightableSwitch_Type1_Init, LightableSwitch_Type1_Action1, LightableSwitch_Type1_Action2, LightableSwitch_Type1_Action3, }; - LightableSwitch_Type1_Actions[this->action](this); + LightableSwitch_Type1_Actions[super->action](this); } -void LightableSwitch_Type1_Init(Entity* this) { +void LightableSwitch_Type1_Init(LightableSwitchEntity* this) { - this->action = 1; - COLLISION_ON(this); - this->frameIndex = 3; - this->collisionFlags = 7; - this->hurtType = 0x48; - this->hitType = 0x28; - this->flags2 = 10; - this->hitbox = (Hitbox*)&gHitbox_0; + super->action = 1; + COLLISION_ON(super); + super->frameIndex = 3; + super->collisionFlags = 7; + super->hurtType = 0x48; + super->hitType = 0x28; + super->flags2 = 10; + super->hitbox = (Hitbox*)&gHitbox_0; sub_0809EAD8(this); - UpdateSpriteForCollisionLayer(this); - if (CheckFlags(this->cutsceneBeh.HWORD) != 0) { - this->action = 3; - this->frameIndex = 2; + UpdateSpriteForCollisionLayer(super); + if (CheckFlags(this->unk_84)) { + super->action = 3; + super->frameIndex = 2; } } -void LightableSwitch_Type1_Action1(Entity* this) { - if ((this->contactFlags & 0x80) != 0) { - this->action = 2; - this->timer = 16; - this->frameIndex = 2; - SetFlag(this->field_0x86.HWORD); +void LightableSwitch_Type1_Action1(LightableSwitchEntity* this) { + if ((super->contactFlags & 0x80) != 0) { + super->action = 2; + super->timer = 16; + super->frameIndex = 2; + SetFlag(this->unk_86); EnqueueSFX(SFX_110); } } -void LightableSwitch_Type1_Action2(Entity* this) { +void LightableSwitch_Type1_Action2(LightableSwitchEntity* this) { - if (CheckFlags(this->cutsceneBeh.HWORD) != 0) { - this->action = 3; + if (CheckFlags(this->unk_84)) { + super->action = 3; } else { - if (--this->timer == 0) { - this->action = 1; - this->frameIndex = 3; - ClearFlag(this->field_0x86.HWORD); + if (--super->timer == 0) { + super->action = 1; + super->frameIndex = 3; + ClearFlag(this->unk_86); EnqueueSFX(SFX_110); } } } -void LightableSwitch_Type1_Action3(Entity* this) { +void LightableSwitch_Type1_Action3(LightableSwitchEntity* this) { } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 74289d3d..d14f20b4 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -1,10 +1,11 @@ -#define NENT_DEPRECATED /** * @file lilypadLarge.c * @ingroup Objects * * @brief Large Lilypad object */ +#define NENT_DEPRECATED +#include "object/lilypadLarge.h" #include "area.h" #include "functions.h" #include "item.h" @@ -12,51 +13,37 @@ #include "map.h" #include "tiles.h" -typedef struct { - Entity base; - u8 unk_68[4]; - s32 unk_6c; - s32 unk_70; - s16 unk_74; - s16 unk_76; - union SplitWord unk_78; - union SplitWord unk_7c; - u8 unk_80[2]; - u16 unk_82; - u8 unk_84; - u8 unk_85; -} LilypadLargeEntity; - extern s8 gUnk_08126EE4[]; -void sub_080855E8(LilypadLargeEntity*); -void sub_08085CDC(LilypadLargeEntity*); +void LilypadLarge_Action1(LilypadLargeEntity*); +void LilypadLarge_Action4(LilypadLargeEntity*); void sub_08085EFC(LilypadLargeEntity*); void sub_08085F1C(LilypadLargeEntity*); void sub_08085E74(LilypadLargeEntity*); void sub_08085F48(LilypadLargeEntity*); void sub_08085D28(LilypadLargeEntity*); void sub_08085D60(LilypadLargeEntity*); -void sub_08085504(LilypadLargeEntity*); -void sub_080855E8(LilypadLargeEntity*); -void sub_08085A1C(LilypadLargeEntity*); -void sub_08085C5C(LilypadLargeEntity*); -void sub_08085CDC(LilypadLargeEntity*); -void sub_08085D10(LilypadLargeEntity*); +void LilypadLarge_Init(LilypadLargeEntity*); +void LilypadLarge_Action1(LilypadLargeEntity*); +void LilypadLarge_Action2(LilypadLargeEntity*); +void LilypadLarge_Action3(LilypadLargeEntity*); +void LilypadLarge_Action4(LilypadLargeEntity*); +void LilypadLarge_Action5(LilypadLargeEntity*); void sub_08085B40(LilypadLargeEntity*); void sub_08085A98(LilypadLargeEntity*); void sub_08085A44(LilypadLargeEntity*); void LilypadLarge(LilypadLargeEntity* this) { - static void (*const actionFuncs[])(LilypadLargeEntity*) = { - sub_08085504, sub_080855E8, sub_08085A1C, sub_08085C5C, sub_08085CDC, sub_08085D10, + static void (*const LilypadLarge_actions[])(LilypadLargeEntity*) = { + LilypadLarge_Init, LilypadLarge_Action1, LilypadLarge_Action2, + LilypadLarge_Action3, LilypadLarge_Action4, LilypadLarge_Action5, }; - actionFuncs[super->action](this); + LilypadLarge_actions[super->action](this); } static const Hitbox gUnk_08120640; -void sub_08085504(LilypadLargeEntity* this) { +void LilypadLarge_Init(LilypadLargeEntity* this) { if (super->type == 0xff) { if (GetInventoryValue(ITEM_FLIPPERS)) { DeleteThisEntity(); @@ -98,10 +85,10 @@ void sub_08085504(LilypadLargeEntity* this) { this->unk_85 = 0; this->unk_84 = 0; InitializeAnimation(super, 9); - sub_080855E8(this); + LilypadLarge_Action1(this); } -void sub_080855E8(LilypadLargeEntity* this) { +void LilypadLarge_Action1(LilypadLargeEntity* this) { static const u32 gUnk_08120620[] = { 0x5000, 0x18000, @@ -332,7 +319,7 @@ void sub_080855E8(LilypadLargeEntity* this) { sub_08085F48(this); } -void sub_08085A1C(LilypadLargeEntity* this) { +void LilypadLarge_Action2(LilypadLargeEntity* this) { static void (*const subActionFuncs[])(LilypadLargeEntity*) = { sub_08085A44, sub_08085A98, @@ -404,7 +391,7 @@ void sub_08085B40(LilypadLargeEntity* this) { ResetCollisionLayer(super); if (GetVvvAtEntity(super) == VVV_13) { ResetCollisionLayer(&gPlayerEntity); - sub_08085CDC(this); + LilypadLarge_Action4(this); super->direction = GetFacingDirection(&gPlayerEntity, super); LinearMoveDirection(&gPlayerEntity, 0x100, super->direction); } @@ -433,7 +420,7 @@ void sub_08085B40(LilypadLargeEntity* this) { } } -void sub_08085C5C(LilypadLargeEntity* this) { +void LilypadLarge_Action3(LilypadLargeEntity* this) { if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) { LinearMoveUpdate(super); gPlayerEntity.speed = super->speed; @@ -454,7 +441,7 @@ void sub_08085C5C(LilypadLargeEntity* this) { } } -void sub_08085CDC(LilypadLargeEntity* this) { +void LilypadLarge_Action4(LilypadLargeEntity* this) { this->unk_78.WORD += 0x100000; if (this->unk_78.WORD_U < 0x4000000) { SetAffineInfo(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI); @@ -463,7 +450,7 @@ void sub_08085CDC(LilypadLargeEntity* this) { } } -void sub_08085D10(LilypadLargeEntity* this) { +void LilypadLarge_Action5(LilypadLargeEntity* this) { if (EntityHasDuplicateID(super) != 0) { SetLocalFlag(super->type2); DeleteThisEntity(); @@ -566,7 +553,7 @@ void sub_08085E74(LilypadLargeEntity* this) { gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; gPlayerEntity.direction = super->direction; - gPlayerState.animation = 0x100; + gPlayerState.animation = ANIM_DEFAULT; gRoomControls.camera_target = super; if (gPlayerState.item != NULL) { DeleteEntity(gPlayerState.item); diff --git a/src/object/lilypadLargeFalling.c b/src/object/lilypadLargeFalling.c index 4a918c59..e32b0f88 100644 --- a/src/object/lilypadLargeFalling.c +++ b/src/object/lilypadLargeFalling.c @@ -4,9 +4,10 @@ * * @brief LilypadLargeFalling object */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" -#include "global.h" +#include "object/lilypadLarge.h" void LilypadLargeFalling(Entity* this) { Entity* parent; @@ -22,7 +23,7 @@ void LilypadLargeFalling(Entity* this) { if (parent->z.WORD == 0) { DeleteThisEntity(); } else { - int position = 0x120 - parent->z.HALF.HI; - SetAffineInfo(this, position, position, parent->field_0x7c.HALF_U.HI); + s32 position = 0x120 - parent->z.HALF.HI; + SetAffineInfo(this, position, position, ((LilypadLargeEntity*)parent)->unk_7c.HALF_U.HI); } } diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index d017b1d9..1d84c392 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -4,39 +4,46 @@ * * @brief Lilypad Small object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" -static void sub_08097B24(Entity* this); -static bool32 CheckMovePlayer(Entity* this); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; +} LilypadSmallEntity; -void LilypadSmall(Entity* this) { +static void sub_08097B24(LilypadSmallEntity* this); +static bool32 CheckMovePlayer(LilypadSmallEntity* this); + +void LilypadSmall(LilypadSmallEntity* this) { u32 rand; u16* psVar4; - if (this->action == 0) { - this->action = 1; - this->timer = 90; + if (super->action == 0) { + super->action = 1; + super->timer = 90; rand = Random(); - this->subtimer = rand; - this->frameIndex = (rand >> 0x10) & 3; - this->spriteSettings.draw = TRUE; - this->spritePriority.b0 = 7; - this->child = GetCurrentRoomProperty(this->type2); - UpdateRailMovement(this, (u16**)&this->child, &this->field_0x70.HALF.LO); + super->subtimer = rand; + super->frameIndex = (rand >> 0x10) & 3; + super->spriteSettings.draw = TRUE; + super->spritePriority.b0 = 7; + super->child = GetCurrentRoomProperty(super->type2); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_70); } - SyncPlayerToPlatform(this, CheckMovePlayer(this)); + SyncPlayerToPlatform(super, CheckMovePlayer(this)); sub_08097B24(this); - psVar4 = (u16*)&this->field_0x70; + psVar4 = &this->unk_70; if (--*psVar4 == 0) { - UpdateRailMovement(this, (u16**)&this->child, psVar4); + UpdateRailMovement(super, (u16**)&super->child, psVar4); } } -static bool32 CheckMovePlayer(Entity* this) { +static bool32 CheckMovePlayer(LilypadSmallEntity* this) { if (!(gPlayerState.flags & PL_MINISH)) { return FALSE; - } else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) { + } else if (EntityInRectRadius(super, &gPlayerEntity, 8, 8) == 0) { return FALSE; } else if (!PlayerCanBeMoved()) { return FALSE; @@ -50,7 +57,7 @@ static bool32 CheckMovePlayer(Entity* this) { } } -static void sub_08097B24(Entity* this) { +static void sub_08097B24(LilypadSmallEntity* this) { static const u16 gUnk_08123318[] = { 0x100, 0x101, 0x102, 0x101, 0x100, 0xff, 0xfe, 0xff, }; @@ -58,13 +65,13 @@ static void sub_08097B24(Entity* this) { u32 temp2; const u16* temp3; - if (--this->timer == 0) { - this->timer = 90; - this->frameIndex = (this->frameIndex + 1) & 3; + if (--super->timer == 0) { + super->timer = 90; + super->frameIndex = (super->frameIndex + 1) & 3; } temp3 = gUnk_08123318; - temp2 = ++this->subtimer; + temp2 = ++super->subtimer; temp = temp3[(temp2 >> 5) & 7]; - SetAffineInfo(this, temp, temp, 0); + SetAffineInfo(super, temp, temp, 0); } diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index 7d5d2cae..8a9d361d 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "message.h" #include "object.h" diff --git a/src/object/linkEmptyingBottle.c b/src/object/linkEmptyingBottle.c index 822df4e5..59326cfb 100644 --- a/src/object/linkEmptyingBottle.c +++ b/src/object/linkEmptyingBottle.c @@ -5,7 +5,6 @@ * @brief Link Emptying Bottle object * Handles effects of using water, mineral water or a fairy in a bottle in PlayerItemBottle_UseOther. */ - #define NENT_DEPRECATED #include "functions.h" #include "item.h" @@ -19,20 +18,20 @@ typedef struct { extern u32 sub_080B1A0C(Entity*, s32, s32); -void sub_08094774(LinkEmptyingBottleEntity*); -void sub_080948D0(LinkEmptyingBottleEntity*); +void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity*); +void LinkEmptyingBottle_Action1(LinkEmptyingBottleEntity*); void sub_080948E8(LinkEmptyingBottleEntity*); void sub_08094980(LinkEmptyingBottleEntity*, u32, u32); void LinkEmptyingBottle(LinkEmptyingBottleEntity* this) { - static void (*const gUnk_08122A10[])(LinkEmptyingBottleEntity*) = { - sub_08094774, - sub_080948D0, + static void (*const LinkEmptyingBottle_Actions[])(LinkEmptyingBottleEntity*) = { + LinkEmptyingBottle_Init, + LinkEmptyingBottle_Action1, }; - gUnk_08122A10[super->action](this); + LinkEmptyingBottle_Actions[super->action](this); } -void sub_08094774(LinkEmptyingBottleEntity* this) { +void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity* this) { static const s8 gUnk_08122A18[] = { 0, -8, 8, 1, 2, 8, -8, 1 }; Entity* effect; Entity* child; @@ -79,7 +78,7 @@ void sub_08094774(LinkEmptyingBottleEntity* this) { DeleteThisEntity(); } -void sub_080948D0(LinkEmptyingBottleEntity* this) { +void LinkEmptyingBottle_Action1(LinkEmptyingBottleEntity* this) { static void (*const gUnk_08122A20[])(LinkEmptyingBottleEntity*) = { NULL, sub_080948E8, diff --git a/src/object/linkFire.c b/src/object/linkFire.c index c67b6c45..7a5b4292 100644 --- a/src/object/linkFire.c +++ b/src/object/linkFire.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/linkHoldingItem.c b/src/object/linkHoldingItem.c index 61982614..ae982637 100644 --- a/src/object/linkHoldingItem.c +++ b/src/object/linkHoldingItem.c @@ -7,7 +7,6 @@ #define NENT_DEPRECATED #include "functions.h" #include "game.h" -#include "global.h" #include "item.h" #include "itemMetaData.h" #include "message.h" diff --git a/src/object/litArea.c b/src/object/litArea.c index b615672c..8d39ddf1 100644 --- a/src/object/litArea.c +++ b/src/object/litArea.c @@ -4,46 +4,55 @@ * * @brief Lit Area object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" #include "room.h" #include "screen.h" -void LitArea(Entity* this) { - if (this->action == 0) { - if (this->field_0x86.HWORD != 0 && CheckFlags(this->field_0x86.HWORD) == 0) { +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u16 unk_6a; + /*0x6c*/ u8 unused1[26]; + /*0x86*/ u16 unk_86; +} LitAreaEntity; + +void LitArea(LitAreaEntity* this) { + if (super->action == 0) { + if (this->unk_86 != 0 && CheckFlags(this->unk_86) == 0) { return; } - this->spriteSettings.draw = 1; - this->action = 1; - this->spriteRendering.alphaBlend = 2; - this->spriteRendering.b0 = 3; - this->frameIndex = 3; - this->flags |= ENT_PERSIST; - this->subtimer = gRoomControls.room; - this->timer = 2; - this->field_0x68.HWORD = -2; - this->field_0x6a.HWORD = 0x80; - SetAffineInfo(this, 0x80, 0x80, 0); + super->spriteSettings.draw = 1; + super->action = 1; + super->spriteRendering.alphaBlend = 2; + super->spriteRendering.b0 = 3; + super->frameIndex = 3; + super->flags |= ENT_PERSIST; + super->subtimer = gRoomControls.room; + super->timer = 2; + this->unk_68 = -2; + this->unk_6a = 0x80; + SetAffineInfo(super, 0x80, 0x80, 0); } else { - if (--this->timer == 0) { - this->timer = 2; - this->field_0x6a.HWORD += this->field_0x68.HWORD; - if (this->field_0x6a.HWORD < 0x78) { - this->field_0x68.HWORD = 1; + if (--super->timer == 0) { + super->timer = 2; + this->unk_6a += this->unk_68; + if (this->unk_6a < 0x78) { + this->unk_68 = 1; } - if (0x88 < this->field_0x6a.HWORD) { - this->field_0x68.HWORD = -1; + if (this->unk_6a > 0x88) { + this->unk_68 = -1; } - SetAffineInfo(this, this->field_0x6a.HWORD, this->field_0x6a.HWORD, 0); + SetAffineInfo(super, this->unk_6a, this->unk_6a, 0); } } gScreen.lcd.displayControl |= DISPCNT_OBJWIN_ON; gScreen.controls.windowOutsideControl = (gScreen.controls.windowOutsideControl & 0xff) | WINOUT_WINOBJ_BG0 | WINOUT_WINOBJ_BG1 | WINOUT_WINOBJ_BG2 | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR; - if ((gRoomControls.room != this->subtimer) && (gRoomControls.reload_flags == 0)) { + if ((gRoomControls.room != super->subtimer) && (gRoomControls.reload_flags == 0)) { DeleteThisEntity(); } } diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index df974c99..501b39ed 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -4,6 +4,7 @@ * * @brief Looked Door object */ +#define NENT_DEPRECATED #include "asm.h" #include "common.h" #include "effects.h" @@ -15,31 +16,45 @@ #include "sound.h" #include "tiles.h" -void LockedDoor_Init(Entity*); -void LockedDoor_Action1(Entity*); -void LockedDoor_Action2(Entity*); -void LockedDoor_Action3(Entity*); -void LockedDoor_Action4(Entity*); -void LockedDoor_Action5(Entity*); -void LockedDoor_Action6(Entity*); -void LockedDoor_Action7(Entity*); -void LockedDoor_Action8(Entity*); -void sub_08083638(Entity*); -void sub_08083658(Entity*); -void sub_080836A0(Entity*); -void sub_080836DC(Entity*, u32, u32); -u32 sub_08083734(Entity*, u32); -u32 sub_080837B0(Entity*); -void sub_08083814(Entity*, u32); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u16 unk_72; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u8 unused2[6]; + /*0x7e*/ u8 unk_7e; + /*0x7f*/ u8 unused3[5]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} LockedDoorEntity; -void (*const LockedDoor_Actions[])(Entity*) = { +void LockedDoor_Init(LockedDoorEntity* this); +void LockedDoor_Action1(LockedDoorEntity* this); +void LockedDoor_Action2(LockedDoorEntity* this); +void LockedDoor_Action3(LockedDoorEntity* this); +void LockedDoor_Action4(LockedDoorEntity* this); +void LockedDoor_Action5(LockedDoorEntity* this); +void LockedDoor_Action6(LockedDoorEntity* this); +void LockedDoor_Action7(LockedDoorEntity* this); +void LockedDoor_Action8(LockedDoorEntity* this); + +void sub_08083638(LockedDoorEntity* this); +void sub_08083658(LockedDoorEntity* this); +void sub_080836A0(LockedDoorEntity* this); +void sub_080836DC(Entity* this, u32, u32); +u32 sub_080837B0(LockedDoorEntity* this); +void sub_08083814(LockedDoorEntity* this, u32); + +void (*const LockedDoor_Actions[])(LockedDoorEntity*) = { LockedDoor_Init, LockedDoor_Action1, LockedDoor_Action2, LockedDoor_Action3, LockedDoor_Action4, LockedDoor_Action5, LockedDoor_Action6, LockedDoor_Action7, LockedDoor_Action8, }; -void LockedDoor(Entity* this) { - LockedDoor_Actions[this->action](this); +void LockedDoor(LockedDoorEntity* this) { + LockedDoor_Actions[super->action](this); } typedef struct PACKED { @@ -88,54 +103,53 @@ const u8 gLockedDoorInteractDirections[] = { 0xD7, }; -void LockedDoor_Init(Entity* this) { - if (this->cutsceneBeh.HWORD != 0xFFFF && CheckFlags(this->cutsceneBeh.HWORD)) { +void LockedDoor_Init(LockedDoorEntity* this) { + if (this->unk_84 != 0xFFFF && CheckFlags(this->unk_84)) { DeleteThisEntity(); } if (!sub_080837B0(this)) return; - this->type2 = (this->type >> 2) & 3; - this->frameIndex = this->type & 3; - this->speed = 0x300; - this->field_0x70.HALF.LO = this->x.HALF.HI; - this->field_0x70.HALF.HI = this->y.HALF.HI; - this->field_0x7c.BYTES.byte2 = this->type & 3; - this->hitbox = (Hitbox*)&gHitbox_2; - this->spritePriority.b0 = 5; - this->frame = this->type & 0xF; - this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - this->field_0x74.HWORD = GetMetaTileIndex(this->field_0x76.HWORD, this->collisionLayer); - switch (this->type2) { + super->type2 = (super->type >> 2) & 3; + super->frameIndex = super->type & 3; + super->speed = 0x300; + this->unk_70 = super->x.HALF.HI; + this->unk_72 = super->y.HALF.HI; + this->unk_7e = super->type & 3; + super->hitbox = (Hitbox*)&gHitbox_2; + super->spritePriority.b0 = 5; + super->frame = super->type & 0xF; + this->unk_76 = TILE(super->x.HALF.HI, super->y.HALF.HI); + this->unk_74 = GetMetaTileIndex(this->unk_76, super->collisionLayer); + switch (super->type2) { case 0: - if (!CheckFlags(this->field_0x86.HWORD)) { - if (this->type & 0x10) { - this->action = 3; + if (!CheckFlags(this->unk_86)) { + if (super->type & 0x10) { + super->action = 3; } else { sub_080836A0(this); } } else { - this->type &= ~0x10; + super->type &= ~0x10; sub_08083638(this); } break; case 1: - if (!CheckFlags(this->field_0x86.HWORD)) { + if (!CheckFlags(this->unk_86)) { sub_08083638(this); } else { sub_080836A0(this); } break; case 2: - if (!CheckFlags(this->field_0x86.HWORD)) { - this->frameIndex |= 4; - sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD); + if (!CheckFlags(this->unk_86)) { + super->frameIndex |= 4; + sub_080836DC(super, this->unk_7e, this->unk_76); if (!AreaIsDungeon()) { - this->action = 5; + super->action = 5; } else { - this->action = 8; - AddInteractableSmallKeyLock(this); - SetInteractableObjectCollision(this, 0, gLockedDoorInteractDirections[this->field_0x7c.BYTES.byte2], - NULL); + super->action = 8; + AddInteractableSmallKeyLock(super); + SetInteractableObjectCollision(super, 0, gLockedDoorInteractDirections[this->unk_7e], NULL); } } else { DeleteThisEntity(); @@ -147,19 +161,19 @@ void LockedDoor_Init(Entity* this) { } } -void LockedDoor_Action1(Entity* this) { - if (--this->timer == 0) { - this->action = 2; - this->timer = 7; - SetMetaTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer); +void LockedDoor_Action1(LockedDoorEntity* this) { + if (--super->timer == 0) { + super->action = 2; + super->timer = 7; + SetMetaTile(this->unk_74, this->unk_76, super->collisionLayer); EnqueueSFX(SFX_10B); } } -void LockedDoor_Action2(Entity* this) { - LinearMoveUpdate(this); - if (--this->timer == 0) { - if (this->type & 0x80) { +void LockedDoor_Action2(LockedDoorEntity* this) { + LinearMoveUpdate(super); + if (--super->timer == 0) { + if (super->type & 0x80) { sub_08083638(this); } else { DeleteThisEntity(); @@ -167,91 +181,91 @@ void LockedDoor_Action2(Entity* this) { } } -void LockedDoor_Action3(Entity* this) { - if (sub_08083734(this, this->field_0x7c.BYTES.byte2)) { - this->action = 4; - sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD); +void LockedDoor_Action3(LockedDoorEntity* this) { + if (sub_08083734(super, this->unk_7e)) { + super->action = 4; + sub_080836DC(super, this->unk_7e, this->unk_76); } } -void LockedDoor_Action4(Entity* this) { - LinearMoveUpdate(this); - if (!--this->timer) { - if (this->type & 0x10) { - this->type &= ~0x10; +void LockedDoor_Action4(LockedDoorEntity* this) { + LinearMoveUpdate(super); + if (!--super->timer) { + if (super->type & 0x10) { + super->type &= ~0x10; sub_080836A0(this); } else { - if (this->type & 0x80) { + if (super->type & 0x80) { sub_080836A0(this); } else { - this->action = 5; + super->action = 5; } } - sub_08083814(this, this->field_0x7c.BYTES.byte2); + sub_08083814(this, this->unk_7e); EnqueueSFX(SFX_10B); } } -void LockedDoor_Action5(Entity* this) { +void LockedDoor_Action5(LockedDoorEntity* this) { } -void LockedDoor_Action6(Entity* this) { - if (this->type2 == 0) { - if (!CheckFlags(this->field_0x86.HWORD)) +void LockedDoor_Action6(LockedDoorEntity* this) { + if (super->type2 == 0) { + if (!CheckFlags(this->unk_86)) return; } else { - if (CheckFlags(this->field_0x86.HWORD)) + if (CheckFlags(this->unk_86)) return; } sub_08083658(this); } -void LockedDoor_Action7(Entity* this) { - if (this->type2 == 0) { - if (CheckFlags(this->field_0x86.HWORD)) +void LockedDoor_Action7(LockedDoorEntity* this) { + if (super->type2 == 0) { + if (CheckFlags(this->unk_86)) return; } else { - if (!CheckFlags(this->field_0x86.HWORD)) + if (!CheckFlags(this->unk_86)) return; } - this->action = 3; + super->action = 3; } -void LockedDoor_Action8(Entity* this) { - if (this->interactType == 0 && !CheckFlags(this->field_0x86.HWORD)) +void LockedDoor_Action8(LockedDoorEntity* this) { + if (super->interactType == INTERACTION_NONE && !CheckFlags(this->unk_86)) return; - this->action = 1; - this->timer = 20; + super->action = 1; + super->timer = 20; sub_08083658(this); - SetFlag(this->field_0x86.HWORD); + SetFlag(this->unk_86); ModDungeonKeys(-1); } -void sub_08083638(Entity* this) { - this->action = 7; - this->spriteSettings.draw = 0; - this->x.HALF.HI = this->field_0x70.HALF.LO; - this->y.HALF.HI = this->field_0x70.HALF.HI; +void sub_08083638(LockedDoorEntity* this) { + super->action = 7; + super->spriteSettings.draw = 0; + super->x.HALF.HI = this->unk_70; + super->y.HALF.HI = this->unk_72; } -void sub_08083658(Entity* this) { +void sub_08083658(LockedDoorEntity* this) { const struct_0811F680* tmp; - this->action = 1; - this->timer = 20; - this->direction = this->field_0x7c.BYTES.byte2 << 3; - tmp = &gUnk_0811F680[this->field_0x7c.BYTES.byte2]; - this->x.HALF.HI += tmp->x; - this->y.HALF.HI += tmp->y; - RequestPriorityDuration(this, 60); + super->action = 1; + super->timer = 20; + super->direction = this->unk_7e << 3; + tmp = &gUnk_0811F680[this->unk_7e]; + super->x.HALF.HI += tmp->x; + super->y.HALF.HI += tmp->y; + RequestPriorityDuration(super, 60); SoundReq(SFX_10B); } -void sub_080836A0(Entity* this) { - this->action = 6; - this->spriteSettings.draw = 1; - this->x.HALF.HI = this->field_0x70.HALF.LO; - this->y.HALF.HI = this->field_0x70.HALF.HI; - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x76.HWORD, this->collisionLayer); +void sub_080836A0(LockedDoorEntity* this) { + super->action = 6; + super->spriteSettings.draw = 1; + super->x.HALF.HI = this->unk_70; + super->y.HALF.HI = this->unk_72; + SetMetaTile(SPECIAL_META_TILE_34, this->unk_76, super->collisionLayer); } void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { @@ -259,7 +273,7 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { SetMetaTile(SPECIAL_META_TILE_34, unk_1, this->collisionLayer); this->timer = 7; this->spriteSettings.draw = 1; - this->direction = (unk_0 << 3) ^ 0x10; + this->direction = (unk_0 << 3) ^ DirectionSouth; tmp = &gUnk_0811F688[unk_0]; if (this->type2 != 2) { this->x.HALF.HI += tmp->x; @@ -268,28 +282,30 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { } u32 sub_08083734(Entity* this, u32 unk0) { + // TODO this is used in bossDoor, carlovObject, lockedDoor, metalDoor and minecartDoor. Do they have the same entity + // struct? switch (unk0) { case 0: - if (this->field_0x70.HALF_U.HI + 0xd - gPlayerEntity.y.HALF.HI < 0) + if (((LockedDoorEntity*)this)->unk_72 + 0xd - gPlayerEntity.y.HALF.HI < 0) return 1; break; case 1: - if (gPlayerEntity.x.HALF.HI - (this->field_0x70.HALF_U.LO - 0xb) < 0) + if (gPlayerEntity.x.HALF.HI - (((LockedDoorEntity*)this)->unk_70 - 0xb) < 0) return 1; break; case 2: - if (gPlayerEntity.y.HALF.HI - (this->field_0x70.HALF_U.HI - 0x8) < 0) + if (gPlayerEntity.y.HALF.HI - (((LockedDoorEntity*)this)->unk_72 - 0x8) < 0) return 1; break; case 3: - if (this->field_0x70.HALF_U.LO + 0xa - gPlayerEntity.x.HALF.HI < 0) + if (((LockedDoorEntity*)this)->unk_70 + 0xa - gPlayerEntity.x.HALF.HI < 0) return 1; break; } return 0; } -u32 sub_080837B0(Entity* this) { +u32 sub_080837B0(LockedDoorEntity* this) { u32 tmp; u32 tmp2 = gRoomControls.area; if (tmp2 < 0x40) { @@ -308,24 +324,24 @@ u32 sub_080837B0(Entity* this) { tmp = gUnk_0811F690[tmp2 - 0x40]; } if (tmp2 == 0x68) { - ChangeObjPalette(this, 0); + ChangeObjPalette(super, 0); } else { if (tmp2 == 0x88) { - ChangeObjPalette(this, 1); + ChangeObjPalette(super, 1); } } - LoadFixedGFX(this, tmp); + LoadFixedGFX(super, tmp); } -void sub_08083814(Entity* this, u32 unk0) { +void sub_08083814(LockedDoorEntity* this, u32 unk0) { Entity* fx; const struct_0811F730* tmp = &gUnk_0811F730[unk0]; - fx = CreateFx(this, FX_DASH, 0x40); + fx = CreateFx(super, FX_DASH, 0x40); if (fx) { fx->x.HALF.HI += tmp->unk_00.x; fx->y.HALF.HI += tmp->unk_00.y; } - fx = CreateFx(this, FX_DASH, 0x40); + fx = CreateFx(super, FX_DASH, 0x40); if (fx) { fx->x.HALF.HI += tmp->unk_02.x; fx->y.HALF.HI += tmp->unk_02.y; diff --git a/src/object/macroAcorn.c b/src/object/macroAcorn.c index cd22bc7a..36b421ea 100644 --- a/src/object/macroAcorn.c +++ b/src/object/macroAcorn.c @@ -4,43 +4,50 @@ * * @brief Macro Acorn object */ +#define NENT_DEPRECATED #include "entity.h" #include "map.h" #include "object.h" #include "physics.h" #include "tiles.h" -void MacroAcorn_Init(Entity*); -void MacroAcorn_Action1(Entity*); -void sub_0809E5F0(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u16 unk_80; +} MacroAcornEntity; -void MacroAcorn(Entity* this) { - static void (*const MacroAcorn_Actions[])(Entity*) = { +void MacroAcorn_Init(MacroAcornEntity* this); +void MacroAcorn_Action1(MacroAcornEntity* this); +void sub_0809E5F0(MacroAcornEntity* this); + +void MacroAcorn(MacroAcornEntity* this) { + static void (*const MacroAcorn_Actions[])(MacroAcornEntity*) = { MacroAcorn_Init, MacroAcorn_Action1, }; - MacroAcorn_Actions[this->action](this); + MacroAcorn_Actions[super->action](this); } -void MacroAcorn_Init(Entity* this) { +void MacroAcorn_Init(MacroAcornEntity* this) { u32 bVar2; Entity* pEVar3; - this->action = 1; - if (this->type == 0xff) { - this->frameIndex = this->type2; + super->action = 1; + if (super->type == 0xff) { + super->frameIndex = super->type2; } else { - bVar2 = (this->type & 1) ? 4 : 0; - if ((this->type & 2)) { + bVar2 = (super->type & 1) ? 4 : 0; + if ((super->type & 2)) { if (gEntCount < 0x45) { - this->frameIndex = bVar2; + super->frameIndex = bVar2; pEVar3 = CreateObject(HUGE_ACORN, 0xff, ++bVar2); - CopyPosition(this, pEVar3); + CopyPosition(super, pEVar3); pEVar3 = CreateObject(HUGE_ACORN, 0xff, ++bVar2); - PositionRelative(this, pEVar3, 0, 0x10000); + PositionRelative(super, pEVar3, 0, 0x10000); pEVar3->spriteOffsetY = -1; pEVar3 = CreateObject(HUGE_ACORN, 0xff, ++bVar2); - CopyPosition(this, pEVar3); + CopyPosition(super, pEVar3); } else { DeleteThisEntity(); } @@ -49,26 +56,26 @@ void MacroAcorn_Init(Entity* this) { if (pEVar3 == NULL) { DeleteThisEntity(); } else { - this->frameIndex = bVar2; - CopyPosition(this, pEVar3); + super->frameIndex = bVar2; + CopyPosition(super, pEVar3); } } sub_0809E5F0(this); } - if ((this->frameIndex & 1) != 0) { - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = 7; + if ((super->frameIndex & 1) != 0) { + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = 7; } } -void MacroAcorn_Action1(Entity* this) { +void MacroAcorn_Action1(MacroAcornEntity* this) { } -void sub_0809E5F0(Entity* this) { - u32 position = COORD_TO_TILE(this); - this->field_0x80.HWORD = position; - switch (this->type) { +void sub_0809E5F0(MacroAcornEntity* this) { + u32 position = COORD_TO_TILE(super); + this->unk_80 = position; + switch (super->type) { case 2: SetMetaTile(SPECIAL_META_TILE_34, position + TILE_POS(3, -1), LAYER_BOTTOM); SetMetaTile(SPECIAL_META_TILE_109, position + TILE_POS(4, -1), LAYER_BOTTOM); diff --git a/src/object/macroBook.c b/src/object/macroBook.c index be03f762..2e9af52d 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -31,13 +31,13 @@ void sub_0809A9D4(MacroBookEntity*); void sub_0809AA9C(MacroBookEntity*, Entity*, u32); void MacroBook(Entity* this) { - static void (*const actionFuncs[])(MacroBookEntity*) = { + static void (*const MacroBook_Actions[])(MacroBookEntity*) = { MacroBook_Init, MacroBook_Action1, MacroBook_Action2, MacroBook_Action3, }; - actionFuncs[this->action]((MacroBookEntity*)this); + MacroBook_Actions[this->action]((MacroBookEntity*)this); } void MacroBook_Init(MacroBookEntity* this) { diff --git a/src/object/macroDecorations.c b/src/object/macroDecorations.c index 6608643a..b36ea3ec 100644 --- a/src/object/macroDecorations.c +++ b/src/object/macroDecorations.c @@ -34,7 +34,6 @@ void MacroDecoration(Entity* this) { void MacroDecoration_Init(MacroDecorationEntity* this) { u32 bVar1; - u32 uVar2; super->action = 1; UpdateSpriteForCollisionLayer(super); diff --git a/src/object/macroMushroomStalk.c b/src/object/macroMushroomStalk.c index 45eb8fe0..92f70fa0 100644 --- a/src/object/macroMushroomStalk.c +++ b/src/object/macroMushroomStalk.c @@ -4,6 +4,7 @@ * * @brief Macro Mushroom Stalk object */ +#define NENT_DEPRECATED #include "area.h" #include "entity.h" #include "main.h" diff --git a/src/object/macroPlayer.c b/src/object/macroPlayer.c index 075d749e..deb5a7c8 100644 --- a/src/object/macroPlayer.c +++ b/src/object/macroPlayer.c @@ -34,20 +34,20 @@ void MacroPlayer_Type0_Action10(MacroPlayerEntity*); void sub_0808CB9C(MacroPlayerEntity*); void MacroPlayer(Entity* this) { - static void (*const typeFuncs[])(MacroPlayerEntity*) = { + static void (*const MacroPlayer_Types[])(MacroPlayerEntity*) = { MacroPlayer_Type0, MacroPlayer_Type1, }; - typeFuncs[this->type]((MacroPlayerEntity*)this); + MacroPlayer_Types[this->type]((MacroPlayerEntity*)this); } void MacroPlayer_Type0(MacroPlayerEntity* this) { - static void (*const actionFuncs[])(MacroPlayerEntity*) = { + static void (*const MacroPlayer_Type0_Actions[])(MacroPlayerEntity*) = { MacroPlayer_Type0_Init, MacroPlayer_Type0_Action1, MacroPlayer_Type0_Action2, MacroPlayer_Type0_Action3, MacroPlayer_Type0_Action4, MacroPlayer_Type0_Action5, MacroPlayer_Type0_Action6, MacroPlayer_Type0_Action7, MacroPlayer_Type0_Action8, MacroPlayer_Type0_Action9, MacroPlayer_Type0_Action10, }; - actionFuncs[super->action](this); + MacroPlayer_Type0_Actions[super->action](this); sub_0808CB9C(this); } diff --git a/src/object/macroShoe.c b/src/object/macroShoe.c index fd321b19..08560a39 100644 --- a/src/object/macroShoe.c +++ b/src/object/macroShoe.c @@ -4,6 +4,7 @@ * * @brief Macro Shoe object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "tiles.h" diff --git a/src/object/mask.c b/src/object/mask.c index 92c99fae..7498ce59 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -4,31 +4,43 @@ * * @brief Mask object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "tiles.h" -void Mask_Init(Entity*); -void Mask_Action1(Entity*); -void Mask_Action2(Entity*); -void Mask_Delete(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unused2[6]; + /*0x86*/ u16 unk_86; +} MaskEntity; -void Mask(Entity* this) { - static void (*const Mask_Actions[])(Entity*) = { +void Mask_Init(MaskEntity* this); +void Mask_Action1(MaskEntity* this); +void Mask_Action2(MaskEntity* this); +void Mask_Delete(MaskEntity* this); + +void Mask(MaskEntity* this) { + static void (*const Mask_Actions[])(MaskEntity*) = { Mask_Init, Mask_Action1, Mask_Action2, Mask_Delete, }; - Mask_Actions[this->action](this); + Mask_Actions[super->action](this); } -void Mask_Init(Entity* this) { - if (this->type2 & 0xC0) { - if (CheckFlags(this->field_0x86.HWORD)) { +void Mask_Init(MaskEntity* this) { + if (super->type2 & 0xC0) { + if (CheckFlags(this->unk_86)) { s32 field_0x0a; - switch (this->type2 & 0xC0) { + switch (super->type2 & 0xC0) { case 0x40: field_0x0a = gRoomTransition.stairs_idx; @@ -38,7 +50,7 @@ void Mask_Init(Entity* this) { DeleteThisEntity(); break; default: - ClearFlag(this->field_0x86.HWORD); + ClearFlag(this->unk_86); } break; @@ -49,26 +61,26 @@ void Mask_Init(Entity* this) { } } - this->action = 1; - this->zVelocity = Q_16_16(1.5); + super->action = 1; + super->zVelocity = Q_16_16(1.5); - this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000; + this->unk_78 = ((Random() & 7) << 10) | 0x2000; - this->subtimer = this->timer >> 1; - this->timer = 0; + super->subtimer = super->timer >> 1; + super->timer = 0; - this->frameIndex = this->type2 & 0x3f; + super->frameIndex = super->type2 & 0x3f; - this->field_0x7c.HALF_U.HI = COORD_TO_TILE(this); - this->field_0x7c.HALF_U.LO = GetMetaTileIndex(this->field_0x7c.HALF_U.HI, LAYER_BOTTOM); + this->unk_7e = COORD_TO_TILE(super); + this->unk_7c = GetMetaTileIndex(this->unk_7e, LAYER_BOTTOM); - this->field_0x7a.HWORD = GetCollisionDataAtMetaTilePos((u16)this->field_0x7c.HALF.HI, LAYER_BOTTOM); + this->unk_7a = GetCollisionDataAtMetaTilePos(this->unk_7e, LAYER_BOTTOM); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x7c.HALF_U.HI, LAYER_BOTTOM); + SetMetaTile(SPECIAL_META_TILE_34, this->unk_7e, LAYER_BOTTOM); } // Probably related to knocking it down -void Mask_Action1(Entity* this) { +void Mask_Action1(MaskEntity* this) { // Check for the first frame of bonking animation if (gPlayerEntity.action != PLAYER_BOUNCE) { return; @@ -79,54 +91,54 @@ void Mask_Action1(Entity* this) { } // Check if link is close enough to the mask - if (this->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) { + if (super->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) { return; } - if (this->x.HALF.HI - gPlayerEntity.x.HALF.HI >= this->subtimer || - this->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -this->subtimer) { + if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI >= super->subtimer || + super->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -super->subtimer) { return; } // Presumably, make the mask fall - SetMetaTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, LAYER_BOTTOM); + SetMetaTile(this->unk_7c, this->unk_7e, LAYER_BOTTOM); - SetCollisionData(this->field_0x7a.HWORD, (u16)this->field_0x7c.HALF.HI, 1); + SetCollisionData(this->unk_7a, this->unk_7e, 1); - this->action = 2; + super->action = 2; - this->z.HALF.HI -= 0x20; - this->y.HALF.HI += 0x20; + super->z.HALF.HI -= 0x20; + super->y.HALF.HI += 0x20; - this->spriteRendering.b3 = 2; + super->spriteRendering.b3 = 2; } // Probably falling down -void Mask_Action2(Entity* this) { - if (this->timer == 1) { - this->action = 3; +void Mask_Action2(MaskEntity* this) { + if (super->timer == 1) { + super->action = 3; - this->timer = 0; - switch (this->type2 & 0xC0) { + super->timer = 0; + switch (super->type2 & 0xC0) { case 0x80: EnqueueSFX(SFX_SECRET); case 0x40: - SetFlag(this->field_0x86.HWORD); + SetFlag(this->unk_86); break; } - CreateFx(this, FX_POT_SHATTER, 0); + CreateFx(super, FX_POT_SHATTER, 0); - CreateRandomItemDrop(this, 3); + CreateRandomItemDrop(super, 3); } else { - sub_080044EC(this, this->field_0x78.HWORD); + sub_080044EC(super, this->unk_78); - if (this->z.HALF.HI == 0) { - this->timer++; + if (super->z.HALF.HI == 0) { + super->timer++; } } } -void Mask_Delete(Entity* this) { +void Mask_Delete(MaskEntity* this) { DeleteThisEntity(); } diff --git a/src/object/mazaalBossObject.c b/src/object/mazaalBossObject.c index 75dbc35b..c65e7c02 100644 --- a/src/object/mazaalBossObject.c +++ b/src/object/mazaalBossObject.c @@ -8,7 +8,6 @@ #include "enemy.h" #include "entity.h" #include "functions.h" -#include "global.h" #include "item.h" #include "new_player.h" #include "object.h" @@ -49,14 +48,14 @@ void MazaalBossObject_Action8(MazaalBossObjectEntity* this); // 0809ACE8 void sub_0809AD68(MazaalBossObjectEntity* this); // 0809AD68 void sub_0809AD8C(MazaalBossObjectEntity* this); // 0809AD8C -void MazaalBossObject(Entity* thisx) { +void MazaalBossObject(Entity* this) { static void (*const MazaalBossObject_Actions[])(MazaalBossObjectEntity*) = { MazaalBossObject_Action0, MazaalBossObject_Action1, MazaalBossObject_Action2, MazaalBossObject_Action3, MazaalBossObject_Action4, MazaalBossObject_Action5, MazaalBossObject_Action6, MazaalBossObject_Action7, MazaalBossObject_Action8, }; - MazaalBossObject_Actions[thisx->action]((MazaalBossObjectEntity*)thisx); + MazaalBossObject_Actions[this->action]((MazaalBossObjectEntity*)this); } void MazaalBossObject_Action0(MazaalBossObjectEntity* this) { diff --git a/src/object/mazaalObject.c b/src/object/mazaalObject.c index c9de1bcd..68c76041 100644 --- a/src/object/mazaalObject.c +++ b/src/object/mazaalObject.c @@ -4,8 +4,8 @@ * * @brief Mazaal Object object */ +#define NENT_DEPRECATED #include "entity.h" -#include "global.h" #include "physics.h" void MazaalObject(Entity* this) { diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index 134190e9..bde2fa06 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -4,6 +4,7 @@ * * @brief Metal Door object */ +#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" @@ -14,105 +15,119 @@ #include "sound.h" #include "tiles.h" -extern u32 sub_08083734(Entity*, u32); -void sub_080A080C(Entity*); -void sub_080A0870(Entity*); -void MetalDoor_Init(Entity*); -void MetalDoor_Action1(Entity*); -void MetalDoor_Action2(Entity*); -void MetalDoor_Action3(Entity*); -void MetalDoor_Action4(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u16 unk_72; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u8 unused2[8]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} MetalDoorEntity; -void MetalDoor(Entity* this) { - static void (*const MetalDoor_Actions[])(Entity*) = { +extern u32 sub_08083734(Entity*, u32); +void sub_080A080C(MetalDoorEntity* this); +void sub_080A0870(MetalDoorEntity* this); +void MetalDoor_Init(MetalDoorEntity* this); +void MetalDoor_Action1(MetalDoorEntity* this); +void MetalDoor_Action2(MetalDoorEntity* this); +void MetalDoor_Action3(MetalDoorEntity* this); +void MetalDoor_Action4(MetalDoorEntity* this); + +void MetalDoor(MetalDoorEntity* this) { + static void (*const MetalDoor_Actions[])(MetalDoorEntity*) = { MetalDoor_Init, MetalDoor_Action1, MetalDoor_Action2, MetalDoor_Action3, MetalDoor_Action4, }; - MetalDoor_Actions[this->action](this); + MetalDoor_Actions[super->action](this); } -void MetalDoor_Init(Entity* this) { - if ((this->cutsceneBeh.HWORD != 0xffff) && CheckFlags(this->cutsceneBeh.HWORD)) { +void MetalDoor_Init(MetalDoorEntity* this) { + if ((this->unk_84 != 0xffff) && CheckFlags(this->unk_84)) { DeleteThisEntity(); } - this->action = 1; - this->speed = 0x300; - this->spriteSettings.draw = 0; - this->frameIndex = 0; - this->spriteSettings.flipY = 1; - this->hitbox = (Hitbox*)&gHitbox_3; - this->spritePriority.b0 = 5; - this->field_0x70.HALF.LO = this->x.HALF.HI; - this->field_0x70.HALF.HI = this->y.HALF.HI; - this->field_0x74.HWORD = COORD_TO_TILE(this); + super->action = 1; + super->speed = 0x300; + super->spriteSettings.draw = 0; + super->frameIndex = 0; + super->spriteSettings.flipY = 1; + super->hitbox = (Hitbox*)&gHitbox_3; + super->spritePriority.b0 = 5; + this->unk_70 = super->x.HALF.HI; + this->unk_72 = super->y.HALF.HI; + this->unk_74 = COORD_TO_TILE(super); } -void MetalDoor_Action1(Entity* this) { - if (sub_08083734(this, 2) != 0) { - this->action = 2; - this->timer = 12; - this->spriteSettings.draw = TRUE; - this->direction = 0; - this->y.HALF.HI += 0x24; +void MetalDoor_Action1(MetalDoorEntity* this) { + if (sub_08083734(super, 2) != 0) { + super->action = 2; + super->timer = 12; + super->spriteSettings.draw = TRUE; + super->direction = 0; + super->y.HALF.HI += 0x24; sub_080A080C(this); } } -void MetalDoor_Action2(Entity* this) { +void MetalDoor_Action2(MetalDoorEntity* this) { u8 bVar1; - Entity* ent; + Entity* fx; - LinearMoveUpdate(this); + LinearMoveUpdate(super); - if (--this->timer == 0) { - this->action = 3; - this->z.HALF.HI = 0; - this->x.HALF.HI = this->field_0x70.HALF.LO; - this->y.HALF.HI = this->field_0x70.HALF.HI; - ent = CreateFx(this, FX_DASH, 0x40); - if (ent != NULL) { - ent->x.HALF.HI += 0xc; - ent->y.HALF.HI -= 0xc; + if (--super->timer == 0) { + super->action = 3; + super->z.HALF.HI = 0; + super->x.HALF.HI = this->unk_70; + super->y.HALF.HI = this->unk_72; + fx = CreateFx(super, FX_DASH, 0x40); + if (fx != NULL) { + fx->x.HALF.HI += 0xc; + fx->y.HALF.HI -= 0xc; } - ent = CreateFx(this, FX_DASH, 0x40); - if (ent != NULL) { - ent->x.HALF.HI -= 0xc; - ent->y.HALF.HI -= 0xc; + fx = CreateFx(super, FX_DASH, 0x40); + if (fx != NULL) { + fx->x.HALF.HI -= 0xc; + fx->y.HALF.HI -= 0xc; } EnqueueSFX(SFX_10B); } } -void MetalDoor_Action3(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD)) { - this->action = 4; - this->timer = 12; - this->direction = 0x10; - this->y.HALF.HI += 2; +void MetalDoor_Action3(MetalDoorEntity* this) { + if (CheckFlags(this->unk_86)) { + super->action = 4; + super->timer = 12; + super->direction = 0x10; + super->y.HALF.HI += 2; sub_080A0870(this); SoundReq(SFX_10B); } } -void MetalDoor_Action4(Entity* this) { +void MetalDoor_Action4(MetalDoorEntity* this) { - LinearMoveUpdate(this); + LinearMoveUpdate(super); - if (--this->timer == 0) { + if (--super->timer == 0) { DeleteThisEntity(); } } -void sub_080A080C(Entity* this) { - this->field_0x76.HWORD = GetMetaTileIndex(this->field_0x74.HWORD - 1, this->collisionLayer); - this->field_0x78.HWORD = GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer); - this->field_0x7a.HWORD = GetMetaTileIndex(this->field_0x74.HWORD + 1, this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD - 1, this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD, this->collisionLayer); - SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD + 1, this->collisionLayer); +void sub_080A080C(MetalDoorEntity* this) { + this->unk_76 = GetMetaTileIndex(this->unk_74 - 1, super->collisionLayer); + this->unk_78 = GetMetaTileIndex(this->unk_74, super->collisionLayer); + this->unk_7a = GetMetaTileIndex(this->unk_74 + 1, super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, this->unk_74 - 1, super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, this->unk_74, super->collisionLayer); + SetMetaTile(SPECIAL_META_TILE_34, this->unk_74 + 1, super->collisionLayer); } -void sub_080A0870(Entity* this) { - SetMetaTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer); - SetMetaTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer); - SetMetaTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer); +void sub_080A0870(MetalDoorEntity* this) { + SetMetaTile(this->unk_76, this->unk_74 - 1, super->collisionLayer); + SetMetaTile(this->unk_78, this->unk_74, super->collisionLayer); + SetMetaTile(this->unk_7a, this->unk_74 + 1, super->collisionLayer); } diff --git a/src/object/minecart.c b/src/object/minecart.c index bce65144..19ffa398 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -12,21 +12,21 @@ typedef struct { Entity base; - u8 filler[0x1C]; + u8 filler[28]; MinecartData* minecartData; } MinecartEntity; extern void sub_08017744(Entity*); -u32 sub_08091DDC(MinecartEntity*); -void Minecart_Init(MinecartEntity*); -void Minecart_Action1(MinecartEntity*); -void Minecart_Action2(MinecartEntity*); -void Minecart_Action3(MinecartEntity*); -void Minecart_Action4(MinecartEntity*); -void Minecart_Action5(MinecartEntity*); -void Minecart_Action6(MinecartEntity*); -void Minecart_Action7(MinecartEntity*); +u32 sub_08091DDC(MinecartEntity* this); +void Minecart_Init(MinecartEntity* this); +void Minecart_Action1(MinecartEntity* this); +void Minecart_Action2(MinecartEntity* this); +void Minecart_Action3(MinecartEntity* this); +void Minecart_Action4(MinecartEntity* this); +void Minecart_Action5(MinecartEntity* this); +void Minecart_Action6(MinecartEntity* this); +void Minecart_Action7(MinecartEntity* this); extern const KeyValuePair* const gUnk_081223D8[]; diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index d1e6389f..0f89c5f3 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -4,7 +4,6 @@ * * @brief Minecart Door object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index 2fca29e6..56667b11 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -4,6 +4,7 @@ * * @brief Mineral Water Source object */ +#define NENT_DEPRECATED #include "object.h" void MineralWaterSource_Init(Entity*); @@ -17,11 +18,11 @@ typedef struct { } UnkStruct_MineralWater; void MineralWaterSource(Entity* this) { - static void (*const MineralWaterSourceActionFuncs[])(Entity*) = { + static void (*const MineralWaterSource_Actions[])(Entity*) = { MineralWaterSource_Init, MineralWaterSource_Action1, }; - MineralWaterSourceActionFuncs[this->action](this); + MineralWaterSource_Actions[this->action](this); } void MineralWaterSource_Init(Entity* this) { diff --git a/src/object/minishEmoticon.c b/src/object/minishEmoticon.c index 0904b1cb..279c66e4 100644 --- a/src/object/minishEmoticon.c +++ b/src/object/minishEmoticon.c @@ -4,6 +4,7 @@ * * @brief Minish Emoticon object */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" diff --git a/src/object/minishLight.c b/src/object/minishLight.c index 382056ee..36569b66 100644 --- a/src/object/minishLight.c +++ b/src/object/minishLight.c @@ -4,6 +4,7 @@ * * @brief Minish Light object */ +#define NENT_DEPRECATED #include "entity.h" void MinishLight_Init(Entity*); diff --git a/src/object/minishPortalCloseup.c b/src/object/minishPortalCloseup.c index f0e3c8c4..e683e3bc 100644 --- a/src/object/minishPortalCloseup.c +++ b/src/object/minishPortalCloseup.c @@ -4,11 +4,9 @@ * * @brief Minish Portal Closeup object */ - #define NENT_DEPRECATED #include "area.h" #include "functions.h" -#include "global.h" #include "main.h" #include "object.h" #include "screen.h" diff --git a/src/object/minishPortalStone.c b/src/object/minishPortalStone.c index e038c31f..5dc4bfcf 100644 --- a/src/object/minishPortalStone.c +++ b/src/object/minishPortalStone.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" #include "screen.h" @@ -16,14 +15,14 @@ typedef struct { /*0x86*/ u16 unk_86; } MinishPortalStoneEntity; -void MinishPortalStone_Init(MinishPortalStoneEntity*); -void MinishPortalStone_Action1(MinishPortalStoneEntity*); -void MinishPortalStone_Action2(MinishPortalStoneEntity*); -void MinishPortalStone_Action3(MinishPortalStoneEntity*); -void MinishPortalStone_Action4(MinishPortalStoneEntity*); -void sub_08097CFC(MinishPortalStoneEntity*); -bool32 sub_08097CB0(MinishPortalStoneEntity*); -void sub_08097CB4(MinishPortalStoneEntity*); +void MinishPortalStone_Init(MinishPortalStoneEntity* this); +void MinishPortalStone_Action1(MinishPortalStoneEntity* this); +void MinishPortalStone_Action2(MinishPortalStoneEntity* this); +void MinishPortalStone_Action3(MinishPortalStoneEntity* this); +void MinishPortalStone_Action4(MinishPortalStoneEntity* this); +void sub_08097CFC(MinishPortalStoneEntity* this); +bool32 sub_08097CB0(MinishPortalStoneEntity* this); +void sub_08097CB4(MinishPortalStoneEntity* this); const Hitbox gUnk_08123328 = { 0, 0, { 4, 0, 0, 4 }, 18, 18 }; diff --git a/src/object/minishSizedArchway.c b/src/object/minishSizedArchway.c index 01a81cfc..e92e6fef 100644 --- a/src/object/minishSizedArchway.c +++ b/src/object/minishSizedArchway.c @@ -4,6 +4,7 @@ * * @brief Minish Sized Archway object */ +#define NENT_DEPRECATED #include "entity.h" #include "game.h" diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index c12192c2..d63eba55 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -4,6 +4,7 @@ * * @brief MinishSizedEntrance object */ +#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "object.h" diff --git a/src/object/minishVillageObject.c b/src/object/minishVillageObject.c index 6f5f5677..8a5c8598 100644 --- a/src/object/minishVillageObject.c +++ b/src/object/minishVillageObject.c @@ -4,7 +4,6 @@ * * @brief Minish Village Object object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index da4c6322..f0fdb838 100644 --- a/src/object/moleMittsParticle.c +++ b/src/object/moleMittsParticle.c @@ -7,7 +7,6 @@ #define NENT_DEPRECATED #include "area.h" #include "functions.h" -#include "global.h" #include "object.h" void MoleMittsParticle_Init(Entity*); diff --git a/src/object/object1D.c b/src/object/object1D.c index 0635d64c..4252f9b0 100644 --- a/src/object/object1D.c +++ b/src/object/object1D.c @@ -4,6 +4,7 @@ * * @brief Object1D object */ +#define NENT_DEPRECATED #include "entity.h" void Object1D_Init(Entity*); diff --git a/src/object/object30.c b/src/object/object30.c index 12bd96a4..fd565bb9 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -4,11 +4,9 @@ * * @brief Object30 object */ - #define NENT_DEPRECATED #include "collision.h" #include "functions.h" -#include "global.h" #include "item.h" #include "object.h" diff --git a/src/object/object37.c b/src/object/object37.c index 800f0fa0..619f8482 100644 --- a/src/object/object37.c +++ b/src/object/object37.c @@ -44,14 +44,14 @@ void Object37_Init(Object37Entity* this) { void Object37_Action1(Object37Entity* this) { Entity* item; - if ((gSave.fusionUnmarked[0] != 0) && (this->unk70 != *this->unk78)) { + if ((gSave.kinstones.fusionUnmarked[0] != 0) && (this->unk70 != *this->unk78)) { item = CreateGroundItem(super, ITEM_RUPEE100, 0); if (item != 0) { item->direction = gPlayerEntity.animationState << 2; item->speed = 0x80; item->zVelocity = Q_16_16(2.0); } - gSave.fusionUnmarked[0] = 1; + gSave.kinstones.fusionUnmarked[0] = 1; DeleteThisEntity(); } } diff --git a/src/object/object70.c b/src/object/object70.c index 064f6808..efe82743 100644 --- a/src/object/object70.c +++ b/src/object/object70.c @@ -4,11 +4,9 @@ * * @brief Object70 object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "object.h" void Object70_Init(Entity*); void Object70_Action1(Entity*); @@ -37,23 +35,19 @@ void Object70_Init(Entity* this) { } void Object70_Action1(Entity* this) { - u8 bVar1; if (this->type == 0) { - if (gPlayerEntity.z.WORD == 0) { - if ((((gPlayerState.dash_state & 0x40) == 0) && (gPlayerState.floor_type == SURFACE_SWAMP)) && - ((gPlayerEntity.action == PLAYER_NORMAL || - ((gPlayerEntity.action == PLAYER_ROLL || (gPlayerEntity.action == PLAYER_JUMP)))))) { - goto _080974FA; - } else { - if (gPlayerEntity.z.WORD == 0) { - CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); - } + if (gPlayerEntity.z.WORD != 0 || (gPlayerState.dash_state & 0x40) != 0 || + gPlayerState.floor_type != SURFACE_SWAMP || + (gPlayerEntity.action != PLAYER_NORMAL && gPlayerEntity.action != PLAYER_ROLL && + gPlayerEntity.action != PLAYER_JUMP)) { + if (gPlayerEntity.z.WORD == 0) { + CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); } + + gPlayerEntity.spriteOrientation.flipY = 2; + DeleteThisEntity(); } - gPlayerEntity.spriteOrientation.flipY = 2; - DeleteThisEntity(); - _080974FA: this->x = gPlayerEntity.x; this->y = gPlayerEntity.y; if (gPlayerState.jump_status == 0) { @@ -64,15 +58,15 @@ void Object70_Action1(Entity* this) { this->spritePriority.b0 = 7; } } + return; + } - } else { - if (gPlayerEntity.action != PLAYER_USEENTRANCE) { - if (this->collisionLayer == 1) { - gPlayerEntity.spriteOrientation.flipY = 2; - } else { - gPlayerEntity.spriteOrientation.flipY = 1; - } - DeleteThisEntity(); + if (gPlayerEntity.action != PLAYER_USEENTRANCE) { + if (this->collisionLayer == 1) { + gPlayerEntity.spriteOrientation.flipY = 2; + } else { + gPlayerEntity.spriteOrientation.flipY = 1; } + DeleteThisEntity(); } } diff --git a/src/object/objectA.c b/src/object/objectA.c index 88128852..1eaf8f37 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -4,6 +4,7 @@ * * @brief ObjectA object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -13,33 +14,41 @@ #include "room.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u8 unused2[20]; + /*0x86*/ u16 unk_86; +} ObjectAEntity; + extern u8 gUpdateVisibleTiles; -void ObjectA(Entity* this) { +void ObjectA(ObjectAEntity* this) { u32 uVar2; - if (this->action == 0) { - this->action = 1; - this->hitbox = (Hitbox*)&gHitbox_2; - if (this->collisionLayer == LAYER_BOTTOM) { + if (super->action == 0) { + super->action = 1; + super->hitbox = (Hitbox*)&gHitbox_2; + if (super->collisionLayer == LAYER_BOTTOM) { uVar2 = META_TILE_TYPE_38; } else { uVar2 = META_TILE_TYPE_52; } - this->field_0x70.HALF.LO = uVar2; - if (CheckFlags(this->field_0x86.HWORD) != 0) { - SetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + this->unk_70 = uVar2; + if (CheckFlags(this->unk_86) != 0) { + SetMetaTileType(this->unk_70, COORD_TO_TILE(super), super->collisionLayer); if ((gRoomControls.reload_flags & 1) != 0) { gUpdateVisibleTiles = 0; } DeleteThisEntity(); } else { - AddInteractableSmallKeyLock(this); + AddInteractableSmallKeyLock(super); } - } else if (this->interactType != 0) { - SetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); - SetFlag(this->field_0x86.HWORD); - CreateDust(this); + } else if (super->interactType != INTERACTION_NONE) { + SetMetaTileType(this->unk_70, COORD_TO_TILE(super), super->collisionLayer); + SetFlag(this->unk_86); + CreateDust(super); ModDungeonKeys(-1); DeleteThisEntity(); } diff --git a/src/object/objectA2.c b/src/object/objectA2.c index de67db99..167bf188 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -4,6 +4,7 @@ * * @brief Object A2 object */ +#define NENT_DEPRECATED #include "functions.h" #include "menu.h" #include "object.h" diff --git a/src/object/objectA8.c b/src/object/objectA8.c index fcaf3966..dca5a903 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -4,11 +4,9 @@ * * @brief ObjectA8 object */ - #define NENT_DEPRECATED #include "collision.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "item.h" #include "object.h" @@ -35,6 +33,8 @@ void ObjectA8_Action2Subaction0(ObjectA8Entity*); void ObjectA8_Action2Subaction1(ObjectA8Entity*); void ObjectA8_Action2Subaction2(ObjectA8Entity*); +extern void sub_08081404(Entity*, u32); + void ObjectA8(ObjectA8Entity* this) { static void (*const ObjectA8_Actions[])(ObjectA8Entity*) = { ObjectA8_Init, ObjectA8_Action1, ObjectA8_Action2, ObjectA8_Action3, diff --git a/src/object/objectBF.c b/src/object/objectBF.c index a66a2b61..0c884d18 100644 --- a/src/object/objectBF.c +++ b/src/object/objectBF.c @@ -4,6 +4,7 @@ * * @brief Object BF object */ +#define NENT_DEPRECATED #include "entity.h" void ObjectBF(Entity* this) { diff --git a/src/object/objectBlockingStairs.c b/src/object/objectBlockingStairs.c index fd10a600..7472c331 100644 --- a/src/object/objectBlockingStairs.c +++ b/src/object/objectBlockingStairs.c @@ -40,16 +40,15 @@ u32 sub_080932D8(u32); void sub_080931A4(ObjectBlockingStairsEntity*, u32); void ObjectBlockingStairs(Entity* this) { - static void (*const actionFuncs[])(ObjectBlockingStairsEntity*) = { + static void (*const ObjectBlockingStairs_Actions[])(ObjectBlockingStairsEntity*) = { ObjectBlockingStairs_Init, ObjectBlockingStairs_Action1, ObjectBlockingStairs_Action2, ObjectBlockingStairs_Action3, ObjectBlockingStairs_Action4, }; - actionFuncs[this->action]((ObjectBlockingStairsEntity*)this); + ObjectBlockingStairs_Actions[this->action]((ObjectBlockingStairsEntity*)this); } void ObjectBlockingStairs_Init(ObjectBlockingStairsEntity* this) { - int iVar1; u32 uVar2; switch (sub_080932D8(super->type)) { diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c index 68b597dc..206b647f 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -4,7 +4,6 @@ * * @brief Object on Pillar object */ - #define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" diff --git a/src/object/objectOnSpinyBeetle.c b/src/object/objectOnSpinyBeetle.c index 2bccf348..8c6beccf 100644 --- a/src/object/objectOnSpinyBeetle.c +++ b/src/object/objectOnSpinyBeetle.c @@ -4,10 +4,8 @@ * * @brief Object on Spiny Beetle object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index 126a725b..dd0d49e4 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -4,25 +4,18 @@ * * @brief Octorok Boss Object object */ +#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "object.h" -extern void (*const OctorokBossObject_Actions[])(Entity*); -extern const u16 gUnk_0812384C[]; -extern const u16 gUnk_0812388C[]; -extern const u16 gUnk_081238A0[]; - -bool32 sub_0809A6F8(u32, u32, u32, u32); -bool32 sub_0809A758(u32, u32); - typedef struct HelperStruct { - u8 field_0x0; // [0,1,2,4] is later stored in this->subtimer + u8 field_0x0; // [0,1,2,4] is later stored in super->subtimer u8 tailCount; u8 field_0x2; // [0,1] - u8 field_0x3; // relates to this->field_0x7a.HALF.HI + u8 field_0x3; // relates to super->field_0x7a.HALF.HI u8 field_0x4; // [0,1,0xff] - u8 field_0x5; // [0-4], sets this->field_0x80.HALF.HI + u8 field_0x5; // [0-4], sets super->field_0x80.HALF.HI u8 fallingStonesTimer; u8 field_0x7; // some sort of counter that is only set when hit for the first time? Entity* mouthObject; @@ -30,9 +23,29 @@ typedef struct HelperStruct { Entity* legObjects[4]; } HelperStruct; +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ union SplitWord unk_78; + /*0x7c*/ union SplitWord unk_7c; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; + /*0x84*/ HelperStruct* helper; +} OctorokBossObjectEntity; + +extern void (*const OctorokBossObject_Actions[])(OctorokBossObjectEntity*); +extern const u16 gUnk_0812384C[]; +extern const u16 gUnk_0812388C[]; +extern const u16 gUnk_081238A0[]; + +bool32 sub_0809A6F8(u32, u32, u32, u32); +bool32 sub_0809A758(u32, u32); + enum OctorokBossObjectType { TYPE0, // OctorokBoss_Action1 / TAIL_END - TYPE_FIRE, // this->OctorokBossObject_Action1 + TYPE_FIRE, // super->OctorokBossObject_Action1 TYPE_SUCKING, // OctorokBoss_ExecuteAttackVacuum TYPE_SMOKE, // OctorokBoss_ExecuteAttackSmoke TYPE4, // OctorokBoss_Action1_Attack_Type2_2 @@ -42,166 +55,164 @@ enum OctorokBossObjectType { TYPE8, // OctorokBoss_Hit_SubAction1 TYPE9 // OctorokBoss_Hit_SubAction4 }; -#define GET_HELPER(this) (*(HelperStruct**)&(this)->cutsceneBeh) -void OctorokBossObject(Entity* this) { - OctorokBossObject_Actions[this->action](this); +void OctorokBossObject(OctorokBossObjectEntity* this) { + OctorokBossObject_Actions[super->action](this); } -void OctorokBossObject_Init(Entity* this) { - this->action = 1; - this->speed = 0x200; - switch (this->type) { +void OctorokBossObject_Init(OctorokBossObjectEntity* this) { + super->action = 1; + super->speed = 0x200; + switch (super->type) { case 0: - this->field_0x78.HALF.HI = 0x96; - this->timer = 0; - this->subtimer = 30; + this->unk_78.BYTES.byte1 = 0x96; + super->timer = 0; + super->subtimer = 30; case 1: - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); EnqueueSFX(SFX_124); break; case 2: - this->direction = -(this->parent->field_0x7a.HALF.HI + -0x80); + super->direction = -(((OctorokBossObjectEntity*)super->parent)->unk_78.BYTES.byte3 + -0x80); if ((Random() & 1) != 0) { switch (Random() & 3) { case 0: - this->direction = this->direction - 0x10; + super->direction = super->direction - 0x10; break; case 1: - this->direction = this->direction + 0x10; + super->direction = super->direction + 0x10; break; case 2: - this->direction = this->direction - 8; + super->direction = super->direction - 8; break; case 3: - this->direction = this->direction + 8; + super->direction = super->direction + 8; break; } } - this->speed = DISPLAY_WIDTH - (Random() & 0x3f); - LinearMoveAngle(this, ((s16)this->speed >> 1) << 8, (u32)this->direction); - LinearMoveAngle(this, ((s16)this->speed >> 1) << 8, (u32)this->direction); - InitializeAnimation(this, 5); + super->speed = DISPLAY_WIDTH - (Random() & 0x3f); + LinearMoveAngle(super, ((s16)super->speed >> 1) << 8, (u32)super->direction); + LinearMoveAngle(super, ((s16)super->speed >> 1) << 8, (u32)super->direction); + InitializeAnimation(super, 5); SoundReq(SFX_14C); break; case 3: - this->direction = -(this->parent->field_0x7a.HALF.HI + -0x80); - LinearMoveAngle(this, 0x4800, (u32)this->direction); + super->direction = -(((OctorokBossObjectEntity*)super->parent)->unk_78.BYTES.byte3 + -0x80); + LinearMoveAngle(super, 0x4800, (u32)super->direction); if ((Random() & 1) != 0) { - this->direction = (Random() & 0x3f) + this->direction; + super->direction = (Random() & 0x3f) + super->direction; } else { - this->direction = this->direction - (Random() & 0x3f); + super->direction = super->direction - (Random() & 0x3f); } - InitializeAnimation(this, 6); + InitializeAnimation(super, 6); break; case 6: - LinearMoveAngle(this, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff); + LinearMoveAngle(super, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff); if ((Random() & 1) != 0) { - this->direction = (Random() & 0x3f) + this->direction; + super->direction = (Random() & 0x3f) + super->direction; } else { - this->direction = this->direction - (Random() & 0x3f); + super->direction = super->direction - (Random() & 0x3f); } - InitializeAnimation(this, 5); + InitializeAnimation(super, 5); break; case 4: - *(u32*)&this->field_0x78 = 0x30c; + this->unk_78.WORD = 0x30c; break; case 5: - this->spritePriority.b0 = 0; - *(u32*)&this->field_0x78 = 0x18; - this->field_0x76.HWORD = 0x400; - this->field_0x74.HWORD = 0x400; - this->field_0x7a.HWORD = 0; - LinearMoveAngle(this, - ((-(u32)this->parent->field_0x7a.HALF.HI << 0x18) >> 0x18) + - (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1], - (u32)gUnk_0812388C[(u32)this->type2 * 2]); - SetAffineInfo(this, this->field_0x76.HWORD, this->field_0x74.HWORD, this->field_0x7a.HWORD); - InitializeAnimation(this, 7); + super->spritePriority.b0 = 0; + this->unk_78.WORD = 0x18; + this->unk_76 = 0x400; + this->unk_74 = 0x400; + this->unk_78.HALF_U.HI = 0; + LinearMoveAngle(super, + ((-(u32)((OctorokBossObjectEntity*)super->parent)->unk_78.BYTES.byte3 << 0x18) >> 0x18) + + (u32)gUnk_0812388C[(u32)super->type2 * 2 + 1], + (u32)gUnk_0812388C[(u32)super->type2 * 2]); + SetAffineInfo(super, this->unk_76, this->unk_74, this->unk_78.HALF_U.HI); + InitializeAnimation(super, 7); break; case 7: - this->timer = 0; - InitializeAnimation(this, 8); - CopyPosition(this->parent, this); + super->timer = 0; + InitializeAnimation(super, 8); + CopyPosition(super->parent, super); break; case 8: - this->type2 = this->parent->field_0x7c.BYTES.byte0; - this->timer = 4; - this->subtimer = 0; - this->field_0x82.HWORD = (this->x.HALF.HI - (gRoomControls.origin_x)) & 0x1f0; - this->field_0x80.HWORD = (this->y.HALF.HI - ((u32)gRoomControls.origin_y)) & 0x1f0; - *(int*)&this->cutsceneBeh = - ((s32)(this->field_0x82.HWORD - 0x10) >> 4) + (this->field_0x80.HWORD >> 4) * 0x1f; - sub_0809A6F8(this->field_0x82.HWORD, this->field_0x80.HWORD, *(int*)&this->cutsceneBeh, this->type2); - if ((this->parent->field_0x7c.BYTES.byte0 & 1) != 0) { + super->type2 = ((OctorokBossObjectEntity*)super->parent)->unk_7c.BYTES.byte0; + super->timer = 4; + super->subtimer = 0; + this->unk_82 = (super->x.HALF.HI - (gRoomControls.origin_x)) & 0x1f0; + this->unk_80 = (super->y.HALF.HI - ((u32)gRoomControls.origin_y)) & 0x1f0; + *(s32*)&this->helper = ((s32)(this->unk_82 - 0x10) >> 4) + (this->unk_80 >> 4) * 0x1f; + sub_0809A6F8(this->unk_82, this->unk_80, *(s32*)&this->helper, super->type2); + if ((((OctorokBossObjectEntity*)super->parent)->unk_7c.BYTES.byte0 & 1) != 0) { SoundReq(SFX_1A3); } else { SoundReq(SFX_WIND2); } break; case 9: - *(u32*)&this->field_0x78 = 0x1e0; + this->unk_78.WORD = 0x1e0; break; } } -void OctorokBossObject_Action1(Entity* this) { +void OctorokBossObject_Action1(OctorokBossObjectEntity* this) { s32 tmp_c; u32 loop_var; s32 t1, t2; - GetNextFrame(this); + GetNextFrame(super); - switch (this->type) { + switch (super->type) { case 0: - if (this->field_0x78.HALF.HI != 0) { - this->field_0x78.HALF.HI--; - if (this->subtimer-- == 0) { - this->subtimer = 5; - this->child = CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 1, this->type2); - if (this->child != NULL) { - this->child->parent = this->parent; - GET_HELPER(this->child) = GET_HELPER(this); + if (this->unk_78.BYTES.byte1 != 0) { + this->unk_78.BYTES.byte1--; + if (super->subtimer-- == 0) { + super->subtimer = 5; + super->child = CreateObjectWithParent(super, OCTOROK_BOSS_OBJECT, 1, super->type2); + if (super->child != NULL) { + super->child->parent = super->parent; + ((OctorokBossObjectEntity*)super->child)->helper = this->helper; } - this->type2++; + super->type2++; } - CopyPosition(GET_HELPER(this)->tailObjects[0], this); + CopyPosition(this->helper->tailObjects[0], super); return; } case 1: - this->direction = - CalculateDirectionFromOffsets(GET_HELPER(this)->tailObjects[this->timer]->x.WORD - this->x.WORD, - GET_HELPER(this)->tailObjects[this->timer]->y.WORD - this->y.WORD); - LinearMoveAngle(this, this->speed, this->direction); - if (EntityInRectRadius(this, GET_HELPER(this)->tailObjects[this->timer], 2, 2) == 0) { + super->direction = + CalculateDirectionFromOffsets(this->helper->tailObjects[super->timer]->x.WORD - super->x.WORD, + this->helper->tailObjects[super->timer]->y.WORD - super->y.WORD); + LinearMoveAngle(super, super->speed, super->direction); + if (EntityInRectRadius(super, this->helper->tailObjects[super->timer], 2, 2) == 0) { return; } - if (this->type == 0) { - GET_HELPER(this)->tailObjects[this->timer]->spriteSettings.draw &= -2; + if (super->type == 0) { + this->helper->tailObjects[super->timer]->spriteSettings.draw &= -2; } - if ((u32)this->timer == GET_HELPER(this)->tailCount - 1) { - this->action = 2; - this->timer = 240; - this->direction = gUnk_0812384C[(u8)((this->type2 & 0xf) * 2)] + ((u8)Random() & 0xf); - this->speed = gUnk_0812384C[(this->type2 & 0xf) * 2 + 1] + ((u16)Random() & 0x1ff); - if (this->type != 0) { + if ((u32)super->timer == this->helper->tailCount - 1) { + super->action = 2; + super->timer = 240; + super->direction = gUnk_0812384C[(u8)((super->type2 & 0xf) * 2)] + ((u8)Random() & 0xf); + super->speed = gUnk_0812384C[(super->type2 & 0xf) * 2 + 1] + ((u16)Random() & 0x1ff); + if (super->type != 0) { return; } - this->parent->action = 4; - this->parent->subAction = 0; + super->parent->action = 4; + super->parent->subAction = 0; return; } - this->timer++; + super->timer++; return; case 2: - if (this->parent->type2 == 3) { - Entity* object = GET_HELPER(this->parent)->mouthObject; - this->direction = - CalculateDirectionFromOffsets(object->x.WORD - this->x.WORD, object->y.WORD - this->y.WORD); - LinearMoveAngle(this, 0x280, this->direction); - if (sub_0806FC80(this, this->parent, 0x48) == 0) { + if (super->parent->type2 == 3) { + Entity* object = ((OctorokBossObjectEntity*)super->parent)->helper->mouthObject; + super->direction = + CalculateDirectionFromOffsets(object->x.WORD - super->x.WORD, object->y.WORD - super->y.WORD); + LinearMoveAngle(super, 0x280, super->direction); + if (sub_0806FC80(super, super->parent, 0x48) == 0) { return; } } @@ -209,99 +220,98 @@ void OctorokBossObject_Action1(Entity* this) { break; case 3: case 6: - LinearMoveAngle(this, 0x80, this->direction); - if (this->frame != 0) { + LinearMoveAngle(super, 0x80, super->direction); + if (super->frame != 0) { DeleteThisEntity(); } break; case 4: - if (*(u32*)&this->field_0x78 == 0) { + if (this->unk_78.WORD == 0) { if ((s16)gRoomVars.lightLevel != 0x100) { ChangeLightLevel(8); return; } else { } } else { - if (this->parent->health == 0) { - this->subAction = 1; - *(u32*)&this->field_0x78 = 0; + if (super->parent->health == 0) { + super->subAction = 1; + this->unk_78.WORD = 0; return; } - if ((this->subAction == 0) && (this->parent->type2 != 0)) { + if ((super->subAction == 0) && (super->parent->type2 != 0)) { return; } - this->subAction = 1; - *(int*)&this->field_0x78 += -1; + super->subAction = 1; + this->unk_78.WORD--; return; } - GET_HELPER(this)->tailObjects[this->timer]->x = GET_HELPER(this)->tailObjects[this->timer]->x; + this->helper->tailObjects[super->timer]->x = this->helper->tailObjects[super->timer]->x; DeleteThisEntity(); break; case 5: - if (*(int*)&this->field_0x78 == 0) { - if (this->field_0x76.HWORD == 0x100) { - if ((*(u8*)&this->parent->field_0x7c & 1) != 0) { + if (this->unk_78.WORD == 0) { + if (this->unk_76 == 0x100) { + if ((((OctorokBossObjectEntity*)super->parent)->unk_7c.BYTES.byte0 & 1) != 0) { DeleteThisEntity(); } } else { - this->field_0x76.HWORD -= 0x20; - this->field_0x74.HWORD -= 0x20; + this->unk_76 -= 0x20; + this->unk_74 -= 0x20; } - SetAffineInfo(this, (u32)this->field_0x76.HWORD, (u32)(u16)this->field_0x74.HWORD, - (u32)(u16)this->field_0x7a.HWORD); + SetAffineInfo(super, (u32)this->unk_76, (u32)(u16)this->unk_74, (u32)(u16)this->unk_78.HALF_U.HI); } else { - (*(int*)&this->field_0x78)--; + (this->unk_78.WORD)--; } - CopyPosition(this->parent, this); - LinearMoveAngle(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1], - ((u8) - this->parent->field_0x7a.HALF.HI & 0xff) + - (u32)gUnk_0812388C[(u32)this->type2 * 2]); + CopyPosition(super->parent, super); + LinearMoveAngle(super, (u32)gUnk_0812388C[(u32)super->type2 * 2 + 1], + ((u8) - ((OctorokBossObjectEntity*)super->parent)->unk_78.BYTES.byte3 & 0xff) + + (u32)gUnk_0812388C[(u32)super->type2 * 2]); return; case 7: - if (this->timer == 0) { - CopyPosition(this->parent, this); + if (super->timer == 0) { + CopyPosition(super->parent, super); return; } DeleteThisEntity(); break; case 8: - if (this->timer-- != 0) { + if (super->timer-- != 0) { return; } - this->timer = 4; - this->subtimer++; - t2 = t1 = (*(int*)&this->cutsceneBeh) - this->subtimer * 0x1f; - this->field_0x7c.HALF_U.HI = this->field_0x82.HWORD; - this->field_0x7a.HWORD = this->field_0x82.HWORD; - this->field_0x7c.HALF_U.LO = this->field_0x80.HWORD - this->subtimer * 0x10; - this->field_0x78.HWORD = this->field_0x7c.HALF.LO; - tmp_c = sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2); - for (loop_var = this->subtimer; loop_var != 0; loop_var--) { - this->field_0x7a.HWORD -= 0x10; - this->field_0x78.HWORD += 0x10; + super->timer = 4; + super->subtimer++; + t2 = t1 = (*(s32*)&this->helper) - super->subtimer * 0x1f; + this->unk_7c.HALF_U.HI = this->unk_82; + this->unk_78.HALF_U.HI = this->unk_82; + this->unk_7c.HALF_U.LO = this->unk_80 - super->subtimer * 0x10; + this->unk_78.HALF_U.LO = this->unk_7c.HALF.LO; + tmp_c = sub_0809A6F8(this->unk_78.HALF_U.HI, this->unk_78.HALF_U.LO, t1, super->type2); + for (loop_var = super->subtimer; loop_var != 0; loop_var--) { + this->unk_78.HALF_U.HI -= 0x10; + this->unk_78.HALF_U.LO += 0x10; t1 += 0x1e; - tmp_c += sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2); - this->field_0x7c.HALF.HI += 0x10; - this->field_0x7c.HALF.LO += 0x10; + tmp_c += sub_0809A6F8(this->unk_78.HALF_U.HI, this->unk_78.HALF_U.LO, t1, super->type2); + this->unk_7c.HALF.HI += 0x10; + this->unk_7c.HALF.LO += 0x10; t2 += 0x20; - tmp_c += sub_0809A6F8(this->field_0x7c.HALF_U.HI, this->field_0x7c.HALF_U.LO, t2, this->type2); + tmp_c += sub_0809A6F8(this->unk_7c.HALF_U.HI, this->unk_7c.HALF_U.LO, t2, super->type2); } - t2 = t1 = (*(int*)&this->cutsceneBeh) + this->subtimer * 0x1f; - this->field_0x7c.HALF.HI = this->field_0x82.HWORD; - this->field_0x7a.HWORD = this->field_0x82.HWORD; - this->field_0x7c.HALF.LO = this->subtimer * 0x10 + this->field_0x80.HWORD; - this->field_0x78.HWORD = this->field_0x7c.HALF.LO; - tmp_c += sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2); - for (loop_var = this->subtimer - 1; loop_var != 0; loop_var--) { - this->field_0x7a.HWORD -= 0x10; - this->field_0x78.HWORD -= 0x10; + t2 = t1 = (*(s32*)&this->helper) + super->subtimer * 0x1f; + this->unk_7c.HALF.HI = this->unk_82; + this->unk_78.HALF_U.HI = this->unk_82; + this->unk_7c.HALF.LO = super->subtimer * 0x10 + this->unk_80; + this->unk_78.HALF_U.LO = this->unk_7c.HALF.LO; + tmp_c += sub_0809A6F8(this->unk_78.HALF_U.HI, this->unk_78.HALF_U.LO, t1, super->type2); + for (loop_var = super->subtimer - 1; loop_var != 0; loop_var--) { + this->unk_78.HALF_U.HI -= 0x10; + this->unk_78.HALF_U.LO -= 0x10; t1 -= 0x20; - tmp_c += sub_0809A6F8(this->field_0x7a.HWORD, this->field_0x78.HWORD, t1, this->type2); - this->field_0x7c.HALF_U.HI += 0x10; - this->field_0x7c.HALF_U.LO -= 0x10; + tmp_c += sub_0809A6F8(this->unk_78.HALF_U.HI, this->unk_78.HALF_U.LO, t1, super->type2); + this->unk_7c.HALF_U.HI += 0x10; + this->unk_7c.HALF_U.LO -= 0x10; t2 -= 0x1e; - tmp_c += sub_0809A6F8(this->field_0x7c.HALF_U.HI, this->field_0x7c.HALF_U.LO, t2, this->type2); + tmp_c += sub_0809A6F8(this->unk_7c.HALF_U.HI, this->unk_7c.HALF_U.LO, t2, super->type2); } if (tmp_c == 0) { DeleteThisEntity(); @@ -309,7 +319,7 @@ void OctorokBossObject_Action1(Entity* this) { break; case 9: sub_08078B48(); - if ((*(int*)&this->field_0x78)-- == 0) { + if ((this->unk_78.WORD_U)-- == 0) { gRoomControls.camera_target = &gPlayerEntity; DeleteThisEntity(); } @@ -317,22 +327,22 @@ void OctorokBossObject_Action1(Entity* this) { } } -void OctorokBossObject_Action2(Entity* this) { +void OctorokBossObject_Action2(OctorokBossObjectEntity* this) { s32 tmp; s32 radius; - GetNextFrame(this); - if (this->timer-- != 0) { - tmp = (0x10000 / this->parent->field_0x74.HWORD); - radius = (this->speed * tmp) >> 8; - this->field_0x7a.HALF.HI = -this->parent->field_0x7a.HALF.HI + this->direction; + GetNextFrame(super); + if (super->timer-- != 0) { + tmp = (0x10000 / ((OctorokBossObjectEntity*)super->parent)->unk_74); + radius = (super->speed * tmp) >> 8; + this->unk_78.BYTES.byte3 = -((OctorokBossObjectEntity*)super->parent)->unk_78.BYTES.byte3 + super->direction; - tmp = FixedMul(gSineTable[this->field_0x7a.HALF.HI], radius); + tmp = FixedMul(gSineTable[this->unk_78.BYTES.byte3], radius); tmp = FixedDiv(tmp, 0x100); - this->x.WORD = this->parent->x.WORD + ((tmp << 0x10) >> 8); - tmp = FixedMul(gSineTable[this->field_0x7a.HALF.HI + 0x40], radius); + super->x.WORD = super->parent->x.WORD + ((tmp << 0x10) >> 8); + tmp = FixedMul(gSineTable[this->unk_78.BYTES.byte3 + 0x40], radius); tmp = FixedDiv(tmp, 0x100); - this->y.WORD = this->parent->y.WORD - ((tmp << 0x10) >> 8); + super->y.WORD = super->parent->y.WORD - ((tmp << 0x10) >> 8); } else { DeleteThisEntity(); } @@ -363,7 +373,7 @@ bool32 sub_0809A758(u32 param_1, u32 param_2) { return FALSE; } -void (*const OctorokBossObject_Actions[])(Entity*) = { +void (*const OctorokBossObject_Actions[])(OctorokBossObjectEntity*) = { OctorokBossObject_Init, OctorokBossObject_Action1, OctorokBossObject_Action2, diff --git a/src/object/palaceArchway.c b/src/object/palaceArchway.c index 9a6f83dc..f4c237ef 100644 --- a/src/object/palaceArchway.c +++ b/src/object/palaceArchway.c @@ -4,6 +4,7 @@ * * @brief Palace Archway object */ +#define NENT_DEPRECATED #include "object.h" #include "tiles.h" diff --git a/src/object/paper.c b/src/object/paper.c index 195b3819..784fb257 100644 --- a/src/object/paper.c +++ b/src/object/paper.c @@ -4,7 +4,6 @@ * * @brief Paper object */ - #define NENT_DEPRECATED #include "functions.h" #include "map.h" diff --git a/src/object/parallaxRoomView.c b/src/object/parallaxRoomView.c index e796d683..f72cc80b 100644 --- a/src/object/parallaxRoomView.c +++ b/src/object/parallaxRoomView.c @@ -4,35 +4,42 @@ * * @brief Parallax Room View object */ +#define NENT_DEPRECATED #include "entity.h" #include "room.h" -void ParallaxRoomView(Entity* this) { - int iVar1; - int diffY; - int diffX; - int iVar4; - int temp; +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; + /*0x6a*/ u16 unk_6a; +} ParallaxRoomViewEntity; - if (this->action == 0) { - this->action = 1; - this->spriteSettings.draw = 3; - this->frameIndex = this->type2; - this->spriteOrientation.flipY = 3; - this->spriteRendering.b3 = 3; - if (this->type == 3) { - this->spritePriority.b0 = 6; +void ParallaxRoomView(ParallaxRoomViewEntity* this) { + s32 iVar1; + s32 diffY; + s32 diffX; + s32 iVar4; + s32 temp; + + if (super->action == 0) { + super->action = 1; + super->spriteSettings.draw = 3; + super->frameIndex = super->type2; + super->spriteOrientation.flipY = 3; + super->spriteRendering.b3 = 3; + if (super->type == 3) { + super->spritePriority.b0 = 6; } else { - this->spritePriority.b0 = 7; + super->spritePriority.b0 = 7; } - this->field_0x68.HWORD = this->x.HALF.HI; - this->field_0x6a.HWORD = this->y.HALF.HI; - SetDefaultPriority(this, 6); + this->unk_68 = super->x.HALF.HI; + this->unk_6a = super->y.HALF.HI; + SetDefaultPriority(super, 6); } - if ((this->flags & 0x10) == 0) { - iVar4 = (int)this->x.HALF.HI - (int)gRoomControls.scroll_x; + if ((super->flags & 0x10) == 0) { + iVar4 = super->x.HALF.HI - gRoomControls.scroll_x; diffX = iVar4 - 0x78; - iVar1 = (int)this->y.HALF.HI - (int)gRoomControls.scroll_y; + iVar1 = super->y.HALF.HI - gRoomControls.scroll_y; diffY = iVar1 - 0x50; if (diffX < 0) { temp = (iVar4 - 0x75); @@ -51,18 +58,18 @@ void ParallaxRoomView(Entity* this) { if (diffX < -0x10) { diffX = -0x10; } - if (0x10 < diffX) { + if (diffX > 0x10) { diffX = 0x10; } if (diffY < -0x10) { diffY = -0x10; } - if (0x10 < diffY) { + if (diffY > 0x10) { diffY = 0x10; } - this->x.HALF.HI = this->field_0x68.HWORD + diffX; - this->y.HALF.HI = this->field_0x6a.HWORD + diffY; + super->x.HALF.HI = this->unk_68 + diffX; + super->y.HALF.HI = this->unk_6a + diffY; } } diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index 34db5113..e98c5144 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -4,52 +4,57 @@ * * @brief Pinwheel object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" -#include "global.h" #include "object.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u16 unk_68; +} PinwheelEntity; + static const u16 gUnk_08125050[] = { KUMOUE_02_AWASE_01, KUMOUE_02_AWASE_02, KUMOUE_02_AWASE_03, KUMOUE_02_AWASE_04, KUMOUE_02_AWASE_05, BEGIN_1, }; extern u32 gUnk_020342F8; -void Pinwheel_Init(Entity*); -void Pinwheel_Action1(Entity*); -void Pinwheel_Action2(Entity*); +void Pinwheel_Init(PinwheelEntity* this); +void Pinwheel_Action1(PinwheelEntity* this); +void Pinwheel_Action2(PinwheelEntity* this); -void Pinwheel(Entity* this) { - static void (*const Pinwheel_Actions[])(Entity*) = { +void Pinwheel(PinwheelEntity* this) { + static void (*const Pinwheel_Actions[])(PinwheelEntity*) = { Pinwheel_Init, Pinwheel_Action1, Pinwheel_Action2, }; - u16 x = this->health; + u16 x = super->health; if ((x & 0x7f) != 0) { if (ReadBit(&gUnk_020342F8, x - 1) == 0) { DeleteThisEntity(); } } - Pinwheel_Actions[this->action](this); + Pinwheel_Actions[super->action](this); } -void Pinwheel_Init(Entity* this) { - this->field_0x68.HWORD = gUnk_08125050[this->type2]; - this->spritePriority.b0 = 7; - if (CheckLocalFlag(this->field_0x68.HWORD) != 0) { - this->action = 2; +void Pinwheel_Init(PinwheelEntity* this) { + this->unk_68 = gUnk_08125050[super->type2]; + super->spritePriority.b0 = 7; + if (CheckLocalFlag(this->unk_68) != 0) { + super->action = 2; } else { - this->action = 1; + super->action = 1; } - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } -void Pinwheel_Action1(Entity* this) { - if (CheckLocalFlag(this->field_0x68.HWORD) != 0) { - this->action = 2; - CreateDust(this); +void Pinwheel_Action1(PinwheelEntity* this) { + if (CheckLocalFlag(this->unk_68) != 0) { + super->action = 2; + CreateDust(super); } } -void Pinwheel_Action2(Entity* this) { - GetNextFrame(this); +void Pinwheel_Action2(PinwheelEntity* this) { + GetNextFrame(super); } diff --git a/src/object/playerClone.c b/src/object/playerClone.c index aab3040c..5a2caf96 100644 --- a/src/object/playerClone.c +++ b/src/object/playerClone.c @@ -1,10 +1,10 @@ -#define NENT_DEPRECATED /** * @file playerClone.c * @ingroup Objects * * @brief Player Clone object */ +#define NENT_DEPRECATED #include "asm.h" #include "collision.h" #include "effects.h" @@ -36,13 +36,13 @@ void sub_08084B1C(PlayerCloneEntity*); void sub_08084CAC(PlayerCloneEntity*); void PlayerClone(Entity* this) { - static void (*const actionFuncs[])(PlayerCloneEntity*) = { + static void (*const PlayerClone_Actions[])(PlayerCloneEntity*) = { PlayerClone_Init, PlayerClone_Action1, PlayerClone_Action2, }; - actionFuncs[this->action]((PlayerCloneEntity*)this); + PlayerClone_Actions[this->action]((PlayerCloneEntity*)this); } void PlayerClone_Init(PlayerCloneEntity* this) { diff --git a/src/object/pot.c b/src/object/pot.c index ba6abbcf..dba82127 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -4,171 +4,183 @@ * * @brief Pot object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" #include "hitbox.h" #include "object.h" +#include "object/itemOnGround.h" #include "player.h" #include "room.h" #include "sound.h" #include "tiles.h" -void Pot_Action5(Entity*); -static void sub_08082850(Entity*, Entity*); -void sub_08082608(Entity*); -void Pot_Init(Entity*); -void Pot_Action1(Entity*); -void Pot_Action2(Entity*); -void Pot_Action3(Entity*); -void Pot_Action4(Entity*); -void Pot_Action5(Entity*); -void sub_08082510(Entity*); -void nullsub_511(Entity*); -void sub_08082588(Entity*); -void sub_0808259C(Entity*); -void sub_080825E8(Entity*); -void sub_080825F0(Entity*); -void sub_08082608(Entity*); -void sub_08082818(Entity*); -void nullsub_512(Entity*); -void sub_080827F8(Entity*); -void sub_08082778(Entity*); -void sub_0808270C(Entity*); -void sub_080826FC(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u8 unused2[11]; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u8 unused3[8]; + /*0x86*/ u16 unk_86; +} PotEntity; + +void Pot_Action5(PotEntity*); +static void sub_08082850(PotEntity*, Entity*); +void sub_08082608(PotEntity* this); +void Pot_Init(PotEntity* this); +void Pot_Action1(PotEntity* this); +void Pot_Action2(PotEntity* this); +void Pot_Action3(PotEntity* this); +void Pot_Action4(PotEntity* this); +void Pot_Action5(PotEntity* this); +void sub_08082510(PotEntity* this); +void nullsub_511(PotEntity* this); +void sub_08082588(PotEntity* this); +void sub_0808259C(PotEntity* this); +void sub_080825E8(PotEntity* this); +void sub_080825F0(PotEntity* this); +void sub_08082608(PotEntity* this); +void sub_08082818(PotEntity* this); +void nullsub_512(PotEntity* this); +void sub_080827F8(PotEntity* this); +void sub_08082778(PotEntity* this); +void sub_0808270C(PotEntity* this); +void sub_080826FC(PotEntity* this); extern void RegisterCarryEntity(Entity*); extern void sub_08016A6C(Entity*); -void Pot(Entity* this) { - static void (*const Pot_Actions[])(Entity*) = { +void Pot(PotEntity* this) { + static void (*const Pot_Actions[])(PotEntity*) = { Pot_Init, Pot_Action1, Pot_Action2, Pot_Action3, Pot_Action4, Pot_Action5, }; - Pot_Actions[this->action](this); - this->contactFlags = 0; + Pot_Actions[super->action](this); + super->contactFlags = 0; } -void Pot_Init(Entity* this) { - if (this->type2 == 1 && CheckFlags(this->field_0x86.HWORD)) { +void Pot_Init(PotEntity* this) { + if (super->type2 == 1 && CheckFlags(this->unk_86)) { DeleteThisEntity(); } - this->action = 1; - this->hitbox = (Hitbox*)&gHitbox_18; - this->speed = 0x80; - this->y.HALF.HI += 3; - this->carryFlags = 0; - COLLISION_ON(this); - this->health = 1; - this->collisionFlags = 7; - this->hitType = 0x6E; - this->flags2 = 0x84; - this->gustJarFlags = 0x12; - if (this->collisionLayer == 0) { - ResolveCollisionLayer(this); + super->action = 1; + super->hitbox = (Hitbox*)&gHitbox_18; + super->speed = 0x80; + super->y.HALF.HI += 3; + super->carryFlags = 0; + COLLISION_ON(super); + super->health = 1; + super->collisionFlags = 7; + super->hitType = 0x6E; + super->flags2 = 0x84; + super->gustJarFlags = 0x12; + if (super->collisionLayer == 0) { + ResolveCollisionLayer(super); } - this->field_0x70.HALF.LO = GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer); - if ((u16)this->field_0x70.HALF.LO == SPECIAL_META_TILE_0) { + this->unk_70 = GetMetaTileIndex(COORD_TO_TILE(super), super->collisionLayer); + if (this->unk_70 == SPECIAL_META_TILE_0) { DeleteThisEntity(); } - SetMetaTile(SPECIAL_META_TILE_0, COORD_TO_TILE(this), this->collisionLayer); - InitializeAnimation(this, 5); + SetMetaTile(SPECIAL_META_TILE_0, COORD_TO_TILE(super), super->collisionLayer); + InitializeAnimation(super, 5); } -void Pot_Action1(Entity* this) { +void Pot_Action1(PotEntity* this) { u32 tileType; - u32 var0 = this->contactFlags & 0x7F; + u32 var0 = super->contactFlags & 0x7F; switch (var0) { case 0x13: - this->action = 3; - this->subAction = 0; + super->action = 3; + super->subAction = 0; break; case 0x1D: - SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); - this->action = 5; - this->zVelocity = Q_16_16(2.625); - this->spriteOffsetY = 0; - this->spriteSettings.shadow = 1; - this->spritePriority.b1 = 3; - COLLISION_OFF(this); + SetMetaTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); + super->action = 5; + super->zVelocity = Q_16_16(2.625); + super->spriteOffsetY = 0; + super->spriteSettings.shadow = 1; + super->spritePriority.b1 = 3; + COLLISION_OFF(super); Pot_Action5(this); break; default: - tileType = GetMetaTileTypeByEntity(this); + tileType = GetMetaTileTypeByEntity(super); if (tileType != 0x4000) { switch (tileType) { case SPECIAL_META_TILE_4: case SPECIAL_META_TILE_3: case SPECIAL_META_TILE_2: case SPECIAL_META_TILE_1: - this->direction = (tileType - SPECIAL_META_TILE_1) * 8; - this->timer = 32; - this->action = 4; + super->direction = (tileType - SPECIAL_META_TILE_1) * 8; + super->timer = 32; + super->action = 4; if (gPlayerState.flags & PL_MINISH) { - this->speed >>= 1; - this->timer = 64; + super->speed >>= 1; + super->timer = 64; } - SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); EnqueueSFX(SFX_10F); break; case SPECIAL_META_TILE_103: - SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); DeleteThisEntity(); break; default: - if (GetVvvAtEntity(this) == VVV_13) { - CreateFx(this, FX_FALL_DOWN, 0); + if (GetVvvAtEntity(super) == VVV_13) { + CreateFx(super, FX_FALL_DOWN, 0); } else if (tileType == SPECIAL_META_TILE_5) { gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT; - SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetMetaTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); } sub_08082850(this, NULL); break; } } else { - RegisterCarryEntity(this); + RegisterCarryEntity(super); } break; } } -void Pot_Action2(Entity* this) { - static void (*const subActionFuncs[])(Entity*) = { +void Pot_Action2(PotEntity* this) { + static void (*const subActionFuncs[])(PotEntity*) = { sub_08082510, nullsub_511, sub_08082588, sub_0808259C, sub_080825E8, sub_080825F0, sub_08082608, }; - subActionFuncs[this->subAction](this); + subActionFuncs[super->subAction](this); } -void sub_08082510(Entity* this) { - COLLISION_ON(this); - this->hitbox = (Hitbox*)&gUnk_080FD340; - this->collisionFlags = 7; - this->hitType = 1; - this->flags2 = gPlayerEntity.flags2; - this->spriteOffsetY = 0; - SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); - this->subAction++; +void sub_08082510(PotEntity* this) { + COLLISION_ON(super); + super->hitbox = (Hitbox*)&gUnk_080FD340; + super->collisionFlags = 7; + super->hitType = 1; + super->flags2 = gPlayerEntity.flags2; + super->spriteOffsetY = 0; + SetMetaTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); + super->subAction++; } -void nullsub_511(Entity* this) { +void nullsub_511(PotEntity* this) { } -void sub_08082588(Entity* this) { - this->spritePriority.b1 = 3; +void sub_08082588(PotEntity* this) { + super->spritePriority.b1 = 3; } -void sub_0808259C(Entity* this) { - switch (sub_080043E8(this)) { +void sub_0808259C(PotEntity* this) { + switch (sub_080043E8(super)) { case 2: - CreateFx(this, FX_WATER_SPLASH, 0); + CreateFx(super, FX_WATER_SPLASH, 0); break; case 1: - CreateFx(this, FX_FALL_DOWN, 0); + CreateFx(super, FX_FALL_DOWN, 0); break; case 3: - CreateFx(this, FX_LAVA_SPLASH, 0); + CreateFx(super, FX_LAVA_SPLASH, 0); break; default: sub_08082850(this, &gPlayerEntity); @@ -178,131 +190,131 @@ void sub_0808259C(Entity* this) { DeleteThisEntity(); } -void sub_080825E8(Entity* this) { +void sub_080825E8(PotEntity* this) { DeleteThisEntity(); } -void sub_080825F0(Entity* this) { +void sub_080825F0(PotEntity* this) { if (gPlayerState.heldObject == 0) { sub_08082608(this); } } -void sub_08082608(Entity* this) { - this->action = 1; - this->subAction = 0; +void sub_08082608(PotEntity* this) { + super->action = 1; + super->subAction = 0; } -void Pot_Action4(Entity* this) { +void Pot_Action4(PotEntity* this) { u32 tileType; - sub_0800445C(this); - if (this->timer-- != 0) { - LinearMoveUpdate(this); - sub_08016A6C(this); + sub_0800445C(super); + if (super->timer-- != 0) { + LinearMoveUpdate(super); + sub_08016A6C(super); return; } - if (sub_0800442E(this)) { + if (sub_0800442E(super)) { return; } - this->action = 1; + super->action = 1; if (gPlayerState.flags & PL_MINISH) { - this->speed <<= 1; + super->speed <<= 1; } - this->field_0x70.HALF.LO = GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer); - tileType = GetMetaTileTypeByEntity(this); + this->unk_70 = GetMetaTileIndex(COORD_TO_TILE(super), super->collisionLayer); + tileType = GetMetaTileTypeByEntity(super); switch (tileType) { case 0x71: case 0x72: sub_08082850(this, NULL); break; default: - SetMetaTile(SPECIAL_META_TILE_0, COORD_TO_TILE(this), this->collisionLayer); - RegisterCarryEntity(this); + SetMetaTile(SPECIAL_META_TILE_0, COORD_TO_TILE(super), super->collisionLayer); + RegisterCarryEntity(super); break; } } -void Pot_Action3(Entity* this) { - static void (*const subActionFuncs[])(Entity*) = { +void Pot_Action3(PotEntity* this) { + static void (*const subActionFuncs[])(PotEntity*) = { sub_080826FC, sub_0808270C, sub_08082778, sub_080827F8, nullsub_512, sub_08082818, }; - subActionFuncs[this->subAction](this); + subActionFuncs[super->subAction](this); } -void sub_080826FC(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 48; - this->timer = 0; +void sub_080826FC(PotEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 48; + super->timer = 0; } -void sub_0808270C(Entity* this) { - if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->contactFlags & 0x7F) != 0x13) { - this->spriteOffsetX = 0; - this->action = 1; - SetMetaTile(SPECIAL_META_TILE_0, COORD_TO_TILE(this), this->collisionLayer); +void sub_0808270C(PotEntity* this) { + if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) { + super->spriteOffsetX = 0; + super->action = 1; + SetMetaTile(SPECIAL_META_TILE_0, COORD_TO_TILE(super), super->collisionLayer); } else { - sub_0806F4E8(this); + sub_0806F4E8(super); } } -void sub_08082778(Entity* this) { - if (this->timer == 0) { - this->timer = 1; - this->spriteOffsetX = 0; - this->spriteOffsetY = -2; - SetMetaTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); +void sub_08082778(PotEntity* this) { + if (super->timer == 0) { + super->timer = 1; + super->spriteOffsetX = 0; + super->spriteOffsetY = -2; + SetMetaTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); } - if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (this->contactFlags & 0x7F) != 0x13) { + if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) { sub_08082850(this, NULL); } else { - sub_0806F3E4(this); + sub_0806F3E4(super); } } -void sub_080827F8(Entity* this) { +void sub_080827F8(PotEntity* this) { if (gPlayerState.field_0x1c == 0) { sub_08082850(this, NULL); } } -void nullsub_512(Entity* this) { +void nullsub_512(PotEntity* this) { } -void sub_08082818(Entity* this) { +void sub_08082818(PotEntity* this) { sub_08082850(this, NULL); } -void Pot_Action5(Entity* this) { - if (this->zVelocity < 0) { - this->spriteSettings.flipY = 1; +void Pot_Action5(PotEntity* this) { + if (super->zVelocity < 0) { + super->spriteSettings.flipY = 1; } - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { sub_08082850(this, NULL); } } -static void sub_08082850(Entity* this, Entity* parent) { - u32 parameter = sub_0808288C(this, this->type, this->field_0x7c.BYTES.byte1, this->type2); - Entity* fxEntity = CreateFx(this, FX_POT_SHATTER, parameter); +static void sub_08082850(PotEntity* this, Entity* parent) { + u32 parameter = sub_0808288C(super, super->type, this->unk_7d, super->type2); + Entity* fxEntity = CreateFx(super, FX_POT_SHATTER, parameter); if (fxEntity) { fxEntity->parent = parent; } - if (this->type2 == 1) { - SetFlag(this->field_0x86.HWORD); + if (super->type2 == 1) { + SetFlag(this->unk_86); } DeleteThisEntity(); } u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) { - Entity* entity; + ItemOnGroundEntity* entity; u32 result = 0; switch (form) { case 0xFF: @@ -312,13 +324,13 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) { result = 0x80; break; default: - entity = CreateObjectWithParent(this, GROUND_ITEM, form, arg2); + entity = (ItemOnGroundEntity*)CreateObjectWithParent(this, GROUND_ITEM, form, arg2); if (entity != NULL) { if (arg3 == 2) { - entity->timer = 5; - entity->field_0x86.HWORD = this->field_0x86.HWORD; + entity->base.timer = 5; + entity->unk_86 = ((PotEntity*)this)->unk_86; // This function is also used by flyingSkull. } else { - entity->timer = 0; + entity->base.timer = 0; } } break; diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c index 42d8c172..a10818eb 100644 --- a/src/object/pressurePlate.c +++ b/src/object/pressurePlate.c @@ -59,9 +59,7 @@ void PressurePlate_Init(PressurePlateEntity* this) { } void PressurePlate_Action1(PressurePlateEntity* this) { - u8 weight; - - weight = sub_08088938(this) + get_standing_count(this); + u8 weight = sub_08088938(this) + get_standing_count(this); if (super->type + 2 <= weight) { super->action = 2; super->subtimer = 0; @@ -87,10 +85,8 @@ void PressurePlate_Action1(PressurePlateEntity* this) { } void PressurePlate_Action2(PressurePlateEntity* this) { - u8 weight; - if (this->canToggle) { - weight = sub_08088938(this) + get_standing_count(this); + u8 weight = sub_08088938(this) + get_standing_count(this); if (super->type + 2 > weight) { super->action = 1; super->animationState = weight; diff --git a/src/object/pullableLever.c b/src/object/pullableLever.c index 7c7186c6..8304d4ba 100644 --- a/src/object/pullableLever.c +++ b/src/object/pullableLever.c @@ -4,10 +4,8 @@ * * @brief Pullable Lever object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" #include "sound.h" diff --git a/src/object/pullableMushroom.c b/src/object/pullableMushroom.c index 4f82e297..fc087b4c 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -4,7 +4,6 @@ * * @brief Pullable Mushroom object */ - #define NENT_DEPRECATED #include "functions.h" #include "game.h" @@ -198,7 +197,7 @@ void sub_0808ACEC(PullableMushroomEntity* this) { case 0x14: case 0x16: COLLISION_OFF(super); - super->animationState = sub_0806F5A4(super->knockbackDirection); + super->animationState = GetAnimationStateForDirection4(super->knockbackDirection); super->subAction = 2; super->timer = 2; break; diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index e8ad624b..b49fd6ad 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -4,7 +4,6 @@ * * @brief Pushable Furniture object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" @@ -58,7 +57,7 @@ void PushableFurniture(PushableFurnitureEntity* this) { } } -void sub_0808F990(PushableFurnitureEntity* this) { +void PushableFurniture_Init(PushableFurnitureEntity* this) { bool32 condition; super->action = 1; @@ -632,7 +631,7 @@ void sub_08090514(PushableFurnitureEntity* this) { } void (*const PushableFurniture_Actions[])(PushableFurnitureEntity*) = { - sub_0808F990, + PushableFurniture_Init, PushableFurniture_Action1, PushableFurniture_Action2, }; diff --git a/src/object/pushableGrave.c b/src/object/pushableGrave.c index 82099ec4..4145d7cf 100644 --- a/src/object/pushableGrave.c +++ b/src/object/pushableGrave.c @@ -4,7 +4,6 @@ * * @brief Pushable Grave object */ - #define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index c259ddfc..d32214ce 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -4,7 +4,6 @@ * * @brief Pushable Lever object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/pushableRock.c b/src/object/pushableRock.c index 3c4b38d3..203f2848 100644 --- a/src/object/pushableRock.c +++ b/src/object/pushableRock.c @@ -4,7 +4,6 @@ * * @brief Pushable Rock object */ - #define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 32095765..baf07cbc 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -4,111 +4,124 @@ * * @brief Railtrack object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "room.h" #include "sound.h" #include "tiles.h" -void sub_08085394(Entity*); -void sub_0808543C(Entity*); -void Railtrack_Init(Entity*); -void Railtrack_Action1(Entity*); -void Railtrack_Action2(Entity*); -void Railtrack_Action3(Entity*); -u32 sub_080854A8(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16* unk_70; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ union SplitHWord unk_7c; + /*0x7e*/ u8 unused2[8]; + /*0x86*/ u16 unk_86; +} RailtrackEntity; + +void sub_08085394(RailtrackEntity* this); +void sub_0808543C(RailtrackEntity* this); +void Railtrack_Init(RailtrackEntity* this); +void Railtrack_Action1(RailtrackEntity* this); +void Railtrack_Action2(RailtrackEntity* this); +void Railtrack_Action3(RailtrackEntity* this); +u32 sub_080854A8(RailtrackEntity* this); extern s8 gUnk_080B4488[][2]; -void Railtrack(Entity* this) { - static void (*const Railtrack_Actions[])(Entity*) = { +void Railtrack(RailtrackEntity* this) { + static void (*const Railtrack_Actions[])(RailtrackEntity*) = { Railtrack_Init, Railtrack_Action1, Railtrack_Action2, Railtrack_Action3, }; - Railtrack_Actions[this->action](this); + Railtrack_Actions[super->action](this); } -void Railtrack_Init(Entity* this) { +void Railtrack_Init(RailtrackEntity* this) { u32 uVar1; - this->action = 1; - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 7; - if ((this->type2 & 1) != 0) { - this->field_0x7c.HALF.LO = -1; + super->action = 1; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 7; + if ((super->type2 & 1) != 0) { + this->unk_7c.HWORD = -1; } else { - this->field_0x7c.HALF.LO = 1; + this->unk_7c.HWORD = 1; } - this->animationState = this->type2 & 2; - if (this->type == 3) { - uVar1 = CheckFlags(this->field_0x86.HWORD); - this->field_0x7a.HWORD = uVar1; + super->animationState = super->type2 & 2; + if (super->type == 3) { + uVar1 = CheckFlags(this->unk_86); + this->unk_7a = uVar1; if ((u16)(uVar1 & -1) != 0) { - this->animationState = (this->animationState + 2) & 3; - this->action = 3; + super->animationState = (super->animationState + 2) & 3; + super->action = 3; } } - InitializeAnimation(this, this->animationState); - this->field_0x70.WORD = (u32)&GetLayerByIndex(this->collisionLayer)->mapData[COORD_TO_TILE(this)]; + InitializeAnimation(super, super->animationState); + this->unk_70 = &GetLayerByIndex(super->collisionLayer)->mapData[COORD_TO_TILE(super)]; sub_08085394(this); } -void Railtrack_Action1(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD)) { - this->action = 2; - this->subtimer = 8; - if (this->type == 1) { - ClearFlag(this->field_0x86.HWORD); +void Railtrack_Action1(RailtrackEntity* this) { + if (CheckFlags(this->unk_86)) { + super->action = 2; + super->subtimer = 8; + if (super->type == 1) { + ClearFlag(this->unk_86); } - this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; - InitializeAnimation(this, this->animationState); + super->animationState = (super->animationState + this->unk_7c.HALF.LO) & 3; + InitializeAnimation(super, super->animationState); sub_0808543C(this); EnqueueSFX(SFX_151); } } -void Railtrack_Action2(Entity* this) { - if (--this->subtimer == 0) { - this->action = 3; - this->subtimer = this->timer; - this->field_0x7a.HWORD = CheckFlags(this->field_0x86.HWORD); - this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; - InitializeAnimation(this, this->animationState); +void Railtrack_Action2(RailtrackEntity* this) { + if (--super->subtimer == 0) { + super->action = 3; + super->subtimer = super->timer; + this->unk_7a = CheckFlags(this->unk_86); + super->animationState = (super->animationState + this->unk_7c.HALF.LO) & 3; + InitializeAnimation(super, super->animationState); sub_08085394(this); EnqueueSFX(SFX_151); } } -void Railtrack_Action3(Entity* this) { +void Railtrack_Action3(RailtrackEntity* this) { if (sub_080854A8(this) == 0) { - switch (this->type) { + switch (super->type) { case 0: case 1: break; case 2: - if (CheckFlags(this->field_0x86.HWORD) == 0) { - this->action = 1; + if (CheckFlags(this->unk_86) == 0) { + super->action = 1; return; } break; case 3: - if (CheckFlags(this->field_0x86.HWORD) == *(u16*)&this->field_0x7a) { - this->subtimer = 255; + if (CheckFlags(this->unk_86) == this->unk_7a) { + super->subtimer = 255; } else { - this->subtimer = 1; + super->subtimer = 1; } } - if (--this->subtimer == 0) { - this->action = 2; - this->subtimer = 8; - this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3; - InitializeAnimation(this, this->animationState); + if (--super->subtimer == 0) { + super->action = 2; + super->subtimer = 8; + super->animationState = (super->animationState + this->unk_7c.HALF.LO) & 3; + InitializeAnimation(super, super->animationState); sub_0808543C(this); EnqueueSFX(SFX_151); } @@ -117,47 +130,47 @@ void Railtrack_Action3(Entity* this) { static const u16 gUnk_081205E0[] = { SPECIAL_META_TILE_24, SPECIAL_META_TILE_25 }; -void sub_08085394(Entity* this) { +void sub_08085394(RailtrackEntity* this) { u32 specialTile; u16* layerData; u32 tilePos; - s8 offset; + s8 offsetset; - specialTile = gUnk_081205E0[this->animationState / 2]; - offset = gUnk_080B4488[this->animationState / 2][0]; - layerData = (u16*)this->field_0x70.WORD; - tilePos = COORD_TO_TILE(this); + specialTile = gUnk_081205E0[super->animationState / 2]; + offsetset = gUnk_080B4488[super->animationState / 2][0]; + layerData = this->unk_70; + tilePos = COORD_TO_TILE(super); - this->field_0x74.HWORD = *(layerData - offset); - SetMetaTile(specialTile, tilePos - offset, this->collisionLayer); + this->unk_74 = *(layerData - offsetset); + SetMetaTile(specialTile, tilePos - offsetset, super->collisionLayer); - this->field_0x76.HWORD = layerData[0x0]; - SetMetaTile(specialTile, tilePos, this->collisionLayer); + this->unk_76 = layerData[0x0]; + SetMetaTile(specialTile, tilePos, super->collisionLayer); - this->field_0x78.HWORD = layerData[offset]; - SetMetaTile(specialTile, tilePos + offset, this->collisionLayer); + this->unk_78 = layerData[offsetset]; + SetMetaTile(specialTile, tilePos + offsetset, super->collisionLayer); } -void sub_0808543C(Entity* this) { +void sub_0808543C(RailtrackEntity* this) { s8* cVar1; u32 metaTilePos; s8 offset; - offset = gUnk_080B4488[this->animationState / 2][0]; - metaTilePos = COORD_TO_TILE(this); - SetMetaTile(this->field_0x74.HWORD, metaTilePos - offset, this->collisionLayer); - SetMetaTile(this->field_0x76.HWORD, metaTilePos, this->collisionLayer); - SetMetaTile(this->field_0x78.HWORD, metaTilePos + offset, this->collisionLayer); + offset = gUnk_080B4488[super->animationState / 2][0]; + metaTilePos = COORD_TO_TILE(super); + SetMetaTile(this->unk_74, metaTilePos - offset, super->collisionLayer); + SetMetaTile(this->unk_76, metaTilePos, super->collisionLayer); + SetMetaTile(this->unk_78, metaTilePos + offset, super->collisionLayer); } -u32 sub_080854A8(Entity* this) { +u32 sub_080854A8(RailtrackEntity* this) { u16 var0; u16* var1; s8* var2; - var0 = gUnk_081205E0[this->animationState / 2]; - var2 = gUnk_080B4488[this->animationState / 2]; - var1 = (u16*)this->field_0x70.WORD; + var0 = gUnk_081205E0[super->animationState / 2]; + var2 = gUnk_080B4488[super->animationState / 2]; + var1 = this->unk_70; if (var0 != *(var1 - var2[0])) { return TRUE; } diff --git a/src/object/rupee.c b/src/object/rupee.c index 2d0756d8..fe38b3ad 100644 --- a/src/object/rupee.c +++ b/src/object/rupee.c @@ -4,6 +4,7 @@ * * @brief Rupee object */ +#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" @@ -14,56 +15,55 @@ void Rupee_Action_1(Entity*); void Rupee_Action_2(Entity*); // Main -void Rupee(Entity* ent) { +void Rupee(Entity* this) { static void (*const Rupee_Actions[])(Entity*) = { Rupee_Init, Rupee_Action_1, Rupee_Action_2, }; - Rupee_Actions[ent->action](ent); + Rupee_Actions[this->action](this); } -void Rupee_Init(Entity* ent) { +void Rupee_Init(Entity* this) { Entity* itemEntity; - ent->action = 1; - ent->spriteSettings.draw = 0; - ent->hitbox = (Hitbox*)&gUnk_080FD1A8; - ent->collisionFlags |= 16; - itemEntity = CreateObject(GROUND_ITEM, ent->type, 0); + this->action = 1; + this->spriteSettings.draw = 0; + this->hitbox = (Hitbox*)&gUnk_080FD1A8; + this->collisionFlags |= 16; + itemEntity = CreateObject(GROUND_ITEM, this->type, 0); if (itemEntity != NULL) { itemEntity->timer = 10; - itemEntity->parent = ent; - ent->child = itemEntity; - CopyPosition(ent, itemEntity); - sub_08086A6C(ent); + itemEntity->parent = this; + this->child = itemEntity; + CopyPosition(this, itemEntity); + sub_08086A6C(this); } } -void Rupee_Action_1(Entity* ent) { - if (ent->child->next == NULL) { - ent->action = 2; +void Rupee_Action_1(Entity* this) { + if (this->child->next == NULL) { + this->action = 2; } else { - u32 iVar1 = sub_080044EC(ent, 10240); - if (iVar1 == 0) { - ent->action = 2; + if (sub_080044EC(this, 10240) == 0) { + this->action = 2; } - ProcessMovement0(ent); - CopyPosition(ent, ent->child); + ProcessMovement0(this); + CopyPosition(this, this->child); } } -void Rupee_Action_2(Entity* ent) { - ent->child->parent = NULL; +void Rupee_Action_2(Entity* this) { + this->child->parent = NULL; DeleteThisEntity(); } -void sub_08086A6C(Entity* ent) { +void sub_08086A6C(Entity* this) { u32 uVar1; uVar1 = Random(); - ent->zVelocity = Q_16_16(2.5); - ent->direction = DirectionNormalize(uVar1 >> 16); - ent->speed = uVar1 & 480; + this->zVelocity = Q_16_16(2.5); + this->direction = DirectionNormalize(uVar1 >> 16); + this->speed = uVar1 & 480; } diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c index cf26d02a..71f82754 100644 --- a/src/object/smallIceBlock.c +++ b/src/object/smallIceBlock.c @@ -4,7 +4,6 @@ * * @brief Small Ice Block object */ - #define NENT_DEPRECATED #include "collision.h" #include "functions.h" diff --git a/src/object/smoke.c b/src/object/smoke.c index afe2f97e..bffaa8b8 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -4,22 +4,23 @@ * * @brief Smoke object */ +#define NENT_DEPRECATED #include "object.h" -void sub_0808A40C(Entity*); -void sub_0808A46C(Entity*); +void Smoke_Type0(Entity*); +void Smoke_Type1(Entity*); void sub_0808A484(Entity*); void sub_0808A4D0(Entity*); void Smoke(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { - sub_0808A40C, - sub_0808A46C, + static void (*const Smoke_Types[])(Entity*) = { + Smoke_Type0, + Smoke_Type1, }; - typeFuncs[this->type](this); + Smoke_Types[this->type](this); } -void sub_0808A40C(Entity* this) { +void Smoke_Type0(Entity* this) { static const s8 gUnk_08121068[] = { -1, 1, -2, 2, 0, 0, 0, 0, }; @@ -39,7 +40,7 @@ void sub_0808A40C(Entity* this) { } } -void sub_0808A46C(Entity* this) { +void Smoke_Type1(Entity* this) { static void (*const actionFuncs[])(Entity*) = { sub_0808A484, sub_0808A4D0, @@ -51,7 +52,7 @@ void sub_0808A484(Entity* this) { this->action = 1; this->spriteSettings.draw = TRUE; this->speed = 0x40; - this->direction = 6; + this->direction = DirectionNorthEast | 0x2; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 0; this->spriteOrientation.flipY = 1; diff --git a/src/object/specialChest.c b/src/object/specialChest.c index 8d8fd2f1..fd57c7fc 100644 --- a/src/object/specialChest.c +++ b/src/object/specialChest.c @@ -7,6 +7,7 @@ #define NENT_DEPRECATED #include "entity.h" #include "flags.h" +#include "player.h" #include "room.h" extern void AddInteractableChest(Entity*); @@ -21,7 +22,7 @@ void SpecialChest(Entity* this) { this->collisionLayer = 1; AddInteractableChest(this); } - if (this->interactType != 0) { + if (this->interactType != INTERACTION_NONE) { OpenSmallChest(COORD_TO_TILE(this), 2); DeleteThisEntity(); } diff --git a/src/object/specialFx.c b/src/object/specialFx.c index e387b5a3..36104865 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -1,13 +1,12 @@ -#define NENT_DEPRECATED /** * @file specialFx.c * @ingroup Objects * * @brief Special FX object */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" -#include "global.h" #include "object.h" typedef struct { @@ -49,7 +48,7 @@ const struct_0811F960 gUnk_0811F960[] = { {0x5, 0x1, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_164}, {0x0, 0x1, 0x14, SFX_1A8}, - {0x0, 0x1, 0x10, SFX_88}, + {0x0, 0x1, 0x10, SFX_GRAB}, {0x0, 0x0, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_NONE}, @@ -88,9 +87,9 @@ const struct_0811F960 gUnk_0811F960[] = { {0x0, 0x1, 0x00, SFX_1B4}, {0x0, 0x1, 0x13, SFX_164}, {0x0, 0x1, 0x00, SFX_NONE}, - {0x0, 0x1, 0x10, SFX_88}, - {0x0, 0x1, 0x10, SFX_88}, - {0x0, 0x1, 0x10, SFX_88}, + {0x0, 0x1, 0x10, SFX_GRAB}, + {0x0, 0x1, 0x10, SFX_GRAB}, + {0x0, 0x1, 0x10, SFX_GRAB}, {0x0, 0x1, 0x00, SFX_NONE}, {0x0, 0x1, 0x00, SFX_NONE}, {0x0, 0x0, 0x00, SFX_11D}, @@ -122,8 +121,8 @@ const struct_0811F960 gUnk_0811F960[] = { // clang-format on void SpecialFx(Entity*); -void sub_080844E0(SpecialFxObject*); -void sub_080845B8(SpecialFxObject*); +void SpecialFx_Init(SpecialFxObject*); +void SpecialFx_Action1(SpecialFxObject*); void sub_080845DC(SpecialFxObject*); void sub_080845F8(SpecialFxObject*); void sub_08084630(SpecialFxObject*); @@ -139,14 +138,14 @@ void sub_080847D0(SpecialFxObject*); void sub_080847E0(SpecialFxObject*); void SpecialFx(Entity* this) { - static void (*const gUnk_0811FAC0[])(SpecialFxObject*) = { - sub_080844E0, - sub_080845B8, + static void (*const SpecialFx_Actions[])(SpecialFxObject*) = { + SpecialFx_Init, + SpecialFx_Action1, }; - gUnk_0811FAC0[this->action]((SpecialFxObject*)this); + SpecialFx_Actions[this->action]((SpecialFxObject*)this); } -void sub_080844E0(SpecialFxObject* this) { +void SpecialFx_Init(SpecialFxObject* this) { static const u8 gUnk_0811FAC8[] = { 0x03, 0x37, 0x38, 0x39 }; static const u8 gUnk_0811FACC[] = { 0x17, 0x3e, 0x3f, 0x40 }; const struct_0811F960* ptr; @@ -183,7 +182,7 @@ void sub_080844E0(SpecialFxObject* this) { } } -void sub_080845B8(SpecialFxObject* this) { +void SpecialFx_Action1(SpecialFxObject* this) { static void (*const gUnk_0811FAD0[])(SpecialFxObject*) = { sub_080845DC, sub_080845F8, sub_08084630, sub_08084694, (void (*)(SpecialFxObject*))DeleteEntity, sub_08084680, sub_080846B0, sub_0808471C, sub_08084770, sub_08084798, diff --git a/src/object/stoneTablet.c b/src/object/stoneTablet.c index 1c9edf93..b2be185e 100644 --- a/src/object/stoneTablet.c +++ b/src/object/stoneTablet.c @@ -4,6 +4,7 @@ * * @brief Stone Tablet object */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "room.h" diff --git a/src/object/swordParticle.c b/src/object/swordParticle.c index 3e197a29..63415fb6 100644 --- a/src/object/swordParticle.c +++ b/src/object/swordParticle.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "item.h" #include "object.h" @@ -70,15 +69,15 @@ void SwordParticle_Action1(SwordParticleEntity* this) { u32 tmp2; if (super->type2 != 0) { - if ((gPlayerState.field_0x1f[2] == 0) || ((gPlayerState.attack_status & 0x80) != 0)) { + if ((gPlayerState.bow_state == 0) || ((gPlayerState.attack_status & 0x80) != 0)) { DeleteThisEntity(); } - if (gPlayerState.field_0x1f[2] >= 0x50) { + if (gPlayerState.bow_state >= 0x50) { super->spriteSettings.draw = 1; - tmp1 = gPlayerState.field_0x1f[2]; + tmp1 = gPlayerState.bow_state; ptr = gUnk_081217D8; } else { - if (gPlayerState.field_0x1f[2] != 0) { + if (gPlayerState.bow_state != 0) { super->spriteSettings.draw = 0; return; } diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index 15f8eef5..732927c9 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -4,8 +4,8 @@ * * @brief Swordsman Newsletter object */ +#define NENT_DEPRECATED #include "entity.h" -#include "global.h" #include "message.h" extern void AddInteractableCheckableObject(Entity*); @@ -36,8 +36,8 @@ void SwordsmanNewsletter_Action1(Entity* this) { TEXT_INDEX(TEXT_NEWSLETTER, 4), TEXT_INDEX(TEXT_NEWSLETTER, 5), TEXT_INDEX(TEXT_NEWSLETTER, 6), TEXT_INDEX(TEXT_NEWSLETTER, 7), TEXT_INDEX(TEXT_NEWSLETTER, 8), }; - if (this->interactType != 0) { - this->interactType = 0; + if (this->interactType != INTERACTION_NONE) { + this->interactType = INTERACTION_NONE; MessageNoOverlap(messageIndices[this->type], this); } } diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c index d6f39c27..7ab561c5 100644 --- a/src/object/thoughtBubble.c +++ b/src/object/thoughtBubble.c @@ -4,8 +4,8 @@ * * @brief Thought Bubble object */ +#define NENT_DEPRECATED #include "entity.h" -#include "global.h" #include "sound.h" void ThoughtBubble_Init(Entity*); @@ -19,11 +19,11 @@ static const u16 ThoughtBubble_SFX[] = { }; void ThoughtBubble(Entity* this) { - static void (*const ThoughtBubble_Behaviors[])(Entity*) = { + static void (*const ThoughtBubble_Actions[])(Entity*) = { ThoughtBubble_Init, ThoughtBubble_Update, }; - ThoughtBubble_Behaviors[this->action](this); + ThoughtBubble_Actions[this->action](this); } void ThoughtBubble_Init(Entity* this) { diff --git a/src/object/thunderbold.c b/src/object/thunderbolt.c similarity index 73% rename from src/object/thunderbold.c rename to src/object/thunderbolt.c index 3b3f7fa3..697a32e3 100644 --- a/src/object/thunderbold.c +++ b/src/object/thunderbolt.c @@ -1,23 +1,21 @@ /** - * @file thunderbold.c + * @file thunderbolt.c * @ingroup Objects * - * @brief Thunderbold object + * @brief Thunderbolt object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { /*0x00*/ Entity base; -} ThunderboldEntity; +} ThunderboltEntity; -void Thunderbold_Init(ThunderboldEntity*); -void Thunderbold_Action1(ThunderboldEntity*); -void sub_08093ED0(ThunderboldEntity*); -void sub_08093EF0(ThunderboldEntity*); +void Thunderbolt_Init(ThunderboltEntity*); +void Thunderbolt_Action1(ThunderboltEntity*); +void sub_08093ED0(ThunderboltEntity*); +void sub_08093EF0(ThunderboltEntity*); typedef struct { u16 sfx; @@ -31,15 +29,15 @@ const struct_08122950 gUnk_08122950[] = { { 0, 31, 0 }, }; -void Thunderbold(ThunderboldEntity* this) { - static void (*const Thunderbold_Actions[])(ThunderboldEntity*) = { - Thunderbold_Init, - Thunderbold_Action1, +void Thunderbolt(ThunderboltEntity* this) { + static void (*const Thunderbolt_Actions[])(ThunderboltEntity*) = { + Thunderbolt_Init, + Thunderbolt_Action1, }; - Thunderbold_Actions[super->action](this); + Thunderbolt_Actions[super->action](this); } -void Thunderbold_Init(ThunderboldEntity* this) { +void Thunderbolt_Init(ThunderboltEntity* this) { const struct_08122950* ptr; super->action = 1; super->flags &= ~0x80; @@ -57,22 +55,22 @@ void Thunderbold_Init(ThunderboldEntity* this) { } } -void Thunderbold_Action1(ThunderboldEntity* this) { - static void (*const gUnk_08122964[])(ThunderboldEntity*) = { +void Thunderbolt_Action1(ThunderboltEntity* this) { + static void (*const gUnk_08122964[])(ThunderboltEntity*) = { sub_08093ED0, sub_08093EF0, }; gUnk_08122964[gUnk_08122950[super->type].unk_2 >> 4](this); } -void sub_08093ED0(ThunderboldEntity* this) { +void sub_08093ED0(ThunderboltEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { DeleteEntity(super); } } -void sub_08093EF0(ThunderboldEntity* this) { +void sub_08093EF0(ThunderboltEntity* this) { Entity* object; switch (super->type) { case 0: @@ -83,7 +81,7 @@ void sub_08093EF0(ThunderboldEntity* this) { if ((super->frame & ANIM_DONE) == 0) { return; } - object = CreateObject(THUNDERBOLD, 1, 0); + object = CreateObject(THUNDERBOLT, 1, 0); if (object != NULL) { object->parent = super->parent; CopyPosition(super, object); @@ -94,7 +92,7 @@ void sub_08093EF0(ThunderboldEntity* this) { GetNextFrame(super); if ((super->frame & 1) != 0) { super->frame = 0; - object = CreateObject(THUNDERBOLD, 2, 0); + object = CreateObject(THUNDERBOLT, 2, 0); if (object != NULL) { object->parent = super->parent; CopyPosition(super, object); diff --git a/src/object/titleScreenObject.c b/src/object/titleScreenObject.c index 27f15290..9144d0e3 100644 --- a/src/object/titleScreenObject.c +++ b/src/object/titleScreenObject.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" void TitleScreenObject_Type0(Entity*); diff --git a/src/object/trapdoor.c b/src/object/trapdoor.c index c28517e9..2bf94151 100644 --- a/src/object/trapdoor.c +++ b/src/object/trapdoor.c @@ -4,6 +4,7 @@ * * @brief Trapdoor object */ +#define NENT_DEPRECATED #include "item.h" #include "object.h" @@ -37,7 +38,7 @@ void Trapdoor_Init(Entity* this) { } void Trapdoor_Action1(Entity* this) { - if (CheckLocalFlag(0x74)) { + if (CheckLocalFlag(MIZUKAKI_STAIR)) { GetNextFrame(this); if ((this->frame == 1) && (this->subAction == 0)) { this->frame = 0; @@ -68,7 +69,7 @@ void Trapdoor_Action3(Entity* this) { sub_08099ECC(this); RequestPriorityDuration(this, 30); } - if (CheckLocalFlag(0x75)) { + if (CheckLocalFlag(MIZUKAKI_STAIR_WARP_OK)) { CreateHoleManager(0x7); } } diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 333c5d70..ed45e130 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -4,6 +4,7 @@ * * @brief Tree Hiding Portal object */ +#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" @@ -14,73 +15,79 @@ #include "sound.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[30]; + /*0x86*/ u16 unk_86; +} TreeHidingPortalEntity; + extern const s16 gUnk_080B4468[]; -void TreeHidingPortal_Init(Entity* this); -void TreeHidingPortal_Action1(Entity* this); -void TreeHidingPortal_Action2(Entity* this); -void TreeHidingPortal_Action3(Entity* this); +void TreeHidingPortal_Init(TreeHidingPortalEntity* this); +void TreeHidingPortal_Action1(TreeHidingPortalEntity* this); +void TreeHidingPortal_Action2(TreeHidingPortalEntity* this); +void TreeHidingPortal_Action3(TreeHidingPortalEntity* this); -static void sub_0809E96C(Entity* this); +static void sub_0809E96C(TreeHidingPortalEntity* this); static u32 sub_0809E9A0(void); -static void sub_0809E918(Entity* this); +static void sub_0809E918(TreeHidingPortalEntity* this); -void TreeHidingPortal(Entity* this) { - static void (*const TreeHidingPortal_Actions[])(Entity*) = { +void TreeHidingPortal(TreeHidingPortalEntity* this) { + static void (*const TreeHidingPortal_Actions[])(TreeHidingPortalEntity*) = { TreeHidingPortal_Init, TreeHidingPortal_Action1, TreeHidingPortal_Action2, TreeHidingPortal_Action3, }; - TreeHidingPortal_Actions[this->action](this); + TreeHidingPortal_Actions[super->action](this); } -void TreeHidingPortal_Init(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD)) { +void TreeHidingPortal_Init(TreeHidingPortalEntity* this) { + if (CheckFlags(this->unk_86)) { sub_0809E96C(this); DeleteThisEntity(); } - this->action = 1; - this->collisionLayer = 2; - UpdateSpriteForCollisionLayer(this); + super->action = 1; + super->collisionLayer = 2; + UpdateSpriteForCollisionLayer(super); } -void TreeHidingPortal_Action1(Entity* this) { +void TreeHidingPortal_Action1(TreeHidingPortalEntity* this) { - if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) { + if (sub_0800419C(super, &gPlayerEntity, 0x30, 0x30)) { if (CheckGlobalFlag(EZERO_1ST)) { if (((gRoomTransition.frameCount & 3) == 0)) { - CreateSparkle(this); + CreateSparkle(super); } } } if (sub_0809E9A0() == VVV_84) { - this->action = 2; - this->timer = 15; + super->action = 2; + super->timer = 15; SetPlayerControl(1); } } -void TreeHidingPortal_Action2(Entity* this) { - if (--this->timer == 0) { - this->action = 3; - this->timer = 60; - this->spriteSettings.draw = 0; +void TreeHidingPortal_Action2(TreeHidingPortalEntity* this) { + if (--super->timer == 0) { + super->action = 3; + super->timer = 60; + super->spriteSettings.draw = 0; sub_0809E96C(this); sub_0809E918(this); } } -void TreeHidingPortal_Action3(Entity* this) { - if (--this->timer == 0) { - SetFlag(this->field_0x86.HWORD); +void TreeHidingPortal_Action3(TreeHidingPortalEntity* this) { + if (--super->timer == 0) { + SetFlag(this->unk_86); SetPlayerControl(0); SoundReq(SFX_SECRET_BIG); DeleteThisEntity(); } } -static void sub_0809E918(Entity* this) { +static void sub_0809E918(TreeHidingPortalEntity* this) { static const s16 gUnk_08124364[] = { 0, -4, 8, -4, 16, -4, 22, -4, -8, -4, -16, -4, -22, -4, 0, -12, 0, 4, 8, -12, 8, 4, -8, -12, -8, 4, 8, -16, -8, -16, 12, -16, -12, -16, 16, -14, -16, -14, -1000, 0, @@ -88,7 +95,7 @@ static void sub_0809E918(Entity* this) { Entity* fx; const s16* i = gUnk_08124364; while (*i != -1000) { - fx = CreateFx(this, FX_BUSH, 0); + fx = CreateFx(super, FX_BUSH, 0); if (fx != NULL) { fx->x.HALF.HI += i[0]; fx->y.HALF.HI += i[1]; @@ -99,8 +106,8 @@ static void sub_0809E918(Entity* this) { } } -static void sub_0809E96C(Entity* this) { - CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8)); +static void sub_0809E96C(TreeHidingPortalEntity* this) { + CreateMinishEntrance(COORD_TO_TILE_OFFSET(super, 0x20, 0x8)); } static u32 sub_0809E9A0(void) { diff --git a/src/object/treeThorns.c b/src/object/treeThorns.c index 2b94d0ea..63776bee 100644 --- a/src/object/treeThorns.c +++ b/src/object/treeThorns.c @@ -4,6 +4,7 @@ * * @brief Three Thorns object */ +#define NENT_DEPRECATED #include "entity.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/vaati2Particle.c b/src/object/vaati2Particle.c index d3ce9d29..a9d42284 100644 --- a/src/object/vaati2Particle.c +++ b/src/object/vaati2Particle.c @@ -40,7 +40,6 @@ void sub_0809E7FC(Entity* this) { static const s8 gUnk_081242D8[] = { 0, -24, 16, -16, 24, 0, 16, 16, 0, 24, -16, 16, -24, 0, -16, -16, }; - int iVar1; const s8* ptr; ptr = &gUnk_081242D8[this->type2 * 2]; diff --git a/src/object/vaati3Arm.c b/src/object/vaati3Arm.c index 50d094a4..6ba31113 100644 --- a/src/object/vaati3Arm.c +++ b/src/object/vaati3Arm.c @@ -4,8 +4,8 @@ * * @brief Vaati3 Arm object */ +#define NENT_DEPRECATED #include "entity.h" -#include "global.h" #include "physics.h" void sub_080A0640(Entity*); diff --git a/src/object/vaati3PlayerObject.c b/src/object/vaati3PlayerObject.c index 0cec61c1..b491cb2a 100644 --- a/src/object/vaati3PlayerObject.c +++ b/src/object/vaati3PlayerObject.c @@ -4,6 +4,7 @@ * * @brief Vaati3 Player object */ +#define NENT_DEPRECATED #include "entity.h" #include "physics.h" #include "player.h" diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index d89c91fd..d83bc106 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -4,134 +4,146 @@ * * @brief Warp Point object */ +#define NENT_DEPRECATED #include "functions.h" #include "game.h" -#include "global.h" #include "hitbox.h" #include "object.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u8 unk_70; + /*0x71*/ u8 unused2[11]; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u8 unused3[6]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} WarpPointEntity; + extern void EnableDungeonWarp(u32); extern u32 IsDungeonWarpActive(u32); -void WarpPoint_Init(Entity*); -void WarpPoint_Action1(Entity*); -void WarpPoint_Action2(Entity*); -void WarpPoint_Action3(Entity*); -void WarpPoint_Action4(Entity*); -void WarpPoint_Action5(Entity*); -void sub_0808B73C(Entity*); -u32 sub_0808B7C8(Entity*); -void sub_0808B830(Entity*); +void WarpPoint_Init(WarpPointEntity* this); +void WarpPoint_Action1(WarpPointEntity* this); +void WarpPoint_Action2(WarpPointEntity* this); +void WarpPoint_Action3(WarpPointEntity* this); +void WarpPoint_Action4(WarpPointEntity* this); +void WarpPoint_Action5(WarpPointEntity* this); +void sub_0808B73C(WarpPointEntity* this); +u32 sub_0808B7C8(WarpPointEntity* this); +void sub_0808B830(WarpPointEntity* this); -void (*const WarpPoint_Actions[])(Entity*) = { +void (*const WarpPoint_Actions[])(WarpPointEntity*) = { WarpPoint_Init, WarpPoint_Action1, WarpPoint_Action2, WarpPoint_Action3, WarpPoint_Action4, WarpPoint_Action5, }; const u8 gUnk_08121380[3] = { 1, 0, 2 }; -void WarpPoint(Entity* this) { - if (!this->field_0x70.BYTES.byte0) { - WarpPoint_Actions[this->action](this); +void WarpPoint(WarpPointEntity* this) { + if (!this->unk_70) { + WarpPoint_Actions[super->action](this); } else { sub_0808B73C(this); } } -void WarpPoint_Init(Entity* this) { +void WarpPoint_Init(WarpPointEntity* this) { u32 tmp; - this->action = 1; - this->subtimer = 0; - tmp = gUnk_08121380[this->type]; - this->palette.b.b0 = tmp; - this->spritePriority.b0 = 6; - this->hitbox = (Hitbox*)&gHitbox_1; - this->updatePriority = PRIO_NO_BLOCK; - InitializeAnimation(this, 0); - if (CheckFlags(this->field_0x86.HWORD)) { + super->action = 1; + super->subtimer = 0; + tmp = gUnk_08121380[super->type]; + super->palette.b.b0 = tmp; + super->spritePriority.b0 = 6; + super->hitbox = (Hitbox*)&gHitbox_1; + super->updatePriority = PRIO_NO_BLOCK; + InitializeAnimation(super, 0); + if (CheckFlags(this->unk_86)) { sub_0808B830(this); } else { - if (AreaIsDungeon() && IsDungeonWarpActive(this->type)) { + if (AreaIsDungeon() && IsDungeonWarpActive(super->type)) { sub_0808B830(this); } } if (!sub_0808B7C8(this)) return; - this->action = 4; - this->subtimer = 96; - gPlayerEntity.x.HALF.HI = this->x.HALF.HI; - gPlayerEntity.y.HALF.HI = this->y.HALF.HI; + super->action = 4; + super->subtimer = 96; + gPlayerEntity.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.y.HALF.HI = super->y.HALF.HI; gPlayerEntity.animationState = 4; EnqueueSFX(SFX_112); - RequestPriorityDuration(this, this->subtimer + 16); + RequestPriorityDuration(super, super->subtimer + 16); } -void WarpPoint_Action1(Entity* this) { - if (CheckFlags(this->field_0x86.HWORD)) { +void WarpPoint_Action1(WarpPointEntity* this) { + if (CheckFlags(this->unk_86)) { sub_0808B830(this); if (AreaIsDungeon()) { - EnableDungeonWarp(this->type); + EnableDungeonWarp(super->type); } - this->action = 2; - this->subtimer = 60; + super->action = 2; + super->subtimer = 60; EnqueueSFX(SFX_112); } } -void WarpPoint_Action2(Entity* this) { - if (!--this->subtimer) { - this->action = 3; +void WarpPoint_Action2(WarpPointEntity* this) { + if (!--super->subtimer) { + super->action = 3; } else { - this->spriteSettings.draw = this->subtimer & 2 ? 0 : 1; + super->spriteSettings.draw = super->subtimer & 2 ? 0 : 1; } } -void WarpPoint_Action3(Entity* this) { - GetNextFrame(this); +void WarpPoint_Action3(WarpPointEntity* this) { + GetNextFrame(super); if (sub_0808B7C8(this)) { - if (this->timer) + if (super->timer) return; - this->action = 5; - this->subtimer = 96; + super->action = 5; + super->subtimer = 96; PutAwayItems(); - gPlayerEntity.x.HALF.HI = this->x.HALF.HI; - gPlayerEntity.y.HALF.HI = this->y.HALF.HI; + gPlayerEntity.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.y.HALF.HI = super->y.HALF.HI; gPlayerEntity.animationState = 4; gPlayerEntity.flags &= ~ENT_COLLIDE; - RequestPriorityDuration(this, this->subtimer + 16); + RequestPriorityDuration(super, super->subtimer + 16); SoundReq(SFX_113); } else { - this->timer = 0; + super->timer = 0; } } -void WarpPoint_Action4(Entity* this) { +void WarpPoint_Action4(WarpPointEntity* this) { u32 tmp; - if (!--this->subtimer) { - this->action = 3; - this->timer = 1; + if (!--super->subtimer) { + super->action = 3; + super->timer = 1; gPlayerEntity.animationState = 4; gPlayerEntity.direction = DirectionSouth; return; } tmp = 0; - switch (this->subtimer & 0x60) { + switch (super->subtimer & 0x60) { case 0x40: - if (this->subtimer == 0x58) { + if (super->subtimer == 0x58) { SoundReq(SFX_114); } - if (!(this->subtimer & 1)) { + if (!(super->subtimer & 1)) { tmp = 1; } break; case 0x20: - if (!(this->subtimer & 3)) { + if (!(super->subtimer & 3)) { tmp = 1; } break; case 0: - if (!(this->subtimer & 7)) { + if (!(super->subtimer & 7)) { if (gPlayerEntity.animationState == 4) { - if (this->subtimer > 0x18) { + if (super->subtimer > 0x18) { tmp = 1; } } else { @@ -146,38 +158,38 @@ void WarpPoint_Action4(Entity* this) { } } -void WarpPoint_Action5(Entity* this) { +void WarpPoint_Action5(WarpPointEntity* this) { u32 tmp; - if (!--this->subtimer) { + if (!--super->subtimer) { gRoomTransition.transitioningOut = 1; gRoomTransition.type = TRANSITION_DEFAULT; - gRoomTransition.player_status.area_next = this->field_0x7c.BYTES.byte0; - gRoomTransition.player_status.room_next = this->field_0x7c.BYTES.byte1; - gRoomTransition.player_status.start_pos_x = ((this->cutsceneBeh.HWORD & 0x3f) << 4) + 8; - gRoomTransition.player_status.start_pos_y = ((this->cutsceneBeh.HWORD & 0xfc0) >> 2) + 8; + gRoomTransition.player_status.area_next = this->unk_7c; + gRoomTransition.player_status.room_next = this->unk_7d; + gRoomTransition.player_status.start_pos_x = ((this->unk_84 & 0x3f) << 4) + 8; + gRoomTransition.player_status.start_pos_y = ((this->unk_84 & 0xfc0) >> 2) + 8; gRoomTransition.player_status.layer = 0; gRoomTransition.player_status.start_anim = 4; gRoomTransition.player_status.spawn_type = PL_SPAWN_DEFAULT; - if (this->type == 2) { + if (super->type == 2) { gRoomTransition.type = TRANSITION_FADE_WHITE_SLOW; } return; } tmp = 0; - switch (this->subtimer & 0x60) { + switch (super->subtimer & 0x60) { case 0x40: - if (!(this->subtimer & 7)) { + if (!(super->subtimer & 7)) { tmp = 1; } break; case 0x20: - if (!(this->subtimer & 3)) { + if (!(super->subtimer & 3)) { tmp = 1; } break; case 0: - if (this->subtimer > 0x10) { - if (!(this->subtimer & 1)) { + if (super->subtimer > 0x10) { + if (!(super->subtimer & 1)) { tmp = 1; } } else { @@ -191,28 +203,28 @@ void WarpPoint_Action5(Entity* this) { } } -void sub_0808B73C(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->palette.b.b0 = this->parent->palette.b.b0; - InitializeAnimation(this, 1); +void sub_0808B73C(WarpPointEntity* this) { + if (super->action == 0) { + super->action = 1; + super->palette.b.b0 = super->parent->palette.b.b0; + InitializeAnimation(super, 1); } - if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) { - this->spriteSettings.draw = 1; + if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) { + super->spriteSettings.draw = 1; } else { - if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) { - this->spriteSettings.draw ^= 1; + if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) { + super->spriteSettings.draw ^= 1; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } } - GetNextFrame(this); + GetNextFrame(super); } -u32 sub_0808B7C8(Entity* this) { +u32 sub_0808B7C8(WarpPointEntity* this) { if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.framestate != PL_STATE_DIE && gPlayerEntity.health != 0 && - PlayerCanBeMoved() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { - if (this->timer == 0 && gPlayerEntity.action == PLAYER_08072C9C) { + PlayerCanBeMoved() && EntityInRectRadius(super, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { + if (super->timer == 0 && gPlayerEntity.action == PLAYER_08072C9C) { ResetPlayerAnimationAndAction(); } return 1; @@ -220,15 +232,15 @@ u32 sub_0808B7C8(Entity* this) { return 0; } -void sub_0808B830(Entity* this) { - Entity* tmp; - this->action = 3; - this->timer = 0; - this->spriteSettings.draw = 1; - tmp = CreateObject(WARP_POINT, 0, 0); - if (tmp) { - tmp->field_0x70.BYTES.byte0 = 1; - tmp->parent = this; - CopyPosition(this, tmp); +void sub_0808B830(WarpPointEntity* this) { + WarpPointEntity* warpPoint; + super->action = 3; + super->timer = 0; + super->spriteSettings.draw = 1; + warpPoint = (WarpPointEntity*)CreateObject(WARP_POINT, 0, 0); + if (warpPoint) { + warpPoint->unk_70 = 1; + warpPoint->base.parent = super; + CopyPosition(super, &warpPoint->base); } } diff --git a/src/object/waterDropObject.c b/src/object/waterDropObject.c index a32cad00..d1236267 100644 --- a/src/object/waterDropObject.c +++ b/src/object/waterDropObject.c @@ -9,8 +9,8 @@ #include "functions.h" void WaterDropObject(Entity* this) { - int iVar2; - int iVar4; + u32 iVar2; + u32 iVar4; Entity* parent; parent = this->parent; diff --git a/src/object/waterElement.c b/src/object/waterElement.c index 12aa538d..9b4d9902 100644 --- a/src/object/waterElement.c +++ b/src/object/waterElement.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" void WaterElement_Init(Entity*); diff --git a/src/object/well.c b/src/object/well.c index 27fc29c3..d6b0e475 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -4,6 +4,7 @@ * * @brief Well object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" @@ -11,32 +12,38 @@ #include "room.h" #include "tiles.h" -void Well_Init(Entity*); -void Well_Action1(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u16 unk_80; +} WellEntity; -void Well(Entity* this) { - static void (*const Well_Actions[])(Entity*) = { +void Well_Init(WellEntity* this); +void Well_Action1(WellEntity* this); + +void Well(WellEntity* this) { + static void (*const Well_Actions[])(WellEntity*) = { Well_Init, Well_Action1, }; - Well_Actions[this->action](this); + Well_Actions[super->action](this); } -void Well_Init(Entity* this) { +void Well_Init(WellEntity* this) { u32 tilePos; - this->action = 1; - tilePos = COORD_TO_TILE(this); - this->field_0x80.HWORD = tilePos; - SetMetaTile(SPECIAL_META_TILE_125, this->field_0x80.HWORD, LAYER_BOTTOM); + super->action = 1; + tilePos = COORD_TO_TILE(super); + this->unk_80 = tilePos; + SetMetaTile(SPECIAL_META_TILE_125, this->unk_80, LAYER_BOTTOM); } -void Well_Action1(Entity* this) { - s32 tileIndex = GetMetaTileType(this->field_0x80.HWORD, LAYER_BOTTOM); +void Well_Action1(WellEntity* this) { + u32 tileIndex = GetMetaTileType(this->unk_80, LAYER_BOTTOM); if (tileIndex != SPECIAL_META_TILE_125) { sub_08078B48(); - gPlayerEntity.x.WORD = this->x.WORD; - gPlayerEntity.y.HALF.HI = this->y.HALF.HI + 4; + gPlayerEntity.x.WORD = super->x.WORD; + gPlayerEntity.y.HALF.HI = super->y.HALF.HI + 4; DeleteThisEntity(); } } diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c index 0193f063..5febac8c 100644 --- a/src/object/whirlwind.c +++ b/src/object/whirlwind.c @@ -4,11 +4,9 @@ * * @brief Whirlwind object */ - #define NENT_DEPRECATED #include "area.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/whiteTriangleEffect.c b/src/object/whiteTriangleEffect.c index c6746f80..ec70dab3 100644 --- a/src/object/whiteTriangleEffect.c +++ b/src/object/whiteTriangleEffect.c @@ -4,10 +4,8 @@ * * @brief White Triangle Effect object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" #include "screen.h" @@ -37,7 +35,7 @@ typedef struct { u16 unk_9; } struct_081215E8; -extern void sub_0801E49C(u32, u32, u32, u32); +extern void sub_0801E49C(s32 baseX, s32 baseY, s32 radius, u32 baseAngle); extern bool32 gUnk_02036BB8; void sub_0808C6D4(WhiteTriangleEffectEntity*); diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c index 99b8572f..19aa7f63 100644 --- a/src/object/windTribeFlag.c +++ b/src/object/windTribeFlag.c @@ -4,6 +4,7 @@ * * @brief Wind Tribe Flag object */ +#define NENT_DEPRECATED #include "object.h" void WindTribeFlag(Entity* this) { diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index 082098c9..bd94a171 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -4,11 +4,9 @@ * * @brief Wind Tribe Teleporter object */ - #define NENT_DEPRECATED #include "collision.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" #include "screenTransitions.h" diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 815a0f4a..2ce20d42 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -4,10 +4,10 @@ * * @brief Windcrest object */ +#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" -#include "global.h" #include "save.h" #include "script.h" #include "sound.h" diff --git a/src/objectUtils.c b/src/objectUtils.c index 172e2afc..a688564d 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -267,50 +267,50 @@ void CreateSparkle(Entity* entity) { } void SyncPlayerToPlatform(Entity* this, bool32 param_2) { - s16 oldValue; - s32 diff; - u16 newValue; - FORCE_REGISTER(Entity * that, r4) = this; - FORCE_REGISTER(bool32 p2, r6) = param_2; - u16 dir = that->direction; + s16 oldValue1, oldValue2; + s32 newValue1, newValue2, newValue3, newValue4; + s16 diff; - if ((dir & 0x80) == 0) { - switch (dir >> 3) { - case 0: - oldValue = that->y.HALF_U.HI; - LinearMoveUpdate(that); - newValue = that->y.HALF_U.HI; - diff = ((oldValue - newValue) << 0x10) >> 0x10; - if ((diff != 0) && (p2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 0); - } - break; - case 1: - oldValue = that->x.HALF_U.HI; - LinearMoveUpdate(that); - diff = ((that->x.HALF_U.HI - oldValue) * 0x10000) >> 0x10; - if ((diff != 0) && (p2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 8); - } - break; - case 2: - oldValue = that->y.HALF_U.HI; - LinearMoveUpdate(that); - diff = ((that->y.HALF_U.HI - oldValue) * 0x10000) >> 0x10; - if ((diff != 0) && (p2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 0x10); - } - break; - case 3: - oldValue = that->x.HALF_U.HI; - LinearMoveUpdate(that); - newValue = that->x.HALF_U.HI; - diff = ((oldValue - newValue) << 0x10) >> 0x10; - if ((diff != 0) && (p2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 0x18); - } - break; - } + if ((this->direction & 0x80) != 0) + return; + + switch (this->direction >> 3) { + case 0: + oldValue1 = this->y.HALF_U.HI; + LinearMoveUpdate(this); + newValue1 = this->y.HALF_U.HI; + diff = ((oldValue1 - newValue1)); + if ((diff != 0) && (param_2 != 0)) { + sub_080044AE(&gPlayerEntity, diff << 8, 0); + } + break; + case 1: + oldValue2 = this->x.HALF_U.HI; + LinearMoveUpdate(this); + newValue2 = this->x.HALF_U.HI; + diff = (newValue2 - oldValue2); + if ((diff != 0) && (param_2 != 0)) { + sub_080044AE(&gPlayerEntity, diff << 8, 8); + } + break; + case 2: + oldValue2 = this->y.HALF_U.HI; + LinearMoveUpdate(this); + newValue3 = this->y.HALF_U.HI; + diff = (newValue3 - oldValue2); + if ((diff != 0) && (param_2 != 0)) { + sub_080044AE(&gPlayerEntity, diff << 8, 0x10); + } + break; + case 3: + oldValue1 = this->x.HALF_U.HI; + LinearMoveUpdate(this); + newValue4 = this->x.HALF_U.HI; + diff = ((oldValue1 - newValue4)); + if ((diff != 0) && (param_2 != 0)) { + sub_080044AE(&gPlayerEntity, diff << 8, 0x18); + } + break; } } @@ -321,7 +321,7 @@ void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3) { ptr = ptr + (u32)ptr[1] * -3; } if (*ptr == 0xff) { - this->direction = 0xff; + this->direction = DIR_NONE; this->speed = 0; } else { this->direction = (u8)*ptr; diff --git a/src/physics.c b/src/physics.c index 8465bc7c..b79297cc 100644 --- a/src/physics.c +++ b/src/physics.c @@ -13,8 +13,8 @@ const u8 gSpriteSortAboveTable[]; const u8 gSpriteSortBelowTable[]; -const u8 gUnk_08114F58[]; -const u8 gUnk_08114F38[]; +const u8 gMapDirectionToAnimationState8[]; +const u8 gMapDirectionToAnimationState4[]; extern u16 gExtraFrameOffsets[]; extern s8 gUnk_08126EE4[]; @@ -132,19 +132,19 @@ u32 sub_0806F548(Entity* a, Entity* b, u32 x, u32 y) { u32 sub_0806F564(Entity* ent, u32 b, u32 c) { u32 tmp = CalculateDirectionTo(ent->x.HALF.HI, ent->y.HALF.HI, b, c); - return ent->animationState == sub_0806F5A4(tmp); + return ent->animationState == GetAnimationStateForDirection4(tmp); } u32 sub_0806F58C(Entity* a, Entity* b) { return a->animationState >> 1 == sub_0806FCA0(a, b); } -u32 sub_0806F5A4(u32 idx) { - return gUnk_08114F38[idx]; +u32 GetAnimationStateForDirection4(u32 direction) { + return gMapDirectionToAnimationState4[direction]; } -u32 sub_0806F5B0(u32 idx) { - return gUnk_08114F58[idx]; +u32 GetAnimationStateForDirection8(u32 idx) { + return gMapDirectionToAnimationState8[idx]; } void LinearMoveDirection(Entity* ent, u32 a, u32 b) { @@ -246,17 +246,21 @@ bool32 sub_0806F8DC(Entity* ent) { return TRUE; } +#define CDIR_DIAGONAL 1 +#define CDirectionSouth 4 +#define CDirectionWest 6 + u32 sub_0806F948(Entity* ent) { - u32 v1; - if (gPlayerState.direction == 0xFF) + u32 direction; + if (gPlayerState.direction == DIR_NONE) return ent->animationState; - v1 = gPlayerState.direction / 4; - if ((v1 & 1) && !(((v1 + 1) - ent->animationState) & 4)) { + direction = gPlayerState.direction / 4; + if ((direction & CDIR_DIAGONAL) && !(((direction + 1) - ent->animationState) & CDirectionSouth)) { return ent->animationState; } else { - ent->spriteSettings.flipX = v1 > 4; - ent->animationState = v1 & 6; + ent->spriteSettings.flipX = direction > CDirectionSouth; + ent->animationState = direction & CDirectionWest; } return ent->animationState; } @@ -401,14 +405,11 @@ bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) { } bool32 sub_0806FC24(u32 param_1, u32 param_2) { - register u32 rv asm("r0"); u32 val = FindValueForKey(param_1, gUnk_080046A4); - if (val) { - rv = (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1; - } else { - rv = 0; - } - return rv; + if (!val) + return 0; + + return (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1; } const u16* sub_0806FC50(u32 param_1, u32 param_2) { @@ -435,11 +436,11 @@ bool32 sub_0806FC80(Entity* ent, Entity* ent2, s32 param_3) { } u32 sub_0806FCA0(Entity* this, Entity* other) { - return sub_0806F5A4(GetFacingDirection(this, other)); + return GetAnimationStateForDirection4(GetFacingDirection(this, other)); } u32 sub_0806FCAC(Entity* this, Entity* other) { - return sub_0806F5B0(GetFacingDirection(this, other)); + return GetAnimationStateForDirection8(GetFacingDirection(this, other)); } bool32 EntityWithinDistance(Entity* entity, s32 x, s32 y, s32 distance) { @@ -680,11 +681,11 @@ u8* GetSpriteSubEntryOffsetDataPointer(u32 param_1, u32 param_2) { return (u8*)val; } -const u8 gUnk_08114F38[] = { +const u8 gMapDirectionToAnimationState4[] = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, }; -const u8 gUnk_08114F58[] = { +const u8 gMapDirectionToAnimationState8[] = { 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 0, 0, }; diff --git a/src/player.c b/src/player.c index def160fc..6eab0698 100644 --- a/src/player.c +++ b/src/player.c @@ -49,8 +49,6 @@ #define FALL_DAMAGE 2 -#define DEFAULT_ANIM 0x100 - static EntityAction PlayerInit; static EntityAction PlayerNormal; // static EntityAction PlayerInit; @@ -130,7 +128,7 @@ static EntityAction PlayerTalkEzlo_Leave; // PLAYER_PUSH static EntityAction PlayerPushInit; static EntityAction PlayerPushUpdate; -static EntityAction sub_08071B60; +static EntityAction PlayerPushEnd; // PLAYER_MINISHDIE static EntityAction PlayerMinishDieInit; @@ -199,7 +197,7 @@ static EntityAction sub_08072F94; static EntityAction sub_08073094; // PLAYER_USEENTRANCE -static EntityAction sub_080731D8; +static EntityAction PlayerUseStairs; static EntityAction sub_080732D0; static EntityAction sub_0807332C; static EntityAction sub_080733BC; @@ -283,7 +281,7 @@ extern ScriptExecutionContext gPlayerScriptExecutionContext; bool32 CheckInitPauseMenu(void) { u32 framestate; if (((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gPauseMenuOptions.disabled || - (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.fillerD0[34] || + (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.inventory[0] || gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) { return FALSE; } @@ -355,7 +353,7 @@ static void PlayerInit(Entity* this) { this->hitbox = (Hitbox*)&gPlayerHitbox; this->spriteIndex = 1; #ifndef EU - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; #endif sub_0806FDA0(this); LoadSwapGFX(this, 1, 2); @@ -399,7 +397,7 @@ static void PlayerNormal(Entity* this) { if ((this->animationState >> 1) + 92 == this->animIndex && (u16)this->spriteIndex == 2) UpdateAnimationSingleFrame(&gPlayerEntity); else - gPlayerState.animation = 604; + gPlayerState.animation = ANIM_TRAPPED; sub_0806F948(&gPlayerEntity); ResetActiveItems(); UpdateActiveItems(this); @@ -421,7 +419,7 @@ static void PlayerNormal(Entity* this) { return; } if (!gPlayerState.swim_state && (gPlayerState.jump_status & 0xC0) == 0) { - if (gPlayerState.shield_status || gPlayerState.field_0x1f[2]) { + if (gPlayerState.shield_status || gPlayerState.bow_state) { this->speed = SHIELDING_SPEED; } else { if (gPlayerState.sword_state) { @@ -506,7 +504,7 @@ static void PlayerNormal(Entity* this) { this->speed = gPlayerState.jump_status & 0x20; sub_08008926(this); } else { - this->direction = 0xff; + this->direction = DIR_NONE; } } UpdatePlayerMovement(); @@ -538,14 +536,14 @@ static void PlayerNormal(Entity* this) { this->direction = gPlayerState.direction; if (gPlayerState.flags & PL_BURNING) { this->speed = BURNING_SPEED; - if ((gPlayerState.direction & 0x80) != 0) + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) this->direction = 4 * (this->animationState & 0xE); DeleteClones(); } } } v13 = 0; - if ((((gPlayerState.field_0x7 | this->direction) & 0x80) | gPlayerState.field_0xa) == 0 && + if ((((gPlayerState.field_0x7 | this->direction) & DIR_NOT_MOVING_CHECK) | gPlayerState.field_0xa) == 0 && (gPlayerState.field_0x7 & 0x10) == 0) { v13 = 1; if (this->knockbackDuration == 0 && @@ -581,7 +579,7 @@ static void PlayerFall(Entity* this) { PlayerFallUpdate, }; - gPlayerState.direction = 0xFF; + gPlayerState.direction = DIR_NONE; gPlayerState.pushedObject = 0x80; gPlayerState.framestate = PL_STATE_FALL; @@ -597,11 +595,11 @@ static void PlayerFallInit(Entity* this) { gPlayerState.jump_status = 0; if (gPlayerState.flags & PL_MINISH) - gPlayerState.animation = 0x1ba; + gPlayerState.animation = ANIM_FALL_MINISH; else if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 0x458; + gPlayerState.animation = ANIM_FALL_NOCAP; else - gPlayerState.animation = 0x1b8; + gPlayerState.animation = ANIM_FALL; this->subAction++; COLLISION_OFF(this); @@ -650,10 +648,10 @@ static void PlayerBounceInit(Entity* this) { if (!(gPlayerState.flags & PL_MINISH)) { this->zVelocity = BOUNCE_SPEED_Z; - gPlayerState.animation = 0x114; + gPlayerState.animation = ANIM_BOUNCE; InitScreenShake(16, 0); } else { - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; this->zVelocity = (BOUNCE_SPEED_Z * 3) / 4; } @@ -702,7 +700,7 @@ static void PlayerBounceUpdate(Entity* this) { this->subAction++; if (!(gPlayerState.flags & PL_MINISH)) - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } static void sub_08070E7C(Entity* this) { @@ -737,7 +735,7 @@ static void sub_08070EDC(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) ResolvePlayerAnimation(); else - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; } static void sub_08070f24(Entity* this) { @@ -782,15 +780,15 @@ static void PlayerItemGetInit(Entity* this) { u32 anim; if (gPlayerState.flags & PL_NO_CAP) { if (sub_080542AC(gPlayerState.field_0x38)) { - anim = 0x45e; + anim = ANIM_GET_ITEM_SMALL_NOCAP; } else { - anim = 0x45b; + anim = ANIM_GET_ITEM_BIG_NOCAP; } } else { if (sub_080542AC(gPlayerState.field_0x38)) { - anim = 0x2e0; + anim = ANIM_GET_ITEM_SMALL; } else { - anim = 0x1b9; + anim = ANIM_GET_ITEM_BIG; } } gPlayerState.animation = anim; @@ -837,7 +835,7 @@ static void PlayerJump(Entity* this) { } static void PlayerJumpInit(Entity* this) { - u32 temp; + s32 temp; this->subAction++; @@ -850,9 +848,9 @@ static void PlayerJumpInit(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) { ResetActiveItems(); if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x420; + gPlayerState.animation = ANIM_JUMP_NOCAP; } else { - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; } } } @@ -861,8 +859,11 @@ static void PlayerJumpInit(Entity* this) { this->direction = Direction8FromAnimationState(AnimationStateWalk(this->animationState)); temp = sub_08079FC4(1); - asm("lsl r0, r0, #0x4"); - this->zVelocity = (temp - 4) * 64 * 64; + + temp <<= 4; + temp -= 4; + temp <<= 12; + this->zVelocity = temp; this->speed = JUMP_SPEED_FWD; DeleteClones(); @@ -912,9 +913,9 @@ static void sub_08071130(Entity* this) { if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x424; + gPlayerState.animation = ANIM_LAND_NOCAP; } else { - gPlayerState.animation = 0x820; + gPlayerState.animation = ANIM_LAND; } this->animIndex = 0xff; } @@ -956,7 +957,7 @@ static void PlayerDrownInit(Entity* this) { if (gPlayerState.flags & PL_MINISH) { this->timer = 60; - gPlayerState.animation = 0xc19; + gPlayerState.animation = ANIM_DROWN_MINISH; SoundReq(SFX_WATER_SPLASH); } else { if (!(gPlayerState.flags & PL_FLAGS10000)) @@ -965,9 +966,9 @@ static void PlayerDrownInit(Entity* this) { CreateFx(this, FX_WATER_SPLASH, 0); if (!(gPlayerState.flags & PL_NO_CAP)) - gPlayerState.animation = 0x72c; + gPlayerState.animation = ANIM_DROWN; else - gPlayerState.animation = 0x44c; + gPlayerState.animation = ANIM_DROWN_NOCAP; } ResetActiveItems(); } @@ -984,7 +985,7 @@ static void sub_080712F0(Entity* this) { temp = TRUE; } else if ((this->frame & ANIM_DONE) != 0) { if (this->animIndex != 0xce) - gPlayerState.animation = 0x2ce; + gPlayerState.animation = ANIM_DROWN_RESPAWN; else temp = TRUE; } @@ -1018,7 +1019,7 @@ static void PlayerUsePortal(Entity* this) { if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0) return; - if (AreaIsDungeon() || gArea.portal_type == 3) { + if (AreaIsDungeon() || gArea.portal_type == PT_DUNGEON) { this->subAction = 7; this->timer = 30; SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 16); @@ -1034,7 +1035,6 @@ static void PortalJumpOnUpdate(Entity* this) { COLLISION_OFF(this); this->knockbackDuration = 0; - x = gArea.portal_x; y = gArea.portal_y; @@ -1052,27 +1052,27 @@ static void PortalJumpOnUpdate(Entity* this) { this->subAction = 1; this->animationState = IdleSouth; this->spriteSettings.flipX = FALSE; - if (gArea.portal_type == 4) { - gPlayerState.animation = 0x52c; + if (gArea.portal_type == PT_JAR) { + gPlayerState.animation = ANIM_ENTER_POT; } } this->timer = 8; - if (gArea.portal_type != 3) { + if (gArea.portal_type != PT_DUNGEON) { this->spritePriority.b0 = 3; } } static void PortalStandUpdate(Entity* this) { switch (gArea.portal_type) { - case 4: - case 5: + case PT_JAR: + case PT_5: sub_0806F948(&gPlayerEntity); break; } - if ((gPlayerState.direction & 0x84) == 0) { + if ((gPlayerState.direction & (DIR_NOT_MOVING_CHECK | DIR_DIAGONAL)) == 0) { if (this->direction != gPlayerState.direction) { this->timer = 8; } @@ -1084,7 +1084,7 @@ static void PortalStandUpdate(Entity* this) { this->action = PLAYER_MINISH; this->subAction = 7; this->subtimer = 0; - gPlayerState.animation = (gPlayerState.flags & PL_NO_CAP) ? 0x41C : 0x80C; + gPlayerState.animation = (gPlayerState.flags & PL_NO_CAP) ? ANIM_HOP_NOCAP : ANIM_HOP; gPlayerState.flags &= ~PL_USE_PORTAL; return; } @@ -1093,7 +1093,7 @@ static void PortalStandUpdate(Entity* this) { this->timer = 8; } - if (gArea.portal_type == 4) { + if (gArea.portal_type == PT_JAR) { if (this->frame == 0) { UpdateAnimationSingleFrame(this); return; @@ -1109,7 +1109,7 @@ static void PortalActivateInit(Entity* this) { gPauseMenuOptions.disabled = 1; this->subAction = 3; this->subtimer = 30; - gPlayerState.animation = 0x738; + gPlayerState.animation = ANIM_PORTAL_ACTIVATE; CreateObjectWithParent(this, EZLO_CAP, 1, 0); PutAwayItems(); SetPlayerEventPriority(); @@ -1133,7 +1133,7 @@ static void PortalShrinkInit(Entity* this) { *(u32*)&this->field_0x80.HWORD = 0x100; *(u32*)&this->cutsceneBeh = 0x100; SetAffineInfo(this, 0x100, 0x100, 0); - gPlayerState.animation = 0x2c3; + gPlayerState.animation = ANIM_PORTAL_SHRINK; gPlayerState.flags |= PL_MINISH; SoundReq(SFX_PLY_SHRINKING); } @@ -1220,12 +1220,12 @@ static void PortalEnterUpdate(Entity* this) { this->spriteSettings.draw = FALSE; - if (gArea.portal_type == 3) { + if (gArea.portal_type == PT_DUNGEON) { if (--this->subtimer == 0) sub_080717F8(this); return; } - if (gArea.portal_type == 6) + if (gArea.portal_type == PT_TOD) DoExitTransition(&gUnk_0813AB58); else gArea.portal_in_use = TRUE; @@ -1301,9 +1301,9 @@ static void PlayerTalkEzlo_Init(Entity* this) { this->subAction++; if (this->animationState == IdleEast) { - gPlayerState.animation = 0x3ca; + gPlayerState.animation = ANIM_EZLO_APPEAR_RIGHT; } else { - gPlayerState.animation = 0x3c6; + gPlayerState.animation = ANIM_EZLO_APPEAR_LEFT; } this->spriteSettings.flipX = 0; @@ -1324,9 +1324,9 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { this->child = CreateObjectWithParent(this, EZLO_CAP, 0, 0); if (this->child != NULL) { if (this->animationState == IdleEast) { - gPlayerState.animation = 0x3cc; + gPlayerState.animation = ANIM_EZLO_EYES_MIDDLE; } else { - gPlayerState.animation = 0x3c7; + gPlayerState.animation = ANIM_EZLO_EYES_UP; } DisplayEzloMessage(); } @@ -1334,15 +1334,15 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { } static void PlayerTalkEzlo_MessageIdle(Entity* this) { - u32 temp; + u32 rightOrLeft; if ((gMessage.doTextBox & 0x7f) == 0) { this->subAction++; if ((gPlayerState.flags & PL_MINISH) == 0) { if (this->animationState == IdleEast) - gPlayerState.animation = 0x3cd; + gPlayerState.animation = ANIM_EZLO_LEAVE_RIGHT; else - gPlayerState.animation = 0x3c9; + gPlayerState.animation = ANIM_EZLO_LEAVE_LEFT; } else { reset_priority(); PlayerMinishSetNormalAndCollide(); @@ -1354,18 +1354,18 @@ static void PlayerTalkEzlo_MessageIdle(Entity* this) { return; if (this->animationState == IdleEast) - temp = 4; + rightOrLeft = 4; else - temp = 0; + rightOrLeft = 0; if (this->child->timer != 0) { - if ((u8)(temp + 200) != this->animIndex) { - gPlayerState.animation = temp + 0x3c8; + if ((u8)(rightOrLeft + 200) != this->animIndex) { + gPlayerState.animation = rightOrLeft + ANIM_EZLO_HEAD_DOWN; return; } } else { - if ((u8)(temp + 199) != this->animIndex) { - gPlayerState.animation = temp + 0x3c7; + if ((u8)(rightOrLeft + 199) != this->animIndex) { + gPlayerState.animation = rightOrLeft + ANIM_EZLO_EYES_UP; return; } } @@ -1389,7 +1389,7 @@ static void PlayerPush(Entity* this) { static EntityAction* const sPlayerPushStates[] = { PlayerPushInit, PlayerPushUpdate, - sub_08071B60, + PlayerPushEnd, }; gPlayerState.framestate = PL_STATE_PUSH; @@ -1456,7 +1456,7 @@ static void PlayerPushUpdate(Entity* this) { UpdatePlayerMovement(); } -static void sub_08071B60(Entity* this) { +static void PlayerPushEnd(Entity* this) { gPlayerState.pushedObject = 2; gPlayerState.flags &= ~PL_BUSY; this->type = 0; @@ -1464,8 +1464,8 @@ static void sub_08071B60(Entity* this) { PlayerWaitForScroll(this); // Final push? this->subtimer = 6; - if ((gPlayerState.flags & PL_MINISH) == 0) { - gPlayerState.animation = 0x104; + if (!(gPlayerState.flags & PL_MINISH)) { + gPlayerState.animation = ANIM_WALK; this->spriteIndex = 3; InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c); } @@ -1485,16 +1485,16 @@ static void PlayerMinishDie(Entity* this) { } static void PlayerMinishDieInit(Entity* this) { - u32 temp; + u32 deathAnim; if (gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) return; if (GravityUpdate(this, GRAVITY_RATE)) { if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 0x420; + gPlayerState.animation = ANIM_JUMP_NOCAP; else - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; return; } @@ -1506,11 +1506,11 @@ static void PlayerMinishDieInit(Entity* this) { RespawnPlayer(); this->action = PLAYER_MINISHDIE; } - temp = 0xc1a; + deathAnim = ANIM_DIE1_MINISH; } else { - temp = (gPlayerState.flags & PL_NO_CAP) ? 0x459 : 0x1bc; + deathAnim = (gPlayerState.flags & PL_NO_CAP) ? ANIM_DIE1_NOCAP : ANIM_DIE1; } - gPlayerState.animation = temp; + gPlayerState.animation = deathAnim; gPlayerState.flags &= ~(PL_PARACHUTE | PL_MOLDWORM_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_BUSY); @@ -1528,12 +1528,12 @@ static void PlayerMinishDieInit(Entity* this) { static void sub_08071CAC(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frame & ANIM_DONE) { - u32 temp; + u32 deathAnim; if ((gPlayerState.flags & PL_MINISH) == 0) - temp = (gPlayerState.flags & PL_NO_CAP) ? 0x45a : 0x2bd; + deathAnim = (gPlayerState.flags & PL_NO_CAP) ? ANIM_DIE2_NOCAP : ANIM_DIE2; else - temp = 0xc1b; - gPlayerState.animation = temp; + deathAnim = ANIM_DIE2_MINISH; + gPlayerState.animation = deathAnim; this->subAction = 2; this->timer = 240; @@ -1561,7 +1561,7 @@ static void sub_08071D04(Entity* this) { ModHealth(deltaHealth); this->subAction = 3; gPlayerState.field_0x3c = 0; - this->direction = 0xff; + this->direction = DIR_NONE; this->speed = 0; this->zVelocity = Q_16_16(1.5); gPlayerState.jump_status = 1; @@ -1599,10 +1599,10 @@ static void sub_08071DD0(Entity* this) { if (gPlayerState.field_0x39 != 0) { gPlayerState.field_0x39 = 0; this->subAction = 2; - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } else { this->subAction = 1; - gPlayerState.animation = 0x114; + gPlayerState.animation = ANIM_BOUNCE; } } @@ -1662,13 +1662,13 @@ static void PlayerEmptyBottleInit(Entity* this) { this->subAction++; switch (gPlayerState.field_0x38) { case 0x20: - gPlayerState.animation = 0x614; + gPlayerState.animation = ANIM_BOTTLE_SWING; break; case 0x21 ... 0x25: - gPlayerState.animation = 0x2df; + gPlayerState.animation = ANIM_BOTTLE_DRINK; break; default: - gPlayerState.animation = 0x610; + gPlayerState.animation = ANIM_BOTTLE_POUR; SetInventoryValue(gPlayerState.field_0x38, 2); break; } @@ -1696,7 +1696,7 @@ static void PlayerFrozenInit(Entity* this) { COLLISION_OFF(this); this->timer = 120; this->subAction++; - gPlayerState.animation = 0x294; + gPlayerState.animation = ANIM_FROZEN; PutAwayItems(); SoundReq(SFX_195); } @@ -1791,12 +1791,12 @@ static void sub_08072100(Entity* this) { this->subAction = 1; COLLISION_OFF(this); if (gPlayerState.field_0x39) - this->direction = 0xff; + this->direction = DIR_NONE; if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x404; + gPlayerState.animation = ANIM_WALK_NOCAP; } else { - gPlayerState.animation = 0x104; + gPlayerState.animation = ANIM_WALK; } ResetActiveItems(); sub_08072168(this); @@ -1840,9 +1840,9 @@ static void sub_08072214(Entity* this) { this->timer = gPlayerState.field_0x38; this->direction = Direction8FromAnimationState(AnimationStateFlip180(this->animationState)); if ((gPlayerState.flags & PL_NO_CAP) == 0) { - gPlayerState.animation = 0x34c; + gPlayerState.animation = ANIM_PULL2; } else { - gPlayerState.animation = 0x944; + gPlayerState.animation = ANIM_PULL_NOCAP; } gPlayerState.flags |= PL_BUSY; sub_08072260(this); @@ -1855,9 +1855,9 @@ static void sub_08072260(Entity* this) { if (--this->timer == 0) { gPlayerState.flags &= ~PL_BUSY; if ((gPlayerState.flags & PL_NO_CAP) == 0) { - gPlayerState.animation = 0x34c; + gPlayerState.animation = ANIM_PULL2; } else { - gPlayerState.animation = 0x944; + gPlayerState.animation = ANIM_PULL_NOCAP; } this->knockbackDuration = 0; SetPlayerActionNormal(); @@ -1887,7 +1887,7 @@ static void PlayerLavaInit(Entity* this) { if (ent != NULL) { ent->child = this; } - gPlayerState.animation = 0x114; + gPlayerState.animation = ANIM_BOUNCE; } else { this->spriteSettings.draw = 0; this->subAction = 3; @@ -1910,7 +1910,7 @@ static void sub_08072354(Entity* this) { this->knockbackDuration = 0; this->subAction = 2; this->timer = 60; - gPlayerState.animation = 0x2c1; + gPlayerState.animation = ANIM_IN_LAVA; gPlayerState.flags &= ~PL_BURNING; UpdateSpriteForCollisionLayer(this); CreateFx(this, FX_LAVA_SPLASH, 0); @@ -1949,7 +1949,7 @@ static void sub_08072454(Entity* this) { static void sub_0807246C(Entity* this) { this->subAction = 1; this->timer = gPlayerState.field_0x38; - gPlayerState.animation = 0x3c0; + gPlayerState.animation = ANIM_LAUNCHED; SoundReq(SFX_PLY_VO7); } @@ -1990,9 +1990,9 @@ static void sub_080724DC(Entity* this) { this->subAction = 1; if (gRoomVars.field_0x0 == 0) { if (gPlayerState.flags & PL_MINISH) { - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; } else { - gPlayerState.animation = 0x104; + gPlayerState.animation = ANIM_WALK; } this->direction = Direction8FromAnimationState(this->animationState); } @@ -2034,7 +2034,7 @@ static void PlayerRoll(Entity* this) { } static void PlayerRollInit(Entity* this) { - u32 temp; + u32 playerFlags; if ((gPlayerState.flags & PL_MOLDWORM_RELEASED) == 0) { sub_0806F948(&gPlayerEntity); @@ -2043,16 +2043,16 @@ static void PlayerRollInit(Entity* this) { this->subAction = 1; this->timer = 0; ResetActiveItems(); - temp = gPlayerState.flags; + playerFlags = gPlayerState.flags; if (gPlayerState.flags & PL_MINISH) { this->spritePriority.b1 = 0; - gPlayerState.animation = 0xc08; + gPlayerState.animation = ANIM_ROLL_MINISH; } else { this->hurtType = 0x1e; - if (temp & 8) { - gPlayerState.animation = 0x438; + if (playerFlags & PL_NO_CAP) { + gPlayerState.animation = ANIM_ROLL_NOCAP; } else { - gPlayerState.animation = 0x2ac; + gPlayerState.animation = ANIM_ROLL; } } gPlayerState.flags |= PL_ROLLING; @@ -2186,9 +2186,9 @@ static void PlayerInHoleInit(Entity* this) { this->timer = 0; gPlayerState.flags |= PL_IN_HOLE; if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x950; + gPlayerState.animation = ANIM_FALL_IN_HOLE_NOCAP; } else { - gPlayerState.animation = 0x61c; + gPlayerState.animation = ANIM_FALL_IN_HOLE; if (GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer) == SPECIAL_META_TILE_32) { this->timer = 1; } @@ -2206,15 +2206,15 @@ static void PlayerInHoleUpdate(Entity* this) { this->subAction = 3; this->timer = 40; this->spritePriority.b1 = 1; - gPlayerState.animation = 0x624; + gPlayerState.animation = ANIM_SPRING_JUMP; return; } this->subAction = 2; if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x954; + gPlayerState.animation = ANIM_IN_HOLE_NOCAP; } else { - gPlayerState.animation = 0x620; + gPlayerState.animation = ANIM_IN_HOLE; } } else { UpdateAnimationSingleFrame(this); @@ -2222,7 +2222,7 @@ static void PlayerInHoleUpdate(Entity* this) { } static void sub_08072ACC(Entity* this) { - if (gPlayerState.direction == 0xff) { + if (gPlayerState.direction == DIR_NONE) { this->subtimer = 0; } else if (this->subtimer > 7) { COLLISION_ON(this); @@ -2269,12 +2269,14 @@ static void sub_08072B5C(Entity* this) { sub_08004542(this); } this->subAction++; + temp <<= 4; temp -= 4; temp <<= 12; this->zVelocity = temp; - this->speed = Q_8_8(1.0); - gPlayerState.animation = 0x810; + + this->speed = JUMP_SPEED_FWD; + gPlayerState.animation = ANIM_JUMP; SoundReq(SFX_PLY_JUMP); } @@ -2314,7 +2316,7 @@ static void sub_08072CC0(Entity* this) { this->subtimer = (gPlayerState.field_0x3a >> 2) + 1; this->direction = gPlayerState.field_0x39; this->speed = 0x400; - gPlayerState.animation = 0x524; + gPlayerState.animation = ANIM_GUSTJAR_524; gPlayerState.heldObject = 0; } @@ -2331,7 +2333,7 @@ static void sub_08072CFC(Entity* this) { } this->zVelocity = gPlayerState.field_0x38 << 0xc; this->speed = 0x200; - gPlayerState.animation = 0x810; + gPlayerState.animation = ANIM_JUMP; this->timer = 5; this->subtimer = 0; ResetActiveItems(); @@ -2422,9 +2424,9 @@ static void sub_08072D54(Entity* this) { } } else { if ((gPlayerState.flags & PL_NO_CAP)) { - gPlayerState.animation = 0x424; + gPlayerState.animation = ANIM_LAND_NOCAP; } else { - gPlayerState.animation = 0x820; + gPlayerState.animation = ANIM_LAND; } this->timer = 6; this->subAction = 3; @@ -2458,14 +2460,14 @@ static void PlayerClimb(Entity* this) { this->action = PLAYER_CLIMB; this->subAction = 0; this->y.HALF.LO = 0; - gPlayerState.animation = 0x2cf; + gPlayerState.animation = ANIM_CLIMB1_UP; } } } } static void sub_08072F94(Entity* this) { - u32 bVar1; + u32 direction; switch (gPlayerState.floor_type) { default: @@ -2476,43 +2478,43 @@ static void sub_08072F94(Entity* this) { case SURFACE_CLIMB_WALL: case SURFACE_2C: this->spritePriority.b1 = 0; - bVar1 = gPlayerState.direction; - if ((gPlayerState.direction & 0x80) == 0) { + direction = gPlayerState.direction; + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { this->direction = gPlayerState.direction; - if ((gPlayerState.direction == 8) || (gPlayerState.direction == 0x18)) { + if ((gPlayerState.direction == DirectionEast) || (gPlayerState.direction == DirectionWest)) { if (gPlayerState.floor_type == SURFACE_LADDER) { return; } if ((this->frame & 0x10)) { - gPlayerState.animation = 0x2d4; + gPlayerState.animation = ANIM_CLIMB_LEFT; } else { - gPlayerState.animation = 0x2d5; + gPlayerState.animation = ANIM_CLIMB_RIGHT; } sub_08073094(this); } else { - if ((gPlayerState.floor_type == SURFACE_LADDER) && ((bVar1 & 7) != 0)) { - this->direction = (bVar1 + 8) & 0x10; + if ((gPlayerState.floor_type == SURFACE_LADDER) && ((direction & (DIR_DIAGONAL | 0x3)) != 0)) { + this->direction = (direction + 8) & DirectionSouth; } - if (this->direction & 0x10) { + if (this->direction & DirectionSouth) { if (this->frame & 0x10) { - gPlayerState.animation = 0x2d1; + gPlayerState.animation = ANIM_CLIMB1_DOWN; } else { - gPlayerState.animation = 0x2d2; + gPlayerState.animation = ANIM_CLIMB2_DOWN; } } else { if (this->frame & 0x10) { - gPlayerState.animation = 0x2cf; + gPlayerState.animation = ANIM_CLIMB1_UP; } else { - gPlayerState.animation = 0x2d0; + gPlayerState.animation = ANIM_CLIMB2_UP; } } } this->subAction++; } else { if (this->frame & 0x10) { - gPlayerState.animation = 0x2d4; + gPlayerState.animation = ANIM_CLIMB_LEFT; } else { - gPlayerState.animation = 0x2d5; + gPlayerState.animation = ANIM_CLIMB_RIGHT; } } break; @@ -2571,7 +2573,7 @@ static void sub_08073094(Entity* this) { static void PlayerUseEntrance(Entity* this) { static EntityAction* const sPlayerUseEntranceStates[] = { - sub_080731D8, + PlayerUseStairs, sub_080732D0, sub_0807332C, sub_080733BC, @@ -2582,7 +2584,7 @@ static void PlayerUseEntrance(Entity* this) { sPlayerUseEntranceStates[this->subAction](this); } -static void sub_080731D8(Entity* this) { +static void PlayerUseStairs(Entity* this) { COLLISION_OFF(this); this->speed = 0x40; this->animationState = IdleNorth; @@ -2612,9 +2614,9 @@ static void sub_080731D8(Entity* this) { SetZeldaFollowTarget(this); } if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 1028; + gPlayerState.animation = ANIM_WALK_NOCAP; } else { - gPlayerState.animation = 260; + gPlayerState.animation = ANIM_WALK; } gRoomControls.camera_target = NULL; DeleteClones(); @@ -2643,19 +2645,20 @@ static void sub_0807332C(Entity* this) { if (gPlayerState.field_0x39 == 7) { this->direction = IdleNorth; } else { - this->direction = 28; + this->direction = DirectionNorthWest; } if ((this->x.HALF.HI & 0xF) != 0xF) { if (gPlayerState.field_0x39 == 7) { this->animationState = IdleEast; - this->direction = 4; + this->direction = DIR_DIAGONAL; } else { - this->animationState = 6; + this->animationState = IdleWest; if (this->direction <= DirectionWest) { LinearMoveUpdate(this); return; } - this->direction = (this->direction - 1) & 0x1F; + this->direction = (this->direction - 1) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } LinearMoveUpdate(this); return; @@ -2709,7 +2712,7 @@ static void PlayerParachute(Entity* this) { } static void sub_08073468(Entity* this) { - gPlayerState.animation = 1792; + gPlayerState.animation = ANIM_PARACHUTE_ACTIVATE; gPlayerState.jump_status = 0; this->zVelocity = Q_16_16(-1.0); this->subAction++; @@ -2739,7 +2742,7 @@ static void sub_08073504(Entity* this) { *((u32*)&this->field_0x80.HWORD) = this->direction << 8; this->field_0x86.HALF.HI = 0; this->field_0x86.HALF.LO = 0; - gPlayerState.animation = 1800; + gPlayerState.animation = ANIM_PARACHUTE; if (gPlayerState.field_0x38 == 1) { COLLISION_OFF(this); this->subAction = 6; @@ -2759,14 +2762,14 @@ static void sub_08073584(Entity* this) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); DoJump(this); - gPlayerState.animation = 1840; + gPlayerState.animation = ANIM_PARACHUTE_FALL; return; } gHUD.rActionPlayerState = R_ACTION_CANCEL; if (sub_0807A2F8(0)) { this->subAction++; - this->direction = 4 * (this->animationState & 6); + this->direction = 4 * (this->animationState & IdleWest); COLLISION_OFF(this); return; } @@ -2776,21 +2779,23 @@ static void sub_08073584(Entity* this) { else this->speed = 0x80; - if ((gPlayerState.direction & 0x80) == 0) { + if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { if (this->direction != gPlayerState.direction) { - if (((this->direction - gPlayerState.direction) & 0x1F) < 0x10) + if (((this->direction - gPlayerState.direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | + DirectionSouth | DirectionWest)) < DirectionSouth) *(u32*)&this->field_0x80 -= 0x20; else *(u32*)&this->field_0x80 += 0x20; } } - this->direction = (*(u32*)&this->field_0x80 >> 8) & 0x1F; + this->direction = (*(u32*)&this->field_0x80 >> 8) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); UpdatePlayerMovement(); state = 4 * this->animationState; dir = this->direction; - if (this->animationState == 0) { + if (this->animationState == IdleNorth) { state = (state + 8) & 0x1F; - dir = (dir + 8) & 0x1F; + dir = (dir + 8) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } if (state - 7 > dir) { @@ -2808,15 +2813,16 @@ static void sub_08073584(Entity* this) { this->animationState = state; idx = 0; state = gPlayerState.direction >> 2; - if (!this->field_0x86.HALF.HI || ((gPlayerState.direction & 0x80) == 0 && this->animationState != state)) { + if (!this->field_0x86.HALF.HI || + ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0 && this->animationState != state)) { static const u16 sAnims1[] = { - 0x0708, - 0x071C, - 0x0718, - 0x0714, + ANIM_PARACHUTE, + ANIM_PARACHUTE_TURN_LEFT, + ANIM_PARACHUTE_TURN_OPPOSITE, + ANIM_PARACHUTE_TURN_RIGHT, }; - if ((gPlayerState.direction & 0x80) == 0) { + if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { if (this->animationState != state) { if (this->animationState == (state ^ 4)) { idx = 2; @@ -2842,10 +2848,10 @@ static void sub_08073584(Entity* this) { this->field_0x86.HALF.LO = idx; } else { static const u16 sAnims2[] = { - 0x0708, - 0x0728, - 0x0724, - 0x0720, + ANIM_PARACHUTE, + ANIM_PARACHUTE_TURN2_LEFT, + ANIM_PARACHUTE_TURN2_OPPOSITE, + ANIM_PARACHUTE_TURN2_RIGHT, }; this->field_0x86.HALF.HI--; @@ -2893,14 +2899,14 @@ static void sub_080737BC(Entity* this) { static void sub_0807380C(Entity* this) { static const u16 sAnims[] = { - 0x0708, - 0x071C, - 0x0718, - 0x0714, + ANIM_PARACHUTE, + ANIM_PARACHUTE_TURN_LEFT, + ANIM_PARACHUTE_TURN_OPPOSITE, + ANIM_PARACHUTE_TURN_RIGHT, }; if ((gRoomTransition.frameCount & 3) == 0) { - u32 tmp = (this->animationState + 2) & 6; + u32 tmp = (this->animationState + 2) & IdleWest; this->animationState = tmp; this->direction = 4 * tmp; } @@ -2919,14 +2925,14 @@ static void sub_0807380C(Entity* this) { void sub_08073884(Entity* this) { static const u16 sAnims[] = { - 0x0708, - 0x071C, - 0x0718, - 0x0714, + ANIM_PARACHUTE, + ANIM_PARACHUTE_TURN_LEFT, + ANIM_PARACHUTE_TURN_OPPOSITE, + ANIM_PARACHUTE_TURN_RIGHT, }; if ((gRoomTransition.frameCount & 1) == 0) { - u32 tmp = (this->animationState + 2) & 6; + u32 tmp = (this->animationState + 2) & IdleWest; this->animationState = tmp; this->direction = 4 * tmp; } @@ -2950,10 +2956,10 @@ static void DoJump(Entity* this) { } static void sub_08073924(Entity* this) { - if ((gPlayerState.flags & PL_ROLLING) == 0 && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) { + if (!(gPlayerState.flags & PL_ROLLING) && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) { gPlayerState.jump_status = 0x40; - gPlayerState.direction = 0xff; - this->direction = 0xff; + gPlayerState.direction = DIR_NONE; + this->direction = DIR_NONE; PutAwayItems(); sub_08073968(this); } @@ -2966,13 +2972,13 @@ static void sub_08073968(Entity* this) { CheckPlayerVelocity(); if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 1052; + gPlayerState.animation = ANIM_HOP_NOCAP; } else { if ((gPlayerState.flags & PL_MINISH) == 0) { if (gPlayerState.flags & PL_ENTER_MINECART) { - gPlayerState.animation = 2064; + gPlayerState.animation = ANIM_JUMP; } else { - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; } } } @@ -3006,9 +3012,9 @@ static void sub_080739EC(Entity* this) { if ((gPlayerState.jump_status & 0x20) && this->zVelocity == 0) { this->zVelocity = Q_16_16(2.5); this->timer = 10; - this->direction = 0xff; + this->direction = DIR_NONE; gPlayerState.jump_status += 2; - gPlayerState.animation = 372; + gPlayerState.animation = ANIM_DOWN_THRUST; ResetPlayerVelocity(); return; } @@ -3047,9 +3053,9 @@ static void sub_08073AD4(Entity* this) { } gPlayerState.jump_status = tmp + 1; if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 1060; + gPlayerState.animation = ANIM_LAND_NOCAP; else - gPlayerState.animation = 2080; + gPlayerState.animation = ANIM_LAND; SoundReq(SFX_PLY_LAND); } @@ -3111,7 +3117,7 @@ static void sub_08073C80(Entity* this) { static const Hitbox sMinishHitbox = { 0, -1, { 3, 2, 2, 3 }, 2, 2 }; gPlayerState.flags |= PL_MINISH; - gPlayerState.animation = 3096; + gPlayerState.animation = ANIM_BOUNCE_MINISH; this->spriteSettings.draw = 3; this->spritePriority.b1 = 3; this->spriteSettings.shadow = 0; @@ -3181,7 +3187,7 @@ static void sub_08073D20(Entity* this) { UpdatePlayerMovement(); } else { this->direction = gPlayerState.direction; - if ((gPlayerState.direction & 0x80) == 0) { + if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { gPlayerState.framestate = PL_STATE_WALK; UpdatePlayerMovement(); } @@ -3235,7 +3241,7 @@ static void sub_08073F4C(Entity* this) { *(u32*)&this->cutsceneBeh.HWORD = 1152; this->spriteRendering.b0 = 3; sub_08074018(this); - gPlayerState.animation = 1852; + gPlayerState.animation = ANIM_GROW; } } @@ -3278,7 +3284,7 @@ static void sub_08074060(Entity* this) { this->subtimer = 0; this->subAction++; this->zVelocity = Q_16_16(2.0); - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; sub_0805EC60(this); } else { UpdateAnimationSingleFrame(this); @@ -3437,7 +3443,7 @@ void SurfaceAction_14(Entity* this) { sub_08074808(this); spd = this->speed; this->speed = 0x300; - this->direction = 16; + this->direction = DirectionSouth; gPlayerState.field_0xa |= 0x80; LinearMoveUpdate(this); this->speed = spd; @@ -3695,10 +3701,10 @@ void SurfaceAction_AutoLadder(Entity* this) { gPlayerState.swim_state = 0; this->collisionFlags &= ~4; if ((this->y.HALF.HI & 0xF) <= 7) { - gPlayerState.animation = 723; + gPlayerState.animation = ANIM_CLIMB_FROM_TOP; this->direction = DirectionSouth; } else { - gPlayerState.animation = 726; + gPlayerState.animation = ANIM_CLIMB_TO_TOP; this->direction = DirectionNorth; } ResetActiveItems(); @@ -3817,15 +3823,15 @@ static void sub_08074C68(Entity* this) { } } else { this->spriteSettings.draw = 1; - this->animationState = 0; + this->animationState = IdleNorth; this->spritePriority.b1 = 0; this->subAction = 2; this->field_0x68.HALF.LO = 1; sub_0807DD64(this); if (!gPlayerState.field_0x39) - gPlayerState.animation = 1850; + gPlayerState.animation = ANIM_SLEEP_NOCAP; else - gPlayerState.animation = 1846; + gPlayerState.animation = ANIM_SLEEP; SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } } @@ -3851,23 +3857,23 @@ void sub_08074D34(Entity* this, ScriptExecutionContext* ctx) { break; case 0x1: if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 0x400; + gPlayerState.animation = ANIM_DEFAULT_NOCAP; else - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; break; case 0x2: if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 1028; + gPlayerState.animation = ANIM_WALK_NOCAP; else - gPlayerState.animation = 260; + gPlayerState.animation = ANIM_WALK; break; case 0x4: break; case 0x8: if (gPlayerState.flags & PL_NO_CAP) - gPlayerState.animation = 1052; + gPlayerState.animation = ANIM_HOP_NOCAP; else - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; this->zVelocity = Q_16_16(1.5); break; case 0x10: @@ -3940,10 +3946,10 @@ void sub_08074F44(Entity* this) { if (((fixme*)&gPlayerEntity)->e) DeleteEntity(((fixme*)&gPlayerEntity)->e); if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1851; + gPlayerState.animation = ANIM_WAKEUP_NOCAP; gPlayerState.flags |= PL_NO_CAP; } else { - gPlayerState.animation = 1847; + gPlayerState.animation = ANIM_WAKEUP; } } @@ -3958,9 +3964,9 @@ void sub_08074F8C(Entity* this) { this->timer = 8; this->animationState = IdleSouth; if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1024; + gPlayerState.animation = ANIM_DEFAULT_NOCAP; } else { - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } } } @@ -3978,9 +3984,9 @@ void sub_0807501C(Entity* this) { if (--this->timer == 0) { this->animationState = gPlayerState.field_0x3a; if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1052; + gPlayerState.animation = ANIM_HOP_NOCAP; } else { - gPlayerState.animation = 2060; + gPlayerState.animation = ANIM_HOP; } this->spritePriority.b1 = 1; this->direction = Direction8FromAnimationState(this->animationState); @@ -3998,10 +4004,10 @@ void sub_0807508C(Entity* this) { LinearMoveUpdate(this); } else { if (!gPlayerState.field_0x39) { - gPlayerState.animation = 1024; + gPlayerState.animation = ANIM_DEFAULT_NOCAP; } else { gPlayerState.flags &= ~PL_NO_CAP; - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } if (--this->timer == 0) { this->animationState = IdleSouth; @@ -4025,8 +4031,8 @@ void sub_080750F4(Entity* this) { void sub_08075110(Entity* this) { this->field_0x68.HALF.LO++; this->subtimer = this->animationState; - this->animationState = 0; - gPlayerState.animation = 1844; + this->animationState = IdleNorth; + gPlayerState.animation = ANIM_PUT_ON_EZLO; gPlayerState.flags &= ~PL_NO_CAP; } @@ -4050,7 +4056,7 @@ void sub_0807513C(Entity* this) { void sub_0807518C(Entity* this) { if (--this->timer == 0) { this->field_0x68.HALF.LO++; - gPlayerState.animation = 969; + gPlayerState.animation = ANIM_EZLO_LEAVE_LEFT; } } @@ -4060,7 +4066,7 @@ void sub_080751B4(Entity* this) { this->animationState = IdleSouth; this->subAction = 1; this->field_0x68.HALF.LO = 0; - gPlayerState.animation = DEFAULT_ANIM; + gPlayerState.animation = ANIM_DEFAULT; } } diff --git a/src/playerItem.c b/src/playerItem.c index b5248f8a..f6fbd5bf 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -105,7 +105,7 @@ void ItemInit(Entity* this) { } else { this->spriteVramOffset = definition->gfx & 0x3ff; } - if (this->animationState == 0) { + if (this->animationState == IdleNorth) { this->animationState = gPlayerEntity.animationState & 6; } diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c index a1e5e560..63647459 100644 --- a/src/playerItem/playerItemBomb.c +++ b/src/playerItem/playerItemBomb.c @@ -1,49 +1,56 @@ +/** + * @file playerItemBomb.c + * @ingroup Items + * + * @brief Bomb Player Item + */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" -#include "functions.h" #include "asm.h" +#include "entity.h" +#include "functions.h" #include "item.h" #include "object.h" +#include "player.h" typedef struct { - Entity base; - u32 unk_68; + /*0x00*/ Entity base; + /*0x68*/ u32 unk_68; } PlayerItemBombEntity; -void sub_0801B418(Entity*); -void sub_0801B3A4(PlayerItemBombEntity*); -void sub_0801B250(PlayerItemBombEntity*); -void sub_0801B2CC(PlayerItemBombEntity*); -void sub_0801B318(PlayerItemBombEntity*); -void sub_0801B38C(PlayerItemBombEntity*); -void sub_0801B330(PlayerItemBombEntity*); -void sub_0801B340(PlayerItemBombEntity*); -void sub_0801B354(PlayerItemBombEntity*); -void sub_0801B368(PlayerItemBombEntity*); -void sub_0801B384(PlayerItemBombEntity*); +void sub_0801B418(Entity* this); +void sub_0801B3A4(PlayerItemBombEntity* this); +void PlayerItemBomb_Init(PlayerItemBombEntity* this); +void PlayerItemBomb_Action1(PlayerItemBombEntity* this); +void PlayerItemBomb_Action2(PlayerItemBombEntity* this); +void PlayerItemBomb_Action3(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction0(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction1(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction2(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction3(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction4(PlayerItemBombEntity* this); -static void (*const actionFuncs[])(PlayerItemBombEntity*) = { - sub_0801B250, - sub_0801B2CC, - sub_0801B318, - sub_0801B38C, +static void (*const PlayerItemBomb_Actions[])(PlayerItemBombEntity*) = { + PlayerItemBomb_Init, + PlayerItemBomb_Action1, + PlayerItemBomb_Action2, + PlayerItemBomb_Action3, }; -static void (*const subActionFuncs[])(PlayerItemBombEntity*) = { - sub_0801B330, sub_0801B340, sub_0801B354, sub_0801B368, sub_0801B384, +static void (*const PlayerItemBomb_SubActions[])(PlayerItemBombEntity*) = { + PlayerItemBomb_SubAction0, PlayerItemBomb_SubAction1, PlayerItemBomb_SubAction2, + PlayerItemBomb_SubAction3, PlayerItemBomb_SubAction4, }; static const Hitbox unusedHitbox = { 0, 0, { 4, 0, 0, 4 }, 22, 22 }; static const Hitbox gUnk_080B77F4 = { 0, 0, 6, 0, 0, 6, 4, 4 }; void PlayerItemBomb(PlayerItemBombEntity* this) { - u8 uVar1, uVar2; + u8 action, uVar2; - actionFuncs[super->action](this); + PlayerItemBomb_Actions[super->action](this); GetNextFrame(super); - uVar2 = uVar1 = super->action; - if (uVar1 != 0x03) { + uVar2 = action = super->action; + if (action != 3) { if (super->timer != 0) { if (*(u8*)&this->unk_68 == 7) { super->timer--; @@ -56,11 +63,11 @@ void PlayerItemBomb(PlayerItemBombEntity* this) { } } else { if (super->subtimer != 0) { - if (super->subtimer-- == 0x01) { - if ((uVar1 == 0x02) && (super->subAction == 1)) { + if (super->subtimer-- == 1) { + if ((action == 2) && (super->subAction == 1)) { gPlayerState.heldObject = 0; } - super->action = 0x03; + super->action = 3; super->spritePriority.b1 = 2; super->timer = 15; super->spriteSettings.draw = 0; @@ -76,7 +83,7 @@ void PlayerItemBomb(PlayerItemBombEntity* this) { } } -void sub_0801B250(PlayerItemBombEntity* this) { +void PlayerItemBomb_Init(PlayerItemBombEntity* this) { super->spriteSettings.draw = 1; super->action = 1; super->spritePriority.b1 = 3; @@ -98,59 +105,59 @@ void sub_0801B250(PlayerItemBombEntity* this) { } } -void sub_0801B2CC(PlayerItemBombEntity* this) { - u16 unaff_r5; +void PlayerItemBomb_Action1(PlayerItemBombEntity* this) { + u16 input; if (!sub_0800442E(super)) { RegisterCarryEntity(super); } switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) { case EQUIP_SLOT_A: - unaff_r5 = PLAYER_INPUT_1; + input = PLAYER_INPUT_1; break; case EQUIP_SLOT_B: - unaff_r5 = PLAYER_INPUT_2; + input = PLAYER_INPUT_2; break; case EQUIP_SLOT_NONE: - unaff_r5 = 0; + input = 0; break; } - if ((gPlayerState.playerInput.newInput & unaff_r5) != 0) { + if ((gPlayerState.playerInput.newInput & input) != 0) { super->timer = 0; super->subtimer = 1; } } -void sub_0801B318(PlayerItemBombEntity* this) { - subActionFuncs[super->subAction](this); +void PlayerItemBomb_Action2(PlayerItemBombEntity* this) { + PlayerItemBomb_SubActions[super->subAction](this); } -void sub_0801B330(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction0(PlayerItemBombEntity* this) { super->subAction++; sub_08079BD8(super); } -void sub_0801B340(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction1(PlayerItemBombEntity* this) { super->spritePriority.b1 = 2; } -void sub_0801B354(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction2(PlayerItemBombEntity* this) { super->spritePriority.b1 = 3; } -void sub_0801B368(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction3(PlayerItemBombEntity* this) { super->action--; super->subAction = 0; - if (0x3c < super->timer) { + if (super->timer > 60) { super->timer = 60; } } -void sub_0801B384(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction4(PlayerItemBombEntity* this) { DeleteThisEntity(); } -void sub_0801B38C(PlayerItemBombEntity* this) { +void PlayerItemBomb_Action3(PlayerItemBombEntity* this) { if (super->timer-- == 0) { DeleteThisEntity(); } @@ -158,7 +165,7 @@ void sub_0801B38C(PlayerItemBombEntity* this) { void sub_0801B3A4(PlayerItemBombEntity* this) { u32 tmp; - if (super->subtimer >= 0x29) { + if (super->subtimer > 40) { tmp = 8; } else { tmp = 4; diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index 6557a08c..b8b9229d 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -1,213 +1,229 @@ -#include "entity.h" -#include "sound.h" -#include "functions.h" +/** + * @file playerItemBoomerang.c + * @ingroup Items + * + * @brief Boomerang Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "entity.h" +#include "functions.h" #include "item.h" +#include "sound.h" -void sub_0801B804(Entity*); -Entity* sub_0801B864(Entity*); -void sub_0801B584(Entity*); -void PlayerItemBoomerang_Init(Entity*); -void sub_0801B680(Entity*); -void sub_0801B7A8(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unused1[23]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unused2[1]; + /*0x83*/ union SplitHWord unk_82; + /*0x84*/ u8 unused3[2]; + /*0x86*/ u16 unk_86; +} PlayerItemBoomerangEntity; + +void sub_0801B804(PlayerItemBoomerangEntity* this); +Entity* sub_0801B864(Entity* this); +void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this); +void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this); +void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this); +void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this); extern Entity* sub_08008782(Entity*, u32, s32, s32); extern bool32 sub_080040E2(Entity*, u8*); extern Hitbox gUnk_081271CC; extern u8 gUnk_08003E44; -void PlayerItemBoomerang(Entity* this) { - static void (*const PlayerItemBoomerang_Actions[])(Entity*) = { +void PlayerItemBoomerang(PlayerItemBoomerangEntity* this) { + static void (*const PlayerItemBoomerang_Actions[])(PlayerItemBoomerangEntity*) = { PlayerItemBoomerang_Init, - sub_0801B584, - sub_0801B680, - sub_0801B7A8, + PlayerItemBoomerang_Action1, + PlayerItemBoomerang_Action2, + PlayerItemBoomerang_Action3, }; // Unused static const u16 gUnk_080B780C[] = { 0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x0 }; - PlayerItemBoomerang_Actions[this->action](this); - if (this->animIndex != 0xb) { - if (this->animationState == 6) { - this->field_0x86.HWORD += 0x2000; + PlayerItemBoomerang_Actions[super->action](this); + if (super->animIndex != 0xb) { + if (super->animationState == 6) { + this->unk_86 += 0x2000; } else { - this->field_0x86.HWORD -= 0x2000; + this->unk_86 -= 0x2000; } - SetAffineInfo(this, 0x100, 0x100, this->field_0x86.HWORD); + SetAffineInfo(super, 0x100, 0x100, this->unk_86); } - this->subtimer--; - if ((this->subtimer & 0xf) == 0) { + super->subtimer--; + if ((super->subtimer & 0xf) == 0) { EnqueueSFX(SFX_FB); } } -void PlayerItemBoomerang_Init(Entity* this) { - u32 uVar1; - - gPlayerState.item = this; - this->action = 1; - this->hitbox = &gUnk_081271CC; - this->frameIndex = 0xff; - this->field_0x80.HALF.LO = 0; +void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this) { + gPlayerState.item = super; + super->action = 1; + super->hitbox = &gUnk_081271CC; + super->frameIndex = 0xff; + this->unk_80 = 0; #ifdef EU - this->spriteVramOffset = gPlayerEntity.spriteVramOffset; + super->spriteVramOffset = gPlayerEntity.spriteVramOffset; #endif - this->animIndex = 11; - this->parent = &gPlayerEntity; - this->field_0x86.HWORD = 0; - if ((this->animationState & 2) != 0) { - this->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX; + super->animIndex = 11; + super->parent = &gPlayerEntity; + this->unk_86 = 0; + if ((super->animationState & 2) != 0) { + super->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX; } - if (this->field_0x68.HALF.LO == 12) { - this->speed = 0x280; - uVar1 = 60; + if (this->unk_68 == 12) { + super->speed = 0x280; + super->timer = 60; } else { - this->speed = 0x200; - uVar1 = 30; + super->speed = 0x200; + super->timer = 30; } - this->timer = uVar1; if (((s8)gPlayerState.direction) >= 0) { - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; } else { - this->direction = this->animationState << 2; + super->direction = super->animationState << 2; } - this->field_0x82.HALF.HI = this->direction; - if (this->collisionLayer == 2) { - this->type2 = 1; + this->unk_82.HALF.HI = super->direction; + if (super->collisionLayer == 2) { + super->type2 = 1; } - LoadSwapGFX(this, 1, 3); - sub_0801766C(this); - sub_0801B584(this); + LoadSwapGFX(super, 1, 3); + sub_0801766C(super); + PlayerItemBoomerang_Action1(this); } -void sub_0801B584(Entity* this) { +void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this) { static const s8 gUnk_080B7826[] = { 0, -8, 8, -4, 0, 8, -8, -4 }; u32 frameIndex; int iVar2; u32 cVar3; sub_0801B804(this); - if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != this || - (gPlayerState.item == this && gPlayerEntity.action != PLAYER_NORMAL)) { - if (gPlayerState.item == this) { + if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != super || + (gPlayerState.item == super && gPlayerEntity.action != PLAYER_NORMAL)) { + if (gPlayerState.item == super) { gPlayerState.item = NULL; } DeleteThisEntity(); } if ((gPlayerEntity.frame & 1) == 0) { - if (this->field_0x68.HALF.LO == 12) { + if (this->unk_68 == 12) { cVar3 = 6; } else { cVar3 = 0; } frameIndex = (gPlayerEntity.frame >> 4) + cVar3; - if (this->frameIndex != frameIndex) { - this->frameIndex = frameIndex; - sub_080042D0(this, this->frameIndex, this->spriteIndex); + if (super->frameIndex != frameIndex) { + super->frameIndex = frameIndex; + sub_080042D0(super, super->frameIndex, super->spriteIndex); } - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(super, &gPlayerEntity); } else { - this->action = 2; - this->spriteVramOffset = 0xd5; - COLLISION_ON(this); - this->collisionFlags |= 1; - this->flags2 = gPlayerEntity.flags2; - this->spriteIndex = 0xa6; - this->spriteSettings.flipX = 0; - this->spriteSettings.draw = 1; + super->action = 2; + super->spriteVramOffset = 0xd5; + COLLISION_ON(super); + super->collisionFlags |= 1; + super->flags2 = gPlayerEntity.flags2; + super->spriteIndex = 0xa6; + super->spriteSettings.flipX = 0; + super->spriteSettings.draw = 1; - iVar2 = (this->animationState >> 1) * 2; - this->x.HALF.HI += gUnk_080B7826[iVar2]; - this->y.HALF.HI += gUnk_080B7826[iVar2 + 1]; - InitializeAnimation(this, 0); + iVar2 = (super->animationState >> 1) * 2; + super->x.HALF.HI += gUnk_080B7826[iVar2]; + super->y.HALF.HI += gUnk_080B7826[iVar2 + 1]; + InitializeAnimation(super, 0); gPlayerState.item = NULL; gPlayerState.attack_status |= 0x80; } } -void sub_0801B680(Entity* this) { - u32 uvar1; - u32 uVar6; +void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) { + u32 uVar1; + bool32 uVar6; sub_0801B804(this); - if ((this->field_0x68.HALF.LO == 12) && (this->field_0x80.HALF.LO == 0) && ((gPlayerState.direction & 0x80) == 0)) { - if (((this->field_0x82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) { - this->field_0x82.HWORD += 0x40; - this->field_0x82.HALF.HI &= 0x1f; - this->direction = this->field_0x82.HALF.HI; + if ((this->unk_68 == 12) && (this->unk_80 == 0) && !(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { + if (((this->unk_82.HALF.HI - gPlayerState.direction) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest)) > DirectionSouth) { + this->unk_82.HWORD += 0x40; + this->unk_82.HALF.HI &= 0x1f; + super->direction = this->unk_82.HALF.HI; } else { - this->field_0x82.HWORD -= 0x40; - this->field_0x82.HALF.HI &= 0x1f; - this->direction = this->field_0x82.HALF.HI; + this->unk_82.HWORD -= 0x40; + this->unk_82.HALF.HI &= 0x1f; + super->direction = this->unk_82.HALF.HI; } } - LinearMoveUpdate(this); - uVar6 = 0; - if (sub_0801B864(this)) { - uvar1 = this->field_0x68.HALF.LO; - uvar1 ^= 0xc; - if (uvar1) { + LinearMoveUpdate(super); + uVar6 = FALSE; + if (sub_0801B864(super)) { + uVar1 = this->unk_68; + uVar1 ^= 0xc; + if (uVar1) { uVar6 = TRUE; } else { uVar6 = FALSE; } } - if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) { - if (uVar6 == 0) { - uVar6 = sub_080040E2(this, &gUnk_08003E44); + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) { + if (!uVar6) { + uVar6 = sub_080040E2(super, &gUnk_08003E44); } } - if (uVar6 == 0) { - if (--this->timer < 0xc) { - this->speed = this->speed + -0x10; + if (!uVar6) { + if (--super->timer < 0xc) { + super->speed = super->speed + -0x10; } - if (this->timer == 0) { - uVar6 = 1; + if (super->timer == 0) { + uVar6 = TRUE; } - if (this->contactFlags & 0x80) { - uVar6 = 1; + if (super->contactFlags & 0x80) { + uVar6 = TRUE; } - if (uVar6 == 0) { + if (!uVar6) { return; } - if (this->field_0x68.HALF.LO == 12) { - this->timer = 30; + if (this->unk_68 == 12) { + super->timer = 30; } else { - this->timer = 12; + super->timer = 12; } } else { - this->timer = 1; + super->timer = 1; } if (uVar6) { - this->action++; - this->speed = 0x1c0; + super->action++; + super->speed = 0x1c0; } } -void sub_0801B7A8(Entity* this) { +void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this) { sub_0801B804(this); - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { - sub_0801B864(this); - if (this->speed < 0x280) { - this->speed += 8; + sub_0801B864(super); + if (super->speed < 0x280) { + super->speed += 8; } - this->direction = GetFacingDirection(this, &gPlayerEntity); - LinearMoveUpdate(this); - if (sub_0800419C(this, &gPlayerEntity, 2, 2) != 0) { + super->direction = GetFacingDirection(super, &gPlayerEntity); + LinearMoveUpdate(super); + if (sub_0800419C(super, &gPlayerEntity, 2, 2) != 0) { DeleteThisEntity(); } } } -void sub_0801B804(Entity* this) { +void sub_0801B804(PlayerItemBoomerangEntity* this) { EquipSlot equipSlot; u32 uVar1; @@ -225,7 +241,7 @@ void sub_0801B804(Entity* this) { } if ((uVar1 & gPlayerState.playerInput.heldInput) == 0) { - this->field_0x80.HALF.LO = 1; + this->unk_80 = 1; gPlayerState.field_0xa &= ~0x80; gPlayerState.keepFacing &= ~0x80; } else { diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c index de3d14ee..ead771c5 100644 --- a/src/playerItem/playerItemBottle.c +++ b/src/playerItem/playerItemBottle.c @@ -1,3 +1,10 @@ +/** + * @file playerItemBottle.c + * @ingroup Items + * + * @brief Bottle Player Item + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" @@ -6,49 +13,56 @@ #include "sound.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 bottleIndex; /**< @see Item */ + /*0x69*/ u8 unused[6]; + /*0x6f*/ u8 bottleContent; /**< @see Item */ +} PlayerItemBottleEntity; + void PlayerItemBottle_UseEmptyBottle(Entity*); -void PlayerItemBottle_Action1(Entity*); +void PlayerItemBottle_Action1(PlayerItemBottleEntity*); void sub_0801BDE8(Entity*, Entity*); void PlayerItemBottle_UseEmptyBottle2(Entity*); -void PlayerItemBottle_UsePotionOrPicolyte(Entity*); -void PlayerItemBottle_UseOther(Entity*); -void PlayerItemBottle_Init(Entity*); +void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity*); +void PlayerItemBottle_UseOther(PlayerItemBottleEntity*); +void PlayerItemBottle_Init(PlayerItemBottleEntity*); extern u32 SetBottleContents(u32 itemID, u32 bottleIndex); extern void sub_0801B9F0(Entity* this); -void PlayerItemBottle(Entity* this) { - static void (*const PlayerItemBottle_Actions[])(Entity*) = { +void PlayerItemBottle(PlayerItemBottleEntity* this) { + static void (*const PlayerItemBottle_Actions[])(PlayerItemBottleEntity*) = { PlayerItemBottle_Init, PlayerItemBottle_Action1, }; - PlayerItemBottle_Actions[this->action](this); + PlayerItemBottle_Actions[super->action](this); } -void PlayerItemBottle_Init(Entity* this) { - u32 bottleType; +void PlayerItemBottle_Init(PlayerItemBottleEntity* this) { + u32 bottleContent; - if (this->field_0x68.HALF.LO == ITEM_QST_DOGFOOD) { - bottleType = ITEM_QST_DOGFOOD; + if (this->bottleIndex == ITEM_QST_DOGFOOD) { + bottleContent = ITEM_QST_DOGFOOD; } else { - u32 tmp = this->field_0x68.HALF.LO; - bottleType = gSave.saved_status.field_0x24[tmp - 6]; + u32 tmp = this->bottleIndex; + bottleContent = gSave.stats.bottles[tmp - ITEM_BOTTLE1]; } - this->field_0x6e.HALF.HI = bottleType; - switch (bottleType) { + this->bottleContent = bottleContent; + switch (bottleContent) { case ITEM_BOTTLE_EMPTY: - if (AllocMutableHitbox(this) == NULL) { + if (AllocMutableHitbox(super) == NULL) { return; } - COLLISION_ON(this); - this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; - this->flags2 = gPlayerEntity.flags2; - this->hurtType = 0x1f; - this->type = 1; - this->type2 = ITEM_BOTTLE_EMPTY; - this->timer = 82; - this->subtimer = 27; - sub_0801766C(this); + COLLISION_ON(super); + super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; + super->flags2 = gPlayerEntity.flags2; + super->hurtType = 0x1f; + super->type = 1; + super->type2 = ITEM_BOTTLE_EMPTY; + super->timer = 82; + super->subtimer = 27; + sub_0801766C(super); SoundReq(SFX_1DC); break; case ITEM_BOTTLE_BUTTER: @@ -62,43 +76,43 @@ void PlayerItemBottle_Init(Entity* this) { case ITEM_BOTTLE_PICOLYTE_GREEN: case ITEM_BOTTLE_PICOLYTE_BLUE: case ITEM_BOTTLE_PICOLYTE_WHITE: - this->timer = 213; - this->subtimer = 60; + super->timer = 213; + super->subtimer = 60; break; case BOTTLE_CHARM_NAYRU: case BOTTLE_CHARM_FARORE: case BOTTLE_CHARM_DIN: default: - this->timer = 55; - this->subtimer = 0; + super->timer = 55; + super->subtimer = 0; } - this->action = 1; - this->frameIndex = 0xff; - gPlayerState.item = this; - LoadSwapGFX(this, 1, 3); + super->action = 1; + super->frameIndex = 0xff; + gPlayerState.item = super; + LoadSwapGFX(super, 1, 3); PlayerItemBottle_Action1(this); } -void PlayerItemBottle_Action1(Entity* this) { - int iVar1; +void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) { + u32 bottleIndex; - if (gPlayerState.item != this) { - if ((this->type == 1) && (this->type2 != ITEM_BOTTLE_EMPTY)) { - iVar1 = this->field_0x68.HALF.LO - 0x1c; - SetBottleContents(this->type2, iVar1); + if (gPlayerState.item != super) { + if ((super->type == 1) && (super->type2 != ITEM_BOTTLE_EMPTY)) { + bottleIndex = this->bottleIndex - ITEM_BOTTLE1; + SetBottleContents(super->type2, bottleIndex); #if defined(EU) || defined(JP) || defined(DEMO_JP) - CreateItemEntity(this->type2, iVar1, 5); + CreateItemEntity(super->type2, bottleIndex, 5); #else - InitItemGetSequence(this->type2, iVar1, 5); + InitItemGetSequence(super->type2, bottleIndex, 5); #endif SoundReq(SFX_ITEM_GET); } DeleteThisEntity(); } - sub_0801BDE8(this, &gPlayerEntity); - switch (this->field_0x6e.HALF.HI) { + sub_0801BDE8(super, &gPlayerEntity); + switch (this->bottleContent) { case ITEM_BOTTLE_EMPTY: - PlayerItemBottle_UseEmptyBottle2(this); + PlayerItemBottle_UseEmptyBottle2(super); break; case ITEM_BOTTLE_BUTTER: case ITEM_BOTTLE_MILK: @@ -128,15 +142,15 @@ void PlayerItemBottle_UseEmptyBottle2(Entity* this) { PlayerItemBottle_UseEmptyBottle(this); } -void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) { +void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity* this) { u32 health; - u32 bottleType; + u32 bottleContent; - bottleType = ITEM_BOTTLE_EMPTY; + bottleContent = ITEM_BOTTLE_EMPTY; health = 0; - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_MILK: - bottleType = ITEM_BOTTLE_HALF_MILK; + bottleContent = ITEM_BOTTLE_HALF_MILK; case ITEM_BOTTLE_HALF_MILK: health = 40; break; @@ -153,69 +167,69 @@ void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) { case ITEM_BOTTLE_PICOLYTE_GREEN: case ITEM_BOTTLE_PICOLYTE_BLUE: case ITEM_BOTTLE_PICOLYTE_WHITE: - gSave.stats.picolyteType = this->field_0x6e.HALF.HI; + gSave.stats.picolyteType = this->bottleContent; gSave.stats.picolyteTimer = 900; SoundReq(SFX_PICOLYTE); break; } ModHealth(health); - SetBottleContents(bottleType, this->field_0x68.HALF.LO - 0x1c); + SetBottleContents(bottleContent, this->bottleIndex - 0x1c); } -void PlayerItemBottle_UseOther(Entity* this) { +void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) { if (gPlayerEntity.frame == 1) { - if (this->field_0x6e.HALF.HI != 0x36) { - SetBottleContents(ITEM_BOTTLE_EMPTY, this->field_0x68.HALF.LO - 0x1c); + if (this->bottleContent != ITEM_QST_DOGFOOD) { + SetBottleContents(ITEM_BOTTLE_EMPTY, this->bottleIndex - 0x1c); } - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 1); break; case ITEM_BOTTLE_FAIRY: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 2, 2); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 2, 2); ModHealth(0x20); break; case BOTTLE_CHARM_NAYRU: case BOTTLE_CHARM_FARORE: case BOTTLE_CHARM_DIN: - gSave.stats.charm = this->field_0x6e.HALF.HI; + gSave.stats.charm = this->bottleContent; gSave.stats.charmTimer = 3600; SoundReq(SFX_ELEMENT_CHARGE); } } if (gPlayerEntity.frame == 2) { - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 1); break; } } if (gPlayerEntity.frame == 3) { - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 0); break; } } } void sub_0801BDE8(Entity* this, Entity* ent2) { - u32 uVar1; + u32 frameIndex; u32 flipX; u32 animationState; - uVar1 = (ent2->frameIndex - this->timer) + this->subtimer; - if (uVar1 != this->frameIndex) { - this->frameIndex = uVar1; + frameIndex = (ent2->frameIndex - this->timer) + this->subtimer; + if (frameIndex != this->frameIndex) { + this->frameIndex = frameIndex; sub_080042D0(this, this->frameIndex, (u16)this->spriteIndex); } flipX = ent2->spriteSettings.flipX; @@ -236,8 +250,8 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) { 16, -12, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - int iVar2; - Hitbox* pHVar5; + s32 iVar2; + Hitbox* hitbox; const u8* ptr; const s8* ptr2; @@ -257,11 +271,11 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) { ptr = &bottleHitboxParameters[(this->frameIndex - 0x1b) * 4]; if (this->spriteSettings.flipX != 0) { - pHVar5 = this->hitbox; - pHVar5->offset_x = -ptr[0]; + hitbox = this->hitbox; + hitbox->offset_x = -ptr[0]; } else { - pHVar5 = this->hitbox; - pHVar5->offset_x = ptr[0]; + hitbox = this->hitbox; + hitbox->offset_x = ptr[0]; } this->hitbox->offset_y = ptr[1]; this->hitbox->width = ptr[2]; diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index 7dc845b9..dd35bb11 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -1,3 +1,9 @@ +/** + * @file playerItemBow.c + * @ingroup Items + * + * @brief Bow Player Item + */ #define NENT_DEPRECATED #include "asm.h" #include "effects.h" @@ -10,13 +16,13 @@ #include "tiles.h" typedef struct { - Entity base; - u8 unk_68; - u8 unk_69[3]; - u32 unk_6c; - u32 unk_70; - u32 unk_74; - u32 unk_78; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69[3]; + /*0x6c*/ u32 unk_6c; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; + /*0x78*/ u32 unk_78; } PlayerItemBowEntity; typedef struct { @@ -37,20 +43,20 @@ extern Entity* sub_08008782(Entity*, u32, s32, s32); extern void sub_08017744(Entity*); extern void ModArrows(s32); -void sub_08019468(PlayerItemBowEntity*); -void sub_08018FE4(PlayerItemBowEntity*); -void sub_0801917C(PlayerItemBowEntity*); -void sub_08019410(PlayerItemBowEntity*); -void sub_08019444(PlayerItemBowEntity*); +void sub_08019468(PlayerItemBowEntity* this); +void PlayerItemBow_Init(PlayerItemBowEntity* this); +void PlayerItemBow_Action1(PlayerItemBowEntity* this); +void PlayerItemBow_Action2(PlayerItemBowEntity* this); +void PlayerItemBow_Action3(PlayerItemBowEntity* this); void PlayerItemBow(Entity* this) { - static void (*const gUnk_080B3E30[])(PlayerItemBowEntity*) = { - sub_08018FE4, - sub_0801917C, - sub_08019410, - sub_08019444, + static void (*const PlayerItemBow_Actions[])(PlayerItemBowEntity*) = { + PlayerItemBow_Init, + PlayerItemBow_Action1, + PlayerItemBow_Action2, + PlayerItemBow_Action3, }; - gUnk_080B3E30[this->action]((PlayerItemBowEntity*)this); + PlayerItemBow_Actions[this->action]((PlayerItemBowEntity*)this); } static const Hitbox gUnk_080B3E70; @@ -66,14 +72,14 @@ static const struct_080B3E40 gUnk_080B3E40[] = { static const Hitbox gUnk_080B3E70 = { 0, 0, { 4, 0, 0, 0 }, 6, 4 }; static const Hitbox gUnk_080B3E78 = { 0, 0, { 0, 0, 0, 4 }, 4, 6 }; -void sub_08018FE4(PlayerItemBowEntity* this) { +void PlayerItemBow_Init(PlayerItemBowEntity* this) { Entity* object; const struct_080B3E40* ptr; super->action = 1; if (super->type != 0) { super->spriteSettings.draw = 1; super->flags |= 0x80; - this->unk_74 = 0x6a; + this->unk_74 = 106; super->hurtType = super->type2; super->spriteIndex = 0xa6; if (super->hurtType == 0x0e) { @@ -114,7 +120,7 @@ void sub_08018FE4(PlayerItemBowEntity* this) { LoadSwapGFX(super, 1, 3); sub_08079BD8(super); if (this->unk_68 == 0xa) { - this->unk_78 = 0x3c; + this->unk_78 = 60; object = CreateObject(SWORD_PARTICLE, super->type, 1); if (object != NULL) { CopyPosition(super, object); @@ -122,11 +128,11 @@ void sub_08018FE4(PlayerItemBowEntity* this) { } else { this->unk_78 = 0; } - sub_0801917C(this); + PlayerItemBow_Action1(this); } } -void sub_0801917C(PlayerItemBowEntity* this) { +void PlayerItemBow_Action1(PlayerItemBowEntity* this) { u8 arrowCount; bool32 tmp2; s32 tmp3; @@ -138,7 +144,7 @@ void sub_0801917C(PlayerItemBowEntity* this) { DeleteThisEntity(); } GetNextFrame(super); - if (this->unk_74 < 0x18) { + if (this->unk_74 < 24) { super->spriteSettings.draw ^= 1; } LinearMoveUpdate(super); @@ -205,16 +211,16 @@ void sub_0801917C(PlayerItemBowEntity* this) { } } else { - if ((PlayerItemBowEntity*)gPlayerState.item != this || (gPlayerState.field_0x1f[2] == 0)) { + if ((PlayerItemBowEntity*)gPlayerState.item != this || (gPlayerState.bow_state == 0)) { if ((PlayerItemBowEntity*)gPlayerState.item == this) { gPlayerState.item = 0; } - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; DeleteThisEntity(); } - if ((this->unk_68 == 0xa) && (gPlayerState.field_0x1f[2] != 0)) { - if (gPlayerState.field_0x1f[2] < 0x78) { - gPlayerState.field_0x1f[2]++; + if ((this->unk_68 == 0xa) && (gPlayerState.bow_state != 0)) { + if (gPlayerState.bow_state < 0x78) { + gPlayerState.bow_state++; } else { super->hurtType = 0x0e; } @@ -238,7 +244,7 @@ void sub_0801917C(PlayerItemBowEntity* this) { } } -void sub_08019410(PlayerItemBowEntity* this) { +void PlayerItemBow_Action2(PlayerItemBowEntity* this) { if (super->timer < 0xf) { InitializeAnimation(super, super->animIndex); } else { @@ -249,7 +255,7 @@ void sub_08019410(PlayerItemBowEntity* this) { } } -void sub_08019444(PlayerItemBowEntity* this) { +void PlayerItemBow_Action3(PlayerItemBowEntity* this) { GetNextFrame(super); LinearMoveUpdate(super); if (GravityUpdate(super, Q_8_8(32.0)) == 0) { @@ -258,7 +264,7 @@ void sub_08019444(PlayerItemBowEntity* this) { } void sub_08019468(PlayerItemBowEntity* this) { - if (super->hurtType == 0x0e) { + if (super->hurtType == 0xe) { CreateFx(super, FX_REFLECT5, 0); } } diff --git a/src/playerItem/playerItemCellOverwriteSet.c b/src/playerItem/playerItemCellOverwriteSet.c index ac534466..13036ee9 100644 --- a/src/playerItem/playerItemCellOverwriteSet.c +++ b/src/playerItem/playerItemCellOverwriteSet.c @@ -1,3 +1,10 @@ +/** + * @file playerItemCellOverwriteSet.c + * @ingroup Items + * + * @brief Cell Overwrite Set Player Item + */ +#define NENT_DEPRECATED #include "asm.h" #include "common.h" #include "entity.h" @@ -5,6 +12,12 @@ #include "room.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[4]; + /*0x6c*/ u16 tileType; +} PlayerItemCellOverwriteSetEntity; + // vvv for specialMetaTile const u8 gMapSpecialMetaTileToVvv[] = { 0, // SPECIAL_META_TILE_0 @@ -324,70 +337,64 @@ const u16 gUnk_080B7A3E[] = { }; // TODO no need to store this in an u16? // TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4, also related to specialMetaTiles -void PlayerItemCellOverwriteSet(Entity* this) { +void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) { static const s8 offsetByDirection[] = { 0, -16, 16, 0, 0, 16, -16, 0 }; u32 tmp; Entity* player = &gPlayerEntity; - if (this->action == 0) { - this->field_0x6c.HWORD = - GetMetaTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe], - player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]), - this->collisionLayer); - this->action++; + if (super->action == 0) { + this->tileType = GetMetaTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe], + player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]), + super->collisionLayer); + super->action++; } gPlayerState.mobility |= 0x80; tmp = gInput.heldKeys & R_BUTTON; if ((gInput.heldKeys & A_BUTTON) != 0) { - if ((R_BUTTON & gInput.newKeys) != 0) { - this->field_0x6c.HWORD = - GetMetaTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe], - player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]), - this->collisionLayer); + if ((gInput.newKeys & R_BUTTON) != 0) { + this->tileType = GetMetaTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe], + player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]), + super->collisionLayer); } if ((gInput.heldKeys & R_BUTTON) != 0) { player->iframes = 2; } else { if ((gInput.newKeys & DPAD_RIGHT) != 0) { - this->field_0x6c.HWORD--; + this->tileType--; } if ((gInput.newKeys & DPAD_LEFT) != 0) { - this->field_0x6c.HWORD++; + this->tileType++; } if ((gInput.heldKeys & (DPAD_LEFT | DPAD_RIGHT)) != 0) { - if (++this->subtimer > 0x1e) { - this->subtimer = 30; + if (++super->subtimer > 0x1e) { + super->subtimer = 30; if ((gInput.heldKeys & DPAD_RIGHT) != 0) { - this->field_0x6c.HWORD--; + this->tileType--; } if ((gInput.heldKeys & DPAD_LEFT) != 0) { - this->field_0x6c.HWORD++; + this->tileType++; } } } else { - this->subtimer = 0; + super->subtimer = 0; } } } else { - sub_0807B7D8(this->field_0x6c.HWORD, + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe], player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]), - this->collisionLayer); + super->collisionLayer); gPlayerState.mobility &= ~0x80; DeleteThisEntity(); } if ((gInput.heldKeys & B_BUTTON) != 0) { - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + offsetByDirection[0], player->y.HALF.HI + offsetByDirection[1]), - this->collisionLayer); - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + offsetByDirection[2], player->y.HALF.HI + offsetByDirection[3]), - this->collisionLayer); - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + offsetByDirection[4], player->y.HALF.HI + offsetByDirection[5]), - this->collisionLayer); - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + offsetByDirection[6], player->y.HALF.HI + offsetByDirection[7]), - this->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + offsetByDirection[0], player->y.HALF.HI + offsetByDirection[1]), + super->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + offsetByDirection[2], player->y.HALF.HI + offsetByDirection[3]), + super->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + offsetByDirection[4], player->y.HALF.HI + offsetByDirection[5]), + super->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + offsetByDirection[6], player->y.HALF.HI + offsetByDirection[7]), + super->collisionLayer); } } diff --git a/src/playerItem/playerItemDashSword.c b/src/playerItem/playerItemDashSword.c index 5b86a216..59ba47ab 100644 --- a/src/playerItem/playerItemDashSword.c +++ b/src/playerItem/playerItemDashSword.c @@ -1,52 +1,56 @@ - +/** + * @file playerItemDashSword.c + * @ingroup Items + * + * @brief Dash Sword Player Item + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" +#include "player.h" extern Entity* sub_08008782(Entity*, u32, s32, s32); -void sub_0801B8FC(Entity*); -void sub_0801B8B0(Entity*); -void sub_0801B938(Entity*); +void PlayerItemDashSword_Action1(Entity* this); +void PlayerItemDashSword_Init(Entity* this); +void sub_0801B938(Entity* this); extern void sub_08017744(Entity*); void PlayerItemDashSword(Entity* this) { - static void (*const PlayerItemC_Actions[])(Entity*) = { - sub_0801B8B0, - sub_0801B8FC, + static void (*const PlayerItemDashSword_Actions[])(Entity*) = { + PlayerItemDashSword_Init, + PlayerItemDashSword_Action1, }; - PlayerItemC_Actions[this->action](this); + PlayerItemDashSword_Actions[this->action](this); } -void sub_0801B8B0(Entity* this) { +void PlayerItemDashSword_Init(Entity* this) { if (gPlayerState.dash_state != 0) { gPlayerState.item = this; this->flags |= ENT_PERSIST; - this->action = 0x01; + this->action = 1; this->flags2 = 8; LoadSwapGFX(this, 1, 3); sub_08079BD8(this); sub_0801766C(this); - sub_0801B8FC(this); + PlayerItemDashSword_Action1(this); } else { DeleteThisEntity(); } } -void sub_0801B8FC(Entity* this) { - Entity* pbVar1; - pbVar1 = (Entity*)gPlayerState.item; - if ((Entity*)gPlayerState.item != this) { +void PlayerItemDashSword_Action1(Entity* this) { + if (gPlayerState.item != this) { DeleteThisEntity(); } else { if (gPlayerState.dash_state == 0) { gPlayerState.item = NULL; DeleteThisEntity(); } else { - pbVar1->flags |= ENT_COLLIDE; - pbVar1->collisionFlags = 0x21; - sub_0801B938(pbVar1); + this->flags |= ENT_COLLIDE; + this->collisionFlags = 0x21; + sub_0801B938(this); } } } diff --git a/src/playerItem/playerItemFireRodProjectile.c b/src/playerItem/playerItemFireRodProjectile.c index 3c65c353..9c12f1c2 100644 --- a/src/playerItem/playerItemFireRodProjectile.c +++ b/src/playerItem/playerItemFireRodProjectile.c @@ -1,46 +1,52 @@ +/** + * @file playerItemFireRodProjectile.c + * @ingroup Items + * + * @brief Fire Rod Projectile Player Item + */ #define NENT_DEPRECATED #include "asm.h" -#include "entity.h" -#include "sound.h" -#include "physics.h" -#include "functions.h" #include "effects.h" +#include "entity.h" +#include "functions.h" +#include "physics.h" #include "playeritem.h" +#include "sound.h" typedef struct { - Entity base; - u8 unk68; - u16 unk6a; - u32 unk6c; -} FireRodProjectileEntity; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x6a*/ u8 unused[2]; + /*0x6c*/ u32 unk_6c; +} PlayerItemFireRodProjectileEntity; extern u8 gUnk_08003E44; -void sub_080A3084(FireRodProjectileEntity*); -void sub_080A310C(FireRodProjectileEntity*); +void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this); +void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this); void PlayerItemFireRodProjectile(Entity* this) { - static void (*const actionFuncs[])(FireRodProjectileEntity*) = { - sub_080A3084, - sub_080A310C, + static void (*const PlayerItemFireRodProjectile_Actions[])(PlayerItemFireRodProjectileEntity*) = { + PlayerItemFireRodProjectile_Init, + PlayerItemFireRodProjectile_Action1, }; - actionFuncs[this->action]((FireRodProjectileEntity*)this); + PlayerItemFireRodProjectile_Actions[this->action]((PlayerItemFireRodProjectileEntity*)this); } -void sub_080A3084(FireRodProjectileEntity* this) { +void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this) { static const Hitbox gUnk_08127278 = { 0, 0, { 4, 2, 2, 4 }, 6, 6 }; super->spriteSettings.draw = 1; - super->action = 0x01; + super->action = 1; CopyPosition(super->parent, super); if (super->type == 0) { super->collisionFlags = gPlayerEntity.collisionFlags + 1; super->hitbox = (Hitbox*)&gUnk_08127278; super->speed = 0x400; - if (super->collisionLayer == 0x02) { - super->type2 = 0x01; + if (super->collisionLayer == 2) { + super->type2 = 1; } super->direction = Direction8FromAnimationState(super->animationState); - this->unk6c = 60; + this->unk_6c = 60; sub_0801766C(super); LinearMoveUpdate(super); SoundReq(SFX_ITEM_SWORD_BEAM); @@ -48,17 +54,17 @@ void sub_080A3084(FireRodProjectileEntity* this) { super->timer = 6; } InitializeAnimation(super, 0x18); - sub_080A310C(this); + PlayerItemFireRodProjectile_Action1(this); } -void sub_080A310C(FireRodProjectileEntity* this) { +void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this) { if (super->type != 0) { if (super->timer-- == 0) { DeleteThisEntity(); } } else { GetNextFrame(super); - if (this->unk6c-- != 0) { + if (this->unk_6c-- != 0) { GetNextFrame(super); LinearMoveUpdate(super); super->timer++; @@ -77,7 +83,7 @@ void sub_080A310C(FireRodProjectileEntity* this) { if (sub_08008790(super, 0xc)) { DeleteThisEntity(); } - super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk68); + super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk_68); if (super->child != NULL) { super->child->parent = super; } diff --git a/src/playerItem/playerItemGust.c b/src/playerItem/playerItemGust.c index 8d62b981..9f098a71 100644 --- a/src/playerItem/playerItemGust.c +++ b/src/playerItem/playerItemGust.c @@ -1,9 +1,15 @@ +/** + * @file playerItemGust.c + * @ingroup Items + * + * @brief Gust Player Item + */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" -#include "functions.h" #include "asm.h" +#include "entity.h" +#include "functions.h" #include "object.h" +#include "player.h" #include "playeritem.h" enum { @@ -12,20 +18,21 @@ enum { }; typedef struct { - Entity base; - u32 filler68[2]; - u32 timer; - u32 offset_iter; - u32 unk78; -} GustEntity; -typedef void(GustActionFunc)(GustEntity*); + /*0x00*/ Entity base; + /*0x68*/ u32 filler68[2]; + /*0x70*/ u32 timer; + /*0x74*/ u32 offset_iter; + /*0x78*/ u32 unk78; +} PlayerItemGustEntity; + +typedef void(GustActionFunc)(PlayerItemGustEntity*); static GustActionFunc PlayerItemGust_Init; static GustActionFunc PlayerItemGust_Update; -static void sub_080ACC78(GustEntity*); -/*static*/ bool32 sub_080ACDB0(GustEntity*); -static void sub_080ACECC(GustEntity*); +static void sub_080ACC78(PlayerItemGustEntity*); +/*static*/ bool32 sub_080ACDB0(PlayerItemGustEntity*); +static void sub_080ACECC(PlayerItemGustEntity*); typedef struct { u16 bits; @@ -50,7 +57,7 @@ extern const s8 gUnk_08126EE4[]; // type 2: same as 1? // type 3: horizontal spread void PlayerItemGust(Entity* this) { - static GustActionFunc* const sActions[] = { + static GustActionFunc* const PlayerItemGust_Actions[] = { PlayerItemGust_Init, PlayerItemGust_Update, }; @@ -58,11 +65,11 @@ void PlayerItemGust(Entity* this) { if ((gPlayerState.field_0x1c & 0x7f) != 1) { DeleteThisEntity(); } - sActions[this->action]((GustEntity*)this); + PlayerItemGust_Actions[this->action]((PlayerItemGustEntity*)this); this->iframes = 0; } -static void PlayerItemGust_Init(GustEntity* this) { +static void PlayerItemGust_Init(PlayerItemGustEntity* this) { super->action = GUST_UPDATE; super->flags2 = gPlayerEntity.flags2; super->direction = super->animationState << 2; @@ -75,14 +82,14 @@ static void PlayerItemGust_Init(GustEntity* this) { sub_0801766C(super); } -static void PlayerItemGust_Update(GustEntity* this) { +static void PlayerItemGust_Update(PlayerItemGustEntity* this) { if (sub_080ACDB0(this) == FALSE) { sub_080ACC78(this); sub_080ACECC(this); } } -static void sub_080ACC78(GustEntity* this) { +static void sub_080ACC78(PlayerItemGustEntity* this) { s32 width; Obj11* o; Entity* child; @@ -151,7 +158,7 @@ static void sub_080ACC78(GustEntity* this) { } } -bool32 sub_080ACDB0(GustEntity* this) { +bool32 sub_080ACDB0(PlayerItemGustEntity* this) { s32 sVar2; s32 sVar3; Entity* pEVar4; @@ -217,7 +224,7 @@ bool32 sub_080ACDB0(GustEntity* this) { return 0; } -static void sub_080ACECC(GustEntity* this) { +static void sub_080ACECC(PlayerItemGustEntity* this) { Entity* entity; if (super->type < 3 && super->child == NULL && (s32)this->unk78 >= 0 && gUnk_0812AAE8[super->type] <= this->unk78) { diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c index c57bf584..40e673b7 100644 --- a/src/playerItem/playerItemGustBig.c +++ b/src/playerItem/playerItemGustBig.c @@ -1,29 +1,45 @@ +/** + * @file playerItemGustBig.c + * @ingroup Items + * + * @brief Gust Big Player Item + */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" +#include "global.h" +#include "new_player.h" #include "player.h" #include "sound.h" #include "tiles.h" -extern void sub_08078CD0(Entity*); -extern void sub_08018FA0(Entity*); -extern void sub_08018CBC(Entity*); -extern void sub_08018DE8(Entity*); -extern void sub_08018E68(Entity*); -extern void sub_08018F6C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[24]; + /*0x80*/ u32 unk_80; + /*0x84*/ u32 unk_84; +} PlayerItemGustBigEntity; + +extern void sub_08078CD0(Entity* this); +extern void sub_08018FA0(Entity* this); +extern void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this); +extern void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this); +extern void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this); +extern void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this); extern const u8 gUnk_08003E44[]; -void PlayerItemGustBig(Entity* this) { - static void (*const gUnk_080B3DD0[])(Entity*) = { - sub_08018CBC, - sub_08018DE8, - sub_08018E68, - sub_08018F6C, +void PlayerItemGustBig(PlayerItemGustBigEntity* this) { + static void (*const PlayerItemGustBig_Actions[])(PlayerItemGustBigEntity*) = { + PlayerItemGustBig_Init, + PlayerItemGustBig_Action1, + PlayerItemGustBig_Action2, + PlayerItemGustBig_Action3, }; - if (this->health) { - this->iframes = 0; - gUnk_080B3DD0[this->action](this); + if (super->health) { + super->iframes = 0; + PlayerItemGustBig_Actions[super->action](this); } else { DeleteThisEntity(); } @@ -48,95 +64,95 @@ static const Hitbox gUnk_080B3E18 = { 0, 0, { 6, 3, 3, 6 }, 6, 6 }; static const Hitbox gUnk_080B3E20 = { 0, 0, { 6, 3, 3, 6 }, 8, 8 }; static const Hitbox gUnk_080B3E28 = { 0, 0, { 6, 3, 3, 6 }, 12, 12 }; -void sub_08018CBC(Entity* this) { +void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) { u32 PVar1; u8 uVar2; Entity* pEVar3; - *(u32*)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD; - *(u32*)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD; - uVar2 = this->animationState = gPlayerEntity.animationState & 0xe; - this->direction = (u8)(uVar2 << 2); - this->speed = 0x400; - this->hitType = 0x96; - this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80; - this->flags2 = gPlayerEntity.flags2; - pEVar3 = this->child; + this->unk_84 = super->x.WORD = gPlayerEntity.x.WORD; + this->unk_80 = super->y.WORD = gPlayerEntity.y.WORD; + uVar2 = super->animationState = gPlayerEntity.animationState & 0xe; + super->direction = (u8)(uVar2 << 2); + super->speed = 0x400; + super->hitType = 0x96; + super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80; + super->flags2 = gPlayerEntity.flags2; + pEVar3 = super->child; if (pEVar3 != NULL) { - this->action = 1; - COLLISION_OFF(this); - this->timer = 86; - this->hurtType = 0x1c; - this->damage = 6; - this->hitbox = (Hitbox*)&gUnk_080B3E18; - this->child->spriteOffsetX = 0; - this->child->spriteSettings.draw = 0; + super->action = 1; + COLLISION_OFF(super); + super->timer = 86; + super->hurtType = 0x1c; + super->damage = 6; + super->hitbox = (Hitbox*)&gUnk_080B3E18; + super->child->spriteOffsetX = 0; + super->child->spriteSettings.draw = 0; } else { if (gPlayerState.field_0x1c == 0) { DeleteThisEntity(); } - this->action = 2; - this->spriteSettings.draw = 1; - this->spriteIndex = 0xa6; - this->palette.raw = 0x33; - this->spriteVramOffset = 0; - this->type = gPlayerState.gustJarSpeed - 1; - this->timer = gUnk_080B3DE0[this->type * 2]; - this->damage = gUnk_080B3DE0[this->type * 2 + 1]; - this->hurtType = 0x1b; - this->hitbox = (Hitbox*)gUnk_080B3DE8[this->type]; - (u32*)gPlayerEntity.field_0x70.WORD = this; + super->action = 2; + super->spriteSettings.draw = 1; + super->spriteIndex = 0xa6; + super->palette.raw = 0x33; + super->spriteVramOffset = 0; + super->type = gPlayerState.gustJarSpeed - 1; + super->timer = gUnk_080B3DE0[super->type * 2]; + super->damage = gUnk_080B3DE0[super->type * 2 + 1]; + super->hurtType = 0x1b; + super->hitbox = (Hitbox*)gUnk_080B3DE8[super->type]; + gNewPlayerEntity.unk_70 = super; sub_08078CD0(&gPlayerEntity); - (u32*)gPlayerEntity.field_0x70.WORD = pEVar3; - InitializeAnimation(this, this->type + 10); - sub_08018FA0(this); + gNewPlayerEntity.unk_70 = pEVar3; + InitializeAnimation(super, super->type + 10); + sub_08018FA0(super); } - sub_0801766C(this); + sub_0801766C(super); } -void sub_08018DE8(Entity* this) { +void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this) { u8 bVar1; - bVar1 = this->child->gustJarState & 4; + bVar1 = super->child->gustJarState & 4; if (bVar1 == 0) { gPlayerState.field_0x1c = bVar1; DeleteThisEntity(); } switch (gPlayerState.field_0x1c) { case 0: - sub_08018F6C(this); + PlayerItemGustBig_Action3(this); break; case 5: - this->child->subAction = 4; - COLLISION_ON(this); - this->action = 2; - this->spritePriority.b0 = 2; - this->child->spriteSettings.draw = 1; - sub_08018FA0(this); + super->child->subAction = 4; + COLLISION_ON(super); + super->action = 2; + super->spritePriority.b0 = 2; + super->child->spriteSettings.draw = 1; + sub_08018FA0(super); break; } sub_08078CD0(&gPlayerEntity); } -void sub_08018E68(Entity* this) { +void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this) { s32 y; s32 x; - if (this->child == NULL) { - GetNextFrame(this); - sub_08008790(this, 5); + if (super->child == NULL) { + GetNextFrame(super); + sub_08008790(super, 5); } else { - if ((this->child->gustJarState & 4) == 0) { + if ((super->child->gustJarState & 4) == 0) { DeleteThisEntity(); } - if ((this->contactFlags & 0x80) != 0) { - sub_08018F6C(this); + if ((super->contactFlags & 0x80) != 0) { + PlayerItemGustBig_Action3(this); return; } } - if (this->timer-- != 0) { - LinearMoveUpdate(this); + if (super->timer-- != 0) { + LinearMoveUpdate(super); - switch (this->direction) { + switch (super->direction) { case DirectionNorth: x = 0; y = -4; @@ -154,38 +170,38 @@ void sub_08018E68(Entity* this) { y = 0; break; } - if (this->child != NULL) { - this->child->direction = this->direction; - CopyPosition(this, this->child); + if (super->child != NULL) { + super->child->direction = super->direction; + CopyPosition(super, super->child); } - if (this->type2 == 0) { - sub_0800451C(this); + if (super->type2 == 0) { + sub_0800451C(super); } - if (FindValueForKey(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) { + if (FindValueForKey(sub_080B1A0C(super, x, y), gUnk_080B3DF4) != 0) { return; } - if (GetVvvRelativeToEntity(this, x, y) == VVV_116) { + if (GetVvvRelativeToEntity(super, x, y) == VVV_116) { return; } - if (sub_080040D8(this, (u8*)gUnk_08003E44, this->x.HALF.HI + x, this->y.HALF.HI + y) == 0) { + if (sub_080040D8(super, (u8*)gUnk_08003E44, super->x.HALF.HI + x, super->y.HALF.HI + y) == 0) { return; } } - if (this->child == NULL) { - InitializeAnimation(this, this->type + 0xd); + if (super->child == NULL) { + InitializeAnimation(super, super->type + 0xd); } - this->action++; - sub_08018F6C(this); + super->action++; + PlayerItemGustBig_Action3(this); } -void sub_08018F6C(Entity* this) { - if (this->child != NULL) { - this->child->subAction = 5; - this->child->spriteSettings.draw = 1; +void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this) { + if (super->child != NULL) { + super->child->subAction = 5; + super->child->spriteSettings.draw = 1; } else { - GetNextFrame(this); - if (this->frame == 0) { + GetNextFrame(super); + if (super->frame == 0) { return; } } @@ -194,8 +210,8 @@ void sub_08018F6C(Entity* this) { void sub_08018FA0(Entity* this) { this->collisionLayer = gPlayerEntity.collisionLayer; - if (this->collisionLayer == 0x02) { - this->type2 = 0x01; + if (this->collisionLayer == 2) { + this->type2 = 1; } SoundReq(this->type + SFX_EA); } diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index a63fdf3f..6e572616 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -1,6 +1,13 @@ +/** + * @file playerItemGustJar.c + * @ingroup Items + * + * @brief Gust Jar Player Item + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" +#include "player.h" #include "sound.h" extern const u8* gUnk_08132714[]; // Anim index lists? @@ -18,7 +25,7 @@ void sub_080ADCDC(Entity*, u32); void sub_080ADCA0(Entity*, u32); void PlayerItemGustJar(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const PlayerItemGustJar_Actions[])(Entity*) = { PlayerItemGustJar_Init, PlayerItemGustJar_Action1, PlayerItemGustJar_Action2, PlayerItemGustJar_Action3, PlayerItemGustJar_Action4, }; @@ -26,7 +33,7 @@ void PlayerItemGustJar(Entity* this) { if (((Entity*)gPlayerState.item != this) || (gPlayerState.field_0x1c == 0)) { DeleteThisEntity(); } - actionFuncs[this->action](this); + PlayerItemGustJar_Actions[this->action](this); sub_08078E84(this, &gPlayerEntity); } diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c index 353c7dc1..2348baa6 100644 --- a/src/playerItem/playerItemHeldObject.c +++ b/src/playerItem/playerItemHeldObject.c @@ -1,10 +1,14 @@ +/** + * @file playerItemHeldObject.c + * @ingroup Items + * + * @brief Held Object Player Item + */ #define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" #include "functions.h" -#include "functions.h" -#include "functions.h" #include "new_player.h" #include "new_player.h" #include "new_player.h" @@ -15,11 +19,12 @@ #include "tiles.h" typedef struct { - Entity base; - u8 unk_68[4]; - u16 unk_6c; - u16 unk_6e; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68[4]; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u16 unk_6e; } PlayerItemHeldObjectEntity; + extern bool32 ProcessMovement10(Entity*); typedef struct { @@ -29,26 +34,26 @@ typedef struct { u8 unk3; } struct_gUnk_081320B8; -bool32 sub_080AD32C(PlayerItemHeldObjectEntity*); -void sub_080AD27C(PlayerItemHeldObjectEntity*); -void sub_080ACF2C(PlayerItemHeldObjectEntity*); -void sub_080ACFCC(PlayerItemHeldObjectEntity*); -void sub_080AD040(PlayerItemHeldObjectEntity*); -void sub_080AD274(PlayerItemHeldObjectEntity*); +bool32 sub_080AD32C(PlayerItemHeldObjectEntity* this); +void sub_080AD27C(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction0(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction3(PlayerItemHeldObjectEntity* this); void PlayerItemHeldObject(Entity* this) { - static void (*const subActionFuncs[])(PlayerItemHeldObjectEntity*) = { - sub_080ACF2C, - sub_080ACFCC, - sub_080AD040, - sub_080AD274, + static void (*const PlayerItemHeldObject_SubActions[])(PlayerItemHeldObjectEntity*) = { + PlayerItemHeldObject_SubAction0, + PlayerItemHeldObject_SubAction1, + PlayerItemHeldObject_SubAction2, + PlayerItemHeldObject_SubAction3, }; - subActionFuncs[this->subAction]((PlayerItemHeldObjectEntity*)this); + PlayerItemHeldObject_SubActions[this->subAction]((PlayerItemHeldObjectEntity*)this); } static const Hitbox3D gUnk_081320E4; -void sub_080ACF2C(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction0(PlayerItemHeldObjectEntity* this) { static const struct_gUnk_081320B8 gUnk_081320B8[] = { { 0, 2, 0xe8, 0 }, { 0, 5, 0xe0, 0 }, { 0, 5, 0xf2, 0 } }; PlayerItemHeldObjectEntity* child; PlayerItemHeldObjectEntity* child2; @@ -81,7 +86,7 @@ void sub_080ACF2C(PlayerItemHeldObjectEntity* this) { this->unk_6e = (child->base).id; } -void sub_080ACFCC(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this) { Entity* child = super->child; if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) { if (child->action != 2) { @@ -102,7 +107,7 @@ void sub_080ACFCC(PlayerItemHeldObjectEntity* this) { } } -void sub_080AD040(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) { static const s8 gUnk_081320C4[] = { 0, -6, 6, 0, 0, 6, -6, 0, }; @@ -223,7 +228,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) { } } -void sub_080AD274(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction3(PlayerItemHeldObjectEntity* this) { DeleteThisEntity(); } diff --git a/src/playerItem/playerItemLantern.c b/src/playerItem/playerItemLantern.c index 6d22375e..0883dd78 100644 --- a/src/playerItem/playerItemLantern.c +++ b/src/playerItem/playerItemLantern.c @@ -1,27 +1,33 @@ +/** + * @file playerItemLantern.c + * @ingroup Items + * + * @brief Lantern Player Item + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" #include "item.h" #include "object.h" +#include "player.h" -void sub_08054AC8(Entity*); -void sub_08054A60(Entity*); +void PlayerItemLantern_Init(Entity* this); +void PlayerItemLantern_Action1(Entity* this); void PlayerItemLantern(Entity* this) { - static void (*const gUnk_080FEEA8[])(Entity*) = { - sub_08054A60, - sub_08054AC8, + static void (*const PlayerItemLantern_Actions[])(Entity*) = { + PlayerItemLantern_Init, + PlayerItemLantern_Action1, }; - gUnk_080FEEA8[this->action](this); + PlayerItemLantern_Actions[this->action](this); this->contactFlags = 0; } -void sub_08054A60(Entity* this) { +void PlayerItemLantern_Init(Entity* this) { this->flags |= (ENT_PERSIST | ENT_COLLIDE); this->action = 1; this->timer = 4; this->frameIndex = -1; - // TODO regalloc and mov 6 too early this->updatePriority = 6; this->collisionFlags = 7; this->flags2 = -0x80; @@ -31,10 +37,10 @@ void sub_08054A60(Entity* this) { } sub_0801766C(this); LoadSwapGFX(this, 1, 3); - sub_08054AC8(this); + PlayerItemLantern_Action1(this); } -void sub_08054AC8(Entity* this) { +void PlayerItemLantern_Action1(Entity* this) { Entity* object; static const s8 offsets[] = { 6, -6, 7, -3, -5, 2, -7, -3 }; this->animationState = gPlayerEntity.animationState & 0xe; diff --git a/src/playerItem/playerItemPacciCane.c b/src/playerItem/playerItemPacciCane.c index 5a9fbd14..cc11837b 100644 --- a/src/playerItem/playerItemPacciCane.c +++ b/src/playerItem/playerItemPacciCane.c @@ -1,9 +1,16 @@ -#include "entity.h" -#include "sound.h" -#include "functions.h" +/** + * @file playerItemPacciCane.c + * @ingroup Items + * + * @brief Pacci Cane Player Item + */ +#define NENT_DEPRECATED #include "common.h" +#include "entity.h" +#include "functions.h" #include "message.h" #include "save.h" +#include "sound.h" #include "structures.h" void PlayerItemPacciCane_Action1(Entity*); diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c index 4fbb7995..d48ed569 100644 --- a/src/playerItem/playerItemPacciCaneProjectile.c +++ b/src/playerItem/playerItemPacciCaneProjectile.c @@ -1,27 +1,46 @@ +/** + * @file playerItemPacciCaneProjectile.c + * @ingroup Items + * + * @brief Pacci Cane Projectile Player Item + */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" -#include "sound.h" #include "object.h" +#include "sound.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[4]; + /*0x6c*/ u32 unk_6c; + /*0x70*/ u32 unk_70; + /*0x74*/ s32 unk_74; + /*0x78*/ s32 unk_78; + /*0x7c*/ u32 unk_7c; +} PlayerItemPacciCaneProjectileEntity; + static const Hitbox gUnk_0811B9D0; -void PlayerItemPacciCaneProjectile_Init(Entity* this); -void sub_080701F8(Entity* this); -void sub_0807037C(Entity* this); -void sub_08070398(Entity* this); -void sub_080703BC(Entity* this); -void sub_08070458(Entity* this); +void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action2(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action3(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action4(PlayerItemPacciCaneProjectileEntity* this); +void sub_08070458(PlayerItemPacciCaneProjectileEntity* this); extern void sub_08017744(Entity*); extern u8* sub_08008782(Entity*, u32, u32, u32); -void PlayerItemPacciCaneProjectile(Entity* this) { - static void (*const PlayerItemPacciCaneProjectile_Actions[])(Entity*) = { - PlayerItemPacciCaneProjectile_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC, +void PlayerItemPacciCaneProjectile(PlayerItemPacciCaneProjectileEntity* this) { + static void (*const PlayerItemPacciCaneProjectile_Actions[])(PlayerItemPacciCaneProjectileEntity*) = { + PlayerItemPacciCaneProjectile_Init, PlayerItemPacciCaneProjectile_Action1, + PlayerItemPacciCaneProjectile_Action2, PlayerItemPacciCaneProjectile_Action3, + PlayerItemPacciCaneProjectile_Action4, }; - PlayerItemPacciCaneProjectile_Actions[this->action](this); + PlayerItemPacciCaneProjectile_Actions[super->action](this); } extern u8 gUnk_08003E44; @@ -35,7 +54,7 @@ typedef struct { u8 filler[3]; } gUnk_0811B9A8_struct; -void PlayerItemPacciCaneProjectile_Init(Entity* this) { +void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* this) { static const s8 gUnk_0811B9A0[] = { 0, -18, 14, 0, 0, 14, -14, 0, }; @@ -47,36 +66,36 @@ void PlayerItemPacciCaneProjectile_Init(Entity* this) { }; const gUnk_0811B9A8_struct* ptr; - this->action = 1; - this->spriteSettings.draw = 1; - COLLISION_ON(this); - this->direction = this->animationState << 2; - this->speed = 0x200; - *(u32*)&this->field_0x74 = 0x40; - *(u32*)&this->field_0x78 = 0x1e0; - this->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[this->animationState]; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[this->animationState + 1]; - this->collisionFlags = 7; - this->flags2 = 0x8a; - this->hitbox = (Hitbox*)&gUnk_0811B9D0; - if (this->collisionLayer == 2) { - this->type = 1; + super->action = 1; + super->spriteSettings.draw = 1; + COLLISION_ON(super); + super->direction = super->animationState << 2; + super->speed = 0x200; + this->unk_74 = 0x40; + this->unk_78 = 0x1e0; + super->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[super->animationState]; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[super->animationState + 1]; + super->collisionFlags = 7; + super->flags2 = 0x8a; + super->hitbox = (Hitbox*)&gUnk_0811B9D0; + if (super->collisionLayer == 2) { + super->type = 1; } else { - this->type = 0; + super->type = 0; } - this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - ptr = &gUnk_0811B9A8[(this->animationState >> 1)]; - this->spriteSettings.flipX = ptr->flipX; - this->spriteSettings.flipY = ptr->flipY; - this->animIndex = ptr->animIndex; - *(int*)&this->field_0x6c = ptr->unk2; - this->field_0x70.WORD = ptr->unk3; - sub_0801766C(this); - InitializeAnimation(this, this->animIndex); + super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + ptr = &gUnk_0811B9A8[(super->animationState >> 1)]; + super->spriteSettings.flipX = ptr->flipX; + super->spriteSettings.flipY = ptr->flipY; + super->animIndex = ptr->animIndex; + this->unk_6c = ptr->unk2; + this->unk_70 = ptr->unk3; + sub_0801766C(super); + InitializeAnimation(super, super->animIndex); SoundReq(SFX_1DD); } -void sub_080701F8(Entity* this) { +void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* this) { static const s8 gUnk_0811B9C8[] = { 0, -4, 4, 0, 0, 4, -4, 0, }; @@ -85,87 +104,87 @@ void sub_080701F8(Entity* this) { u8* iVar3; Entity* pEVar4; - cVar1 = gUnk_0811B9C8[this->animationState]; - cVar2 = gUnk_0811B9C8[this->animationState + 1]; - iVar3 = sub_08008782(this, 10, cVar1, cVar2); + cVar1 = gUnk_0811B9C8[super->animationState]; + cVar2 = gUnk_0811B9C8[super->animationState + 1]; + iVar3 = sub_08008782(super, 10, cVar1, cVar2); if (iVar3) { pEVar4 = CreateObject(OBJECT_53, iVar3[5], iVar3[2]); if (pEVar4) { pEVar4->timer = iVar3[3]; - pEVar4->x.HALF.HI = this->x.HALF.HI + cVar1; - pEVar4->y.HALF.HI = this->y.HALF.HI + cVar2; + pEVar4->x.HALF.HI = super->x.HALF.HI + cVar1; + pEVar4->y.HALF.HI = super->y.HALF.HI + cVar2; } sub_08070458(this); return; } - if ((--(*(int*)&this->field_0x74) == -1) || (--(*(int*)&this->field_0x78) == -1)) { + if ((--(this->unk_74) == -1) || (--(this->unk_78) == -1)) { sub_08070458(this); } else { - GetNextFrame(this); - LinearMoveUpdate(this); - if (this->type == 0) { - sub_0800451C(this); + GetNextFrame(super); + LinearMoveUpdate(super); + if (super->type == 0) { + sub_0800451C(super); } - if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) { - if (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) == 0) { - if (GetVvvAtEntity(this) == VVV_25) { - this->action = 4; - COLLISION_OFF(this); - this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8; - this->y.HALF.HI = (this->y.HALF.HI & 0xfff0) | 8; - this->spritePriority.b0 = 7; - this->field_0x7c.WORD = GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer); - InitializeAnimation(this, 0x14); - SetMetaTile(SPECIAL_META_TILE_32, COORD_TO_TILE(this), this->collisionLayer); + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) { + if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) { + if (GetVvvAtEntity(super) == VVV_25) { + super->action = 4; + COLLISION_OFF(super); + super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8; + super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) | 8; + super->spritePriority.b0 = 7; + this->unk_7c = GetMetaTileIndex(COORD_TO_TILE(super), super->collisionLayer); + InitializeAnimation(super, 0x14); + SetMetaTile(SPECIAL_META_TILE_32, COORD_TO_TILE(super), super->collisionLayer); return; } } else { sub_08070458(this); } } - if (this->contactFlags != 0) { + if (super->contactFlags != 0) { sub_08070458(this); } } } -void sub_0807037C(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { +void PlayerItemPacciCaneProjectile_Action2(PlayerItemPacciCaneProjectileEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } -void sub_08070398(Entity* this) { - GetNextFrame(this); - LinearMoveUpdate(this); - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { +void PlayerItemPacciCaneProjectile_Action3(PlayerItemPacciCaneProjectileEntity* this) { + GetNextFrame(super); + LinearMoveUpdate(super); + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { DeleteThisEntity(); } } -void sub_080703BC(Entity* this) { - GetNextFrame(this); - switch (GetMetaTileIndex(COORD_TO_TILE(this), this->collisionLayer)) { +void PlayerItemPacciCaneProjectile_Action4(PlayerItemPacciCaneProjectileEntity* this) { + GetNextFrame(super); + switch (GetMetaTileIndex(COORD_TO_TILE(super), super->collisionLayer)) { default: - this->field_0x7c.WORD = 0; + this->unk_7c = 0; sub_08070458(this); break; case SPECIAL_META_TILE_33: sub_08070458(this); break; case SPECIAL_META_TILE_112: - *(int*)&this->field_0x78 = 0xff; + this->unk_78 = 0xff; case SPECIAL_META_TILE_32: - if (--(*(int*)&this->field_0x78) == -1) { + if (--(this->unk_78) == -1) { sub_08070458(this); } else { - if (this->contactFlags == 0) { + if (super->contactFlags == 0) { return; } - if (((this->contactFlags & 0x7f) == 0) && (this->action != 0x1a)) { + if (((super->contactFlags & 0x7f) == 0) && (super->action != 0x1a)) { return; } sub_08070458(this); @@ -175,15 +194,15 @@ void sub_080703BC(Entity* this) { } } -void sub_08070458(Entity* this) { - this->action = 2; - COLLISION_OFF(this); - this->speed = 0; - if (this->field_0x7c.WORD != 0) { - SetMetaTile(this->field_0x7c.WORD, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); +void sub_08070458(PlayerItemPacciCaneProjectileEntity* this) { + super->action = 2; + COLLISION_OFF(super); + super->speed = 0; + if (this->unk_7c != 0) { + SetMetaTile(this->unk_7c, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); } - InitializeAnimation(this, 0x13); - sub_08017744(this); + InitializeAnimation(super, 0x13); + sub_08017744(super); SoundReq(SFX_199); } diff --git a/src/playerItem/playerItemShield.c b/src/playerItem/playerItemShield.c index 14f7a2aa..e4fa03b6 100644 --- a/src/playerItem/playerItemShield.c +++ b/src/playerItem/playerItemShield.c @@ -1,29 +1,35 @@ +/** + * @file playerItemShield.c + * @ingroup Items + * + * @brief Shield Player Item + */ #define NENT_DEPRECATED - -#include "entity.h" -#include "player.h" -#include "functions.h" -#include "sound.h" #include "collision.h" +#include "entity.h" +#include "functions.h" +#include "player.h" #include "playeritem.h" +#include "sound.h" const Hitbox gUnk_081271CC = { 0, 0, { 1, 0, 0, 1 }, 8, 8 }; typedef struct { - Entity base; - u8 unk_68; - u8 unk_69[3]; - u32 bounceTimer; - u32 unk_70; - u32 unk_74; - u32 unk_78; - u8* unk_7c; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69[3]; + /*0x6c*/ u32 bounceTimer; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; + /*0x78*/ u32 unk_78; + /*0x7c*/ u8* unk_7c; } PlayerItemShieldEntity; -void sub_080A2D98(PlayerItemShieldEntity*); -void sub_080A2E00(PlayerItemShieldEntity*); -void (*const gUnk_081271D4[])(PlayerItemShieldEntity*) = { - sub_080A2D98, - sub_080A2E00, + +void PlayerItemShield_Init(PlayerItemShieldEntity* this); +void PlayerItemShield_Action1(PlayerItemShieldEntity* this); +void (*const PlayerItemShield_Actions[])(PlayerItemShieldEntity*) = { + PlayerItemShield_Init, + PlayerItemShield_Action1, }; const u8 gUnk_081271DC[] = { 7, 60, 0, 0, 0, 2, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 3, 2, 0, 0, 4, 2, 0, 0, 5, 2, 0, 0, 6, 2, 0, 0, 7, 20, @@ -48,16 +54,16 @@ const Hitbox gUnk_08127258 = { 5, -4, { 0, 0, 0, 0 }, 5, 7 }; const Hitbox gUnk_08127260 = { 0, 0, { 0, 0, 0, 0 }, 6, 7 }; const Hitbox gUnk_08127268 = { -5, -4, { 0, 0, 0, 0 }, 5, 7 }; -void sub_080A2E00(PlayerItemShieldEntity* this); +void PlayerItemShield_Action1(PlayerItemShieldEntity* this); void PlayerItemShield(PlayerItemShieldEntity* this) { if (this->bounceTimer != 0) { this->bounceTimer--; } - gUnk_081271D4[super->action](this); + PlayerItemShield_Actions[super->action](this); } -void sub_080A2D98(PlayerItemShieldEntity* this) { +void PlayerItemShield_Init(PlayerItemShieldEntity* this) { gPlayerState.item = super; super->action = 1; super->updatePriority = 6; @@ -73,10 +79,10 @@ void sub_080A2D98(PlayerItemShieldEntity* this) { super->animationState = gPlayerEntity.animationState & 0xe; sub_08079BD8(super); LoadSwapGFX(super, 1, 3); - sub_080A2E00(this); + PlayerItemShield_Action1(this); } -void sub_080A2E00(PlayerItemShieldEntity* this) { +void PlayerItemShield_Action1(PlayerItemShieldEntity* this) { Entity* playerItem; u8* pbVar3; u32 tmp2; diff --git a/src/playerItem/playerItemSpiralBeam.c b/src/playerItem/playerItemSpiralBeam.c index 153edce5..09f128d6 100644 --- a/src/playerItem/playerItemSpiralBeam.c +++ b/src/playerItem/playerItemSpiralBeam.c @@ -1,60 +1,71 @@ -#include "entity.h" -#include "sound.h" -#include "functions.h" -#include "effects.h" +/** + * @file playerItemSpiral Beam.c + * @ingroup Items + * + * @brief Spiral Beam Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "effects.h" +#include "entity.h" +#include "functions.h" +#include "sound.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[4]; + /*0x6c*/ u32 unk_6c; +} PlayerItemSpiralBeamEntity; extern u8 gUnk_08003E44; -void sub_0805FBE8(Entity*); -void sub_0805FC74(Entity*); +void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity*); +void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity*); -void PlayerItemSpiralBeam(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0805FBE8, - sub_0805FC74, +void PlayerItemSpiralBeam(PlayerItemSpiralBeamEntity* this) { + static void (*const PlayerItemSpiralBeam_Actions[])(PlayerItemSpiralBeamEntity*) = { + PlayerItemSpiralBeam_Init, + PlayerItemSpiralBeam_Action1, }; - actionFuncs[this->action](this); + PlayerItemSpiralBeam_Actions[super->action](this); } -void sub_0805FBE8(Entity* this) { +void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity* this) { static const Hitbox gUnk_08109AD0 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; - CopyPosition(&gPlayerEntity, this); - this->action++; - this->spriteSettings.draw = TRUE; - this->collisionFlags = gPlayerEntity.collisionFlags + 1; - this->hitbox = (Hitbox*)&gUnk_08109AD0; - this->speed = 0x380; - this->animationState = this->animationState & 0x7f; - if (this->collisionLayer == 2) { - this->type2 = 1; + CopyPosition(&gPlayerEntity, super); + super->action++; + super->spriteSettings.draw = TRUE; + super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->hitbox = (Hitbox*)&gUnk_08109AD0; + super->speed = 0x380; + super->animationState = super->animationState & 0x7f; + if (super->collisionLayer == 2) { + super->type2 = 1; } - this->direction = this->animationState << 2; - *(u32*)&this->field_0x6c = 0x3c; - InitializeAnimation(this, (this->animationState >> 1) + 0xc); - sub_0801766C(this); - LinearMoveUpdate(this); - sub_0805FC74(this); + super->direction = super->animationState << 2; + this->unk_6c = 60; + InitializeAnimation(super, (super->animationState >> 1) + 0xc); + sub_0801766C(super); + LinearMoveUpdate(super); + PlayerItemSpiralBeam_Action1(this); SoundReq(SFX_ITEM_SWORD_BEAM); } -void sub_0805FC74(Entity* this) { - int iVar1; - - if (--*(int*)&this->field_0x6c != -1) { - GetNextFrame(this); - LinearMoveUpdate(this); - this->timer++; - if (this->type2 == 0) { - sub_0800451C(this); +void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity* this) { + if (this->unk_6c-- != 0) { + GetNextFrame(super); + LinearMoveUpdate(super); + super->timer++; + if (super->type2 == 0) { + sub_0800451C(super); } - if (!sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) && - sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI)) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) && + sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } - if (this->contactFlags != 0) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if (super->contactFlags != 0) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } } else { diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index 2a8f4ef4..acbba11f 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -1,3 +1,9 @@ +/** + * @file playerItemSword.c + * @ingroup Items + * + * @brief Sword Player Item + */ #define NENT_DEPRECATED #include "asm.h" #include "effects.h" @@ -8,26 +14,26 @@ #include "tiles.h" typedef struct { - Entity base; - u8 unk_68; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; } PlayerItemSwordEntity; void sub_080A78B8(PlayerItemSwordEntity*, Entity*); void sub_080A7B98(PlayerItemSwordEntity*); void sub_080A7A54(PlayerItemSwordEntity*); -void sub_080A7824(PlayerItemSwordEntity*); -void sub_080A76CC(PlayerItemSwordEntity*); -void sub_080A758C(PlayerItemSwordEntity*); +void PlayerItemSword_Action2(PlayerItemSwordEntity*); +void PlayerItemSword_Action1(PlayerItemSwordEntity*); +void PlayerItemSword_Init(PlayerItemSwordEntity*); void sub_080A7A84(PlayerItemSwordEntity*); void PlayerItemSword(Entity* this) { - static void (*const gUnk_0812905C[])(PlayerItemSwordEntity*) = { - sub_080A758C, - sub_080A76CC, - sub_080A7824, + static void (*const PlayerItemSword_Actions[])(PlayerItemSwordEntity*) = { + PlayerItemSword_Init, + PlayerItemSword_Action1, + PlayerItemSword_Action2, }; - gUnk_0812905C[this->action]((PlayerItemSwordEntity*)this); + PlayerItemSword_Actions[this->action]((PlayerItemSwordEntity*)this); if (this->type == 0) { sub_08078E84(this, &gPlayerEntity); this->hitbox->offset_x += this->spriteOffsetX; @@ -35,7 +41,7 @@ void PlayerItemSword(Entity* this) { } } -void sub_080A758C(PlayerItemSwordEntity* this) { +void PlayerItemSword_Init(PlayerItemSwordEntity* this) { static const u8 gUnk_08129068[] = { 0x56, 0x55, @@ -80,16 +86,16 @@ void sub_080A758C(PlayerItemSwordEntity* this) { break; } super->action++; - sub_080A7824(this); + PlayerItemSword_Action2(this); } else { super->damage = gPlayerState.swordDamage * 2 + 4; - sub_080A76CC(this); + PlayerItemSword_Action1(this); } gPlayerState.item = super; sub_08079BD8(super); SoundReq(gUnk_0812906C[GetRandomByWeight(gUnk_08129068)]); } else { - sub_080A76CC(this); + PlayerItemSword_Action1(this); } SoundReq(SFX_10E); } @@ -148,7 +154,7 @@ static const s8 gUnk_081292E2[] = { 0x0, 0x2, -0x8, 0xa, -0x8, 0xa, 0x0 0x0, -0x2, 0x10, -0x12, 0x10, -0x12, 0x0, -0x16, 0x0, -0x16, -0xc, -0x14, -0xc, -0x10, -0xc, -0xc, 0x0, -0x2 }; -void sub_080A76CC(PlayerItemSwordEntity* this) { +void PlayerItemSword_Action1(PlayerItemSwordEntity* this) { Entity* effect; Effect type; const s8* ptr; @@ -222,7 +228,7 @@ void sub_080A76CC(PlayerItemSwordEntity* this) { } } -void sub_080A7824(PlayerItemSwordEntity* this) { +void PlayerItemSword_Action2(PlayerItemSwordEntity* this) { if (gPlayerState.item != super) { DeleteThisEntity(); } diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index dfd78d5d..36ad1b73 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -1,109 +1,120 @@ -#include "entity.h" -#include "player.h" -#include "physics.h" -#include "functions.h" -#include "sound.h" -#include "effects.h" -#include "common.h" +/** + * @file playerItemSwordBeam.c + * @ingroup Items + * + * @brief Sword Beam Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "common.h" +#include "effects.h" +#include "entity.h" +#include "functions.h" +#include "physics.h" +#include "player.h" +#include "sound.h" -void sub_08019498(Entity*); -void sub_08019580(Entity*); -void sub_08019644(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[4]; + /*0x6c*/ u32 unk_6c; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; +} PlayerItemSwordBeamEntity; + +void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this); +void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this); +void PlayerItemSwordBeam_CyclePalettes(PlayerItemSwordBeamEntity* this); extern u8 gUnk_08003E44; -void PlayerItemSwordBeam(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08019498, - sub_08019580, +void PlayerItemSwordBeam(PlayerItemSwordBeamEntity* this) { + static void (*const PlayerItemSwordBeam_Actions[])(PlayerItemSwordBeamEntity*) = { + PlayerItemSwordBeam_Init, + PlayerItemSwordBeam_Action1, }; - actionFuncs[this->action](this); + PlayerItemSwordBeam_Actions[super->action](this); } -static const u8 gUnk_080B43FC[] = { 30, 29, 30, 29 }; -static const u8 gUnk_080B4400[] = { 0, 4, 1, 2, -1, 0, 0, 0 }; +static const u8 PlayerItemSwordBeam_AnimIndices[] = { 30, 29, 30, 29 }; +static const u8 PlayerItemSwordBeam_Palettes[] = { 0, 4, 1, 2, 0xff }; -void sub_08019498(Entity* this) { - static const Hitbox gUnk_080B4408 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; - CopyPosition(&gPlayerEntity, this); - this->action += 0x01; - this->spriteSettings.draw = 1; - this->collisionFlags = gPlayerEntity.collisionFlags + 1; - this->hitbox = (Hitbox*)&gUnk_080B4408; - this->speed = 0x380; - *(u32*)&this->field_0x74 = 2; - this->field_0x70.WORD = 0; - if (this->collisionLayer == 0x02) { - this->type2 = 0x01; +void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this) { + static const Hitbox hitbox = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; + CopyPosition(&gPlayerEntity, super); + super->action++; + super->spriteSettings.draw = 1; + super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->hitbox = (Hitbox*)&hitbox; + super->speed = 0x380; + this->unk_74 = 2; + this->unk_70 = 0; + if (super->collisionLayer == 2) { + super->type2 = 1; } - this->direction = this->animationState << 2; - *(u32*)&this->field_0x6c = 0x3c; - switch (this->animationState) { + super->direction = super->animationState << 2; + this->unk_6c = 60; + switch (super->animationState) { case 0: - this->x.HALF.HI += -3; - this->y.HALF.HI += -8; - this->spriteSettings.flipY = 1; + super->x.HALF.HI -= 3; + super->y.HALF.HI -= 8; + super->spriteSettings.flipY = 1; break; case 4: - this->x.HALF.HI += 2; + super->x.HALF.HI += 2; break; case 2: - this->spriteSettings.flipX = 1; - this->x.HALF.HI++; - this->y.HALF.HI += -4; + super->spriteSettings.flipX = 1; + super->x.HALF.HI++; + super->y.HALF.HI -= 4; break; case 6: - this->x.HALF.HI--; - this->y.HALF.HI += -4; + super->x.HALF.HI--; + super->y.HALF.HI -= 4; break; } - InitializeAnimation(this, gUnk_080B43FC[this->animationState >> 1]); - sub_0801766C(this); - LinearMoveUpdate(this); - sub_08019580(this); + InitializeAnimation(super, PlayerItemSwordBeam_AnimIndices[super->animationState >> 1]); + sub_0801766C(super); + LinearMoveUpdate(super); + PlayerItemSwordBeam_Action1(this); SoundReq(SFX_ITEM_SWORD_BEAM); } -void sub_08019580(Entity* this) { - if (--*(int*)&this->field_0x6c != -1) { - GetNextFrame(this); - LinearMoveUpdate(this); - this->timer++; - if (this->type2 == 0) { - sub_0800451C(this); +void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this) { + if (this->unk_6c-- != 0) { + GetNextFrame(super); + LinearMoveUpdate(super); + super->timer++; + if (super->type2 == 0) { + sub_0800451C(super); } - if ((sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) && - (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) != 0)) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) && + (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0)) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } - if (this->contactFlags != 0) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if (super->contactFlags != 0) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } - if (sub_08008790(this, 0xc) != NULL) { + if (sub_08008790(super, 0xc) != NULL) { DeleteThisEntity(); } } else { DeleteThisEntity(); } - sub_08019644(this); + PlayerItemSwordBeam_CyclePalettes(this); } -void sub_08019644(Entity* this) { - s32 iVar1; - - iVar1 = *(int*)&this->field_0x74 + -1; - *(int*)&this->field_0x74 = iVar1; - if (iVar1 == 0) { - *(int*)&this->field_0x74 = 2; - this->field_0x70.WORD++; - if (gUnk_080B4400[this->field_0x70.WORD] == 0xff) { - this->field_0x70.WORD = iVar1; +void PlayerItemSwordBeam_CyclePalettes(PlayerItemSwordBeamEntity* this) { + if (--this->unk_74 == 0) { + this->unk_74 = 2; + this->unk_70++; + if (PlayerItemSwordBeam_Palettes[this->unk_70] == 0xff) { + this->unk_70 = 0; } - ChangeObjPalette(this, (u32)gUnk_080B4400[this->field_0x70.WORD]); + ChangeObjPalette(super, PlayerItemSwordBeam_Palettes[this->unk_70]); } } diff --git a/src/playerUtils.c b/src/playerUtils.c index b46cef42..3b1ea60a 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -20,6 +20,7 @@ #include "save.h" #include "screen.h" #include "screenTransitions.h" +#include "main.h" #include "tilemap.h" #include "tiles.h" @@ -29,7 +30,7 @@ extern void sub_0800857C(Entity*); extern void SetDefaultPriorityForKind(Entity*); extern void sub_0809D738(Entity*); extern s32 Mod(s32, s32); -extern void sub_08003FDE(Entity*, u32, u32, u32); +extern u32 sub_08003FDE(Entity*, Entity*, u32, u32); extern u32 sub_080B1B84(u32, u32); extern void UpdateScreenShake(void); void sub_080790E4(Entity* this); @@ -144,6 +145,24 @@ extern u32 sub_08004202(Entity*, u8*, u32); extern MapDataDefinition gUnk_02022830; extern u16* gUnk_0800823C[]; +extern bool32 sub_0806FC24(u32, u32); + +extern const u8 gUnk_0800845C[]; +extern const u8 gUnk_0811BFE0[]; +extern const u8 gUnk_08007DF4[]; +extern const u8 gUnk_080084BC[]; + +extern InteractableObject gInteractableObjects[]; + +u32 sub_0807A180(Entity*, Entity*, u32, u32); + +extern u32 gUsedPalettes; + +extern void ClearBgAnimations(void); +extern void LoadBgAnimations(u16*); + +void sub_0807BFA8(void); + void UpdateActiveItems(PlayerEntity* this) { u32 index; @@ -374,7 +393,7 @@ void ResetActiveItems() { gPlayerState.moleMittsState = 0; gPlayerState.field_0x1c = 0; - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; gPlayerState.grab_status = 0; gPlayerState.itemAnimPriority = 0; gPlayerState.dash_state = 0; @@ -491,7 +510,7 @@ Entity* sub_08077CF8(u32 id, u32 type, u32 type2, u32 unk) { } void sub_08077D38(ItemBehavior* this, u32 index) { - u32 r6; + u32 anim; ItemDefinition* ptr; gPlayerState.field_0xa |= 8 >> index; @@ -506,16 +525,16 @@ void sub_08077D38(ItemBehavior* this, u32 index) { if ((gPlayerState.flags & PL_NO_CAP)) { switch (this->behaviorId) { case 0x1b: - r6 = 0x948; + anim = ANIM_GRAB_NOCAP; break; case 1: - r6 = 0x408; + anim = ANIM_SWORD_NOCAP; break; case 0xd: - r6 = 0x40c; + anim = ANIM_SHIELD_PULLOUT_NOCAP; break; } - SetItemAnim(this, r6); + SetItemAnim(this, anim); } else { SetItemAnim(this, ptr->frameIndex); } @@ -584,8 +603,8 @@ void DeleteItemBehavior(ItemBehavior* this, u32 index) { } bool32 sub_08077EC8(ItemBehavior* this) { - if ((gPlayerState.sword_state & 8) != 0) { - SetItemAnim(this, 0x170); + if (gPlayerState.sword_state & 8) { + SetItemAnim(this, ANIM_SWORD_CHARGE_BUMP); this->timer = 0x28; this->stateID = 7; this->animPriority = 6; @@ -1014,7 +1033,7 @@ void DetermineRButtonInteraction(void) { rAction = gHUD.rActionInteractTile; } else { interaction = sub_080784E4(); - if (interaction->entity->interactType == 0) { + if (interaction->entity->interactType == INTERACTION_NONE) { switch (interaction->type) { case INTERACTION_TALK: @@ -1065,15 +1084,15 @@ void DetermineRButtonInteraction(void) { } bool32 sub_080782C0(void) { - u8 tmp; + u8 framestate; Entity* entity; if (gPlayerState.framestate == PL_STATE_IDLE) { - tmp = gPlayerState.framestate_last; + framestate = gPlayerState.framestate_last; } else { - tmp = gPlayerState.framestate; + framestate = gPlayerState.framestate; } - switch (tmp) { + switch (framestate) { case PL_STATE_SWORD: case PL_STATE_GUSTJAR: case PL_STATE_C: @@ -1115,12 +1134,12 @@ bool32 sub_080782C0(void) { if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && ((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) < 100)) { AddKinstoneToBag(KINSTONE_NONE); - if (gSave.kinstoneAmounts[0] != 0) { + if (gSave.kinstones.amounts[0] != 0) { gPossibleInteraction.kinstoneId = gPossibleInteraction.currentObject->kinstoneId; - gPossibleInteraction.currentObject->entity->interactType = 2; + gPossibleInteraction.currentObject->entity->interactType = INTERACTION_FUSE; gPlayerState.queued_action = PLAYER_08070E9C; } else { - CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x65), 0); + CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x65), 0); // "Hey, you don't have any Kinstone Pieces! ..." } ForceSetPlayerState(PL_STATE_TALKEZLO); return TRUE; @@ -1141,12 +1160,12 @@ bool32 sub_080782C0(void) { case INTERACTION_OPEN_CHEST: case INTERACTION_USE_SMALL_KEY: case INTERACTION_TALK_MINISH: - entity->interactType = 1; + entity->interactType = INTERACTION_TALK; gPossibleInteraction.kinstoneId = KINSTONE_NONE; return TRUE; case INTERACTION_LIFT_SHOP_ITEM: if (gRoomVars.shopItemType == 0) { - entity->interactType = 1; + entity->interactType = INTERACTION_TALK; gRoomVars.shopItemType = entity->type; gRoomVars.shopItemType2 = entity->type2; return TRUE; @@ -1162,7 +1181,132 @@ void ResetPossibleInteraction(void) { } // determines which (if any) object the player is currently able to interact with -ASM_FUNC("asm/non_matching/playerUtils/sub_080784E4.inc", InteractableObject* sub_080784E4(void)) +InteractableObject* sub_080784E4(void) { + u8 frameState; + PlayerFlags r7; + s32 r3; + PlayerFlags PVar4; + u8* puVar5; + u8* hitbox; + s8* interactOffsets; + Entity* entity; + s32 r4; + InteractableObject* iObject; + u32 index; + s32 interactX; + s32 interactY; + + if (gPossibleInteraction.isUpdated != 0) { + return gPossibleInteraction.currentObject; + } + if ((gPlayerState.field_0x27[0] | gPlayerState.swim_state) != 0) { + goto l; + } + + if (gPlayerState.framestate == 0) { + frameState = gPlayerState.framestate_last; + } else { + frameState = gPlayerState.framestate; + } + switch (frameState) { + case PL_STATE_SWORD: + case PL_STATE_GUSTJAR: + case PL_STATE_DIE: + case PL_STATE_ITEMGET: + case PL_STATE_DROWN: + l: + gPossibleInteraction.currentIndex = 0xFF; + gPossibleInteraction.currentObject = (InteractableObject*)&gNoInteraction; + gPossibleInteraction.isUpdated = 1; + return gPossibleInteraction.currentObject; + } + + if (!(gPlayerState.flags & PL_MINISH)) { + r7 = HasDungeonSmallKey() ? PL_BUSY : 0; + if (HasDungeonBigKey()) { + r7 |= PL_FLAGS2; + } + interactOffsets = (s8*)gPlayerInteractHitboxOffsetNormal + (gPlayerEntity.animationState & 6); + } else { + interactOffsets = (s8*)gPlayerInteractHitboxOffsetMinish + (gPlayerEntity.animationState & 6); + r7 = 0; + } + + interactX = gPlayerEntity.x.HALF.HI + interactOffsets[0]; + interactY = gPlayerEntity.y.HALF.HI + interactOffsets[1]; + + for (index = 0; index < 0x20; index++) { + iObject = gInteractableObjects + index; + entity = iObject->entity; + if (entity == NULL) + continue; + if (entity->interactType < 0) + break; + if (((iObject->ignoreLayer & 1) == 0 && (gPlayerEntity.collisionLayer & entity->collisionLayer) == 0) || + (iObject->interactDirections >> (gPlayerEntity.animationState >> 1) & 1) != 0) + continue; + switch (iObject->type) { + case INTERACTION_NONE: + continue; + case INTERACTION_TALK: + case INTERACTION_OPEN_CHEST: + case INTERACTION_UNUSED: + case INTERACTION_LIFT_SHOP_ITEM: + case INTERACTION_CHECK: + if (gPlayerState.flags & PL_MINISH) + continue; + break; + case INTERACTION_TALK_MINISH: + PVar4 = gPlayerState.flags & PL_MINISH; + if (!PVar4) + continue; + break; + case INTERACTION_FUSE: + PVar4 = (PlayerFlags)iObject->kinstoneId; + if (PVar4 == 0) + continue; + break; + case INTERACTION_USE_SMALL_KEY: + PVar4 = PL_BUSY & r7; + if (!PVar4) + continue; + break; + case INTERACTION_USE_BIG_KEY: + PVar4 = PL_FLAGS2 & r7; + if (!PVar4) + continue; + break; + case INTERACTION_DROP_PEDESTAL: + default: + break; + } + + r3 = iObject->entity->x.HALF.HI; + r4 = iObject->entity->y.HALF.HI; + hitbox = (u8*)iObject->customHitbox; + if (hitbox != NULL) { + r3 += (s8)hitbox[0]; + r4 += (s8)hitbox[1]; + puVar5 = hitbox + 2; + } else { + puVar5 = &iObject->entity->hitbox->width; + } + if (((puVar5[0] + interactX) - r3 < (u32)puVar5[0] << 1) && + ((puVar5[1] + interactY) - r4 < (u32)puVar5[1] << 1)) { + break; + } + } + if (index < 0x20) { + gPossibleInteraction.currentIndex = (u8)index; + gPossibleInteraction.currentObject = &gPossibleInteraction.candidates[index]; + + } else { + gPossibleInteraction.currentIndex = 0xFF; + gPossibleInteraction.currentObject = (InteractableObject*)&gNoInteraction; + } + gPossibleInteraction.isUpdated = 1; + return gPossibleInteraction.currentObject; +} void AddInteractableWhenBigObject(Entity* ent) { AddInteractableObject(ent, 1, 0); @@ -1241,7 +1385,7 @@ void SetInteractableObjectCollision(Entity* arg0, u32 ignoreLayer, u32 interactD s32 AddInteractableObject(Entity* entity, InteractionType type, KinstoneId kinstoneId) { s32 index; - entity->interactType = 0; + entity->interactType = INTERACTION_NONE; index = GetInteractableObjectIndex(entity); if (index < 0) { index = GetInteractableObjectIndex(0); @@ -1299,7 +1443,53 @@ void FreeCarryEntity(Entity* this) { } } -ASM_FUNC("asm/non_matching/playerUtils/sub_080789A8.inc", u32 sub_080789A8()) +u32 sub_080789A8(void) { + u32 uVar2; + Entity* entity; + u32 uVar4; + const u8* ptr; + const u8* ptr2; + Entity** tmp1; + + if (gCarriedEntity.unk_0) + return (u32)gCarriedEntity.unk_1; + + if (!(gPlayerState.flags & PL_MINISH)) { + uVar4 = GetCollisionDataAtEntity(&gPlayerEntity); + if (uVar4 >= 0x10 && (gUnk_080084BC[uVar4 - 0x10] == 0xf)) + return 0; + if (gPlayerState.floor_type == 0x12) + return 0; + + gCarriedEntity.unk_0 = 1; + uVar4 = (u32)gCarriedEntity.count; + + if (uVar4 > 0) { + ptr2 = &gUnk_0811BFE0[gPlayerEntity.animationState & 6]; + while (uVar4 > 0) { + tmp1 = &gCarriedEntity.unk_8 + uVar4; + entity = *tmp1; + if ((entity != NULL) && (sub_0807A180(&gPlayerEntity, entity, ptr2[0], ptr2[1]) != 0)) { + gCarriedEntity.unk_8 = *tmp1; + gCarriedEntity.unk_1 = 2; + return 2; + } + uVar4--; + } + } + + ptr = &gUnk_08007DF4[gPlayerEntity.animationState & 6]; + gCarriedEntity.unk_4 = uVar2 = sub_080B1A0C(&gPlayerEntity, (s8)ptr[0], (s8)ptr[1]); + + if (!sub_0806FC24(uVar2, 6)) + return 0; + + } else + return 0; + + gCarriedEntity.unk_1 = 1; + return 1; +} void SetPlayerControl(PlayerControlMode mode) { if (gPlayerState.controlMode != CONTROL_DISABLED) { @@ -1310,12 +1500,7 @@ void SetPlayerControl(PlayerControlMode mode) { void CreateEzloHint(u32 hintId, u32 hintHeight) { gPlayerState.queued_action = PLAYER_TALKEZLO; gRoomTransition.hint_idx = hintId; -#if defined(EU) || defined(JP) - // TODO what fields of the room transition are switched in these variants? - gRoomTransition.field_0x2c[7] = hintHeight; -#else gRoomTransition.hint_height = hintHeight; -#endif } void sub_08078AC0(u32 param_1, u32 param_2, u32 param_3) { @@ -1390,7 +1575,7 @@ void ClearPlayerState(void) { gPlayerState.dash_state = 0; gPlayerState.field_0x1f[0] = 0; gPlayerState.field_0x1f[1] = 0; - gPlayerState.field_0x1f[2] = 0; + gPlayerState.bow_state = 0; gPlayerState.tilePosition = 0; gPlayerState.tileType = 0; gPlayerState.swim_state = 0; @@ -1517,7 +1702,7 @@ bool32 CheckQueuedAction(void) { // this doesnt seem to have any real function where its used void CheckPlayerVelocity(void) { u32 angle = gPlayerState.direction; - if ((angle & 0x80) != 0) { + if (angle & DIR_NOT_MOVING_CHECK) { ResetPlayerVelocity(); } else { gPlayerState.vel_x = gSineTable[angle * 8]; @@ -1545,17 +1730,17 @@ bool32 sub_08078F74(Entity* this) { void sub_08078FB0(Entity* this) { u32 animIndex; - if ((gPlayerState.pushedObject & 0x80) == 0) { + if (!(gPlayerState.pushedObject & 0x80)) { gPlayerState.field_0x35 = 0xff; } sub_08079064(this); - if ((gPlayerState.flags & PL_NO_CAP) != 0) { + if (gPlayerState.flags & PL_NO_CAP) { animIndex = 0x58; } else { - if ((gPlayerState.flags & PL_MINISH) != 0) { + if (gPlayerState.flags & PL_MINISH) { animIndex = 0x18; } else { - if (gPlayerState.animation >> 8 == 7) { + if (gPlayerState.animation >> 8 == (ANIM_PORTAL_ACTIVATE >> 8)) { animIndex = 0x34; } else { animIndex = 0xb8; @@ -1570,7 +1755,7 @@ void sub_08078FB0(Entity* this) { this->spriteSettings.flipX = 0; } - if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) { + if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) { animIndex = gPlayerState.animation + this->animationState; } else { animIndex = (this->animationState >> 1) + gPlayerState.animation; @@ -1591,7 +1776,7 @@ void sub_08079064(Entity* this) { u32 maxAnimPriority; u32 animIndex; - if ((gPlayerState.flags & (PL_IN_HOLE | PL_MINISH)) == 0) { + if (!(gPlayerState.flags & (PL_IN_HOLE | PL_MINISH))) { maxAnimPriority = 0; for (i = 0; i < 4; i++) { if (gActiveItems[i].animPriority > maxAnimPriority) { @@ -1603,9 +1788,10 @@ void sub_08079064(Entity* this) { if (gPlayerState.itemAnimPriority < maxAnimPriority) { gPlayerState.animation = animIndex; } else if ((gPlayerState.swim_state & 0x80) != 0) { - gPlayerState.animation = 0x2be; + gPlayerState.animation = ANIM_DIVE; } else { - if (gPlayerState.animation == 0x608 || gPlayerState.animation == 0x104 || gPlayerState.animation == 0x404) { + if (gPlayerState.animation == ANIM_LANTERN || gPlayerState.animation == ANIM_WALK || + gPlayerState.animation == ANIM_WALK_NOCAP) { sub_080790E4(this); } } @@ -1627,7 +1813,7 @@ void sub_080790E4(Entity* this) { if ((gPlayerState.pushedObject & 0x80) != 0) { return; } - if (gPlayerState.pushedObject == 0) { + if (!gPlayerState.pushedObject) { if (sub_080793E4(1)) { if (this->subtimer <= 5) { this->subtimer++; @@ -1642,10 +1828,10 @@ void sub_080790E4(Entity* this) { } gPlayerState.field_0x35 = this->animationState; gPlayerState.framestate = PL_STATE_PUSH; - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - gPlayerState.animation = 0x93c; + if (gPlayerState.flags & PL_NO_CAP) { + gPlayerState.animation = ANIM_PUSH_NOCAP; } else { - gPlayerState.animation = 0x33c; + gPlayerState.animation = ANIM_PUSH; } } @@ -1670,10 +1856,10 @@ void SetPlayerActionNormal(void) { } void ResetPlayerAnimationAndAction(void) { - if ((gPlayerState.flags & PL_HIDDEN) == 0) { + if (!(gPlayerState.flags & PL_HIDDEN)) { gPlayerEntity.spriteSettings.draw = 3; } - if ((gPlayerState.flags & PL_MINISH) == 0) { + if (!(gPlayerState.flags & PL_MINISH)) { gPlayerEntity.spritePriority.b1 = 1; PlayerSetNormalAndCollide(); } else { @@ -1692,14 +1878,14 @@ void PlayerSetNormalAndCollide(void) { } void PlayerMinishSetNormalAndCollide(void) { - if ((gPlayerState.flags & PL_HIDDEN) == 0) { + if (!(gPlayerState.flags & PL_HIDDEN)) { gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 3; } gPlayerEntity.action = PLAYER_MINISH; gPlayerEntity.subAction = 1; gPlayerEntity.collisionFlags &= 0xfb; - gPlayerState.animation = 0xc18; + gPlayerState.animation = ANIM_BOUNCE_MINISH; gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE); gPlayerState.swim_state = 0; @@ -1714,16 +1900,52 @@ void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) { gPlayerEntity.direction = direction; } -ASM_FUNC("asm/non_matching/playerUtils/sub_080792D8.inc", void sub_080792D8()) +void sub_080792D8(void) { + Entity* playerEntity = &gPlayerEntity; + + if (playerEntity->knockbackDuration == 0) + return; + + if (playerEntity->action == PLAYER_08071DB8 || gPlayerState.dash_state || (u8)(gPlayerState.heldObject - 1) < 4 || + gPlayerState.jump_status || gPlayerState.floor_type == SURFACE_FF || gPlayerState.field_0x7 & 0x80 || + 0 < (gPlayerState.swim_state & 0xf) - 1 || playerEntity->action == PLAYER_FALL || + gPlayerState.flags & PL_ROLLING) { + playerEntity->knockbackDuration = 0; + } else if (playerEntity->action == PLAYER_CLIMB && playerEntity->knockbackDirection != DirectionSouth) { + playerEntity->knockbackDuration = 0; + } else { + if ((s8)playerEntity->knockbackDuration >= 1) { + playerEntity->knockbackDuration--; + } else { + playerEntity->knockbackDuration++; + } + + if (playerEntity->knockbackDuration == 0) + return; + + gPlayerState.field_0x7 &= 0xdf; + if (0 < playerEntity->iframes && !gPlayerState.swim_state && !(gPlayerState.flags & PL_MINISH) && + !gPlayerState.jump_status) { + ResetActiveItems(); + if (!(gPlayerState.flags & PL_NO_CAP)) { + gPlayerState.animation = ANIM_BOUNCE; + } else { + gPlayerState.animation = ANIM_BOUNCE_NOCAP; + } + } + sub_080027EA(playerEntity, 0x280, playerEntity->knockbackDirection); + sub_0807A5B8(playerEntity->knockbackDirection); + } +} bool32 sub_080793E4(u32 param_1) { u32 tmp; - if (gPlayerState.swim_state == 0) { + if (!gPlayerState.swim_state) { tmp = gUnk_0811C0F8[gPlayerEntity.animationState >> 1]; } else { tmp = gUnk_0811C0F8[gPlayerEntity.direction >> 2]; } - if (sub_08079778() && ((gPlayerState.playerInput.heldInput & tmp) != 0)) { + if (sub_08079778() && (gPlayerState.playerInput.heldInput & tmp)) { if (param_1 != 0) { if (!sub_080B1BA4(GetPlayerTilePos(), gPlayerEntity.collisionLayer, param_1)) { return FALSE; @@ -1736,50 +1958,35 @@ bool32 sub_080793E4(u32 param_1) { } void RespawnPlayer(void) { - u32* ptr1; - u32 index; Entity* player = &gPlayerEntity; - player->action = PLAYER_080728AC; player->z.WORD = 0; player->zVelocity = 0; player->knockbackDuration = 0; ResetPlayerPosition(); - if ((gPlayerState.flags & PL_GYORG_FIGHT) == 0) { - if ((gPlayerState.flags & PL_FLAGS10000) != 0) { + if (!(gPlayerState.flags & PL_GYORG_FIGHT)) { + if (gPlayerState.flags & PL_FLAGS10000) { player->x.HALF.HI = gPlayerState.lilypad->x.HALF.HI; player->y.HALF.HI = gPlayerState.lilypad->y.HALF.HI; } else { - goto code_1; - code_0: - gPlayerEntity.collisionLayer = *ptr1 >> 0x1e; - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + (*ptr1 & 0x3f) * 16 + 8; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + (*ptr1 & 0xfc0) / 4 + 8; - COLLISION_ON(&gPlayerEntity); - goto code_3; - code_1: - index = 0; - if (gPlayerState.path_memory[0] != 0xffffffff) { - ptr1 = gPlayerState.path_memory; - while (GetCollisionDataAtMetaTilePos((u16)*ptr1, *ptr1 >> 0x1e) == COLLISION_DATA_15) { - ptr1++; - index++; - if ((index > 0xf) || (*ptr1 == -1)) { - goto code_3; - break; - } + u32 i; + for (i = 0; i <= 0xf && gPlayerState.path_memory[i] != -1; i++) { + if (GetCollisionDataAtMetaTilePos((u16)gPlayerState.path_memory[i], gPlayerState.path_memory[i] >> 0x1e) != COLLISION_DATA_15) { + gPlayerEntity.collisionLayer = gPlayerState.path_memory[i] >> 0x1e; + gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + (gPlayerState.path_memory[i] & 0x3f) * 16 + 8; + gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + (gPlayerState.path_memory[i] & 0xfc0) / 4 + 8; + COLLISION_ON(&gPlayerEntity); + break; } - goto code_0; } } } -code_3: UpdateSpriteForCollisionLayer(&gPlayerEntity); } void sub_08079520(Entity* this) { s32 tmp = gPlayerState.direction; - if (tmp < 0x80) { + if (tmp < DIR_NOT_MOVING_CHECK) { this->direction = gPlayerState.direction; } else { this->direction = (this->animationState >> 1) << 3; @@ -1797,10 +2004,10 @@ bool32 sub_08079550(void) { u32 tilePos2; u32 tilePos1; - if (gDiggingCaveEntranceTransition.isDiggingCave == 0) { - if ((gPlayerState.dash_state == 0 || (gPlayerState.flags & PL_BURNING)) && - (gPlayerState.swim_state != 0 || (gPlayerState.sword_state & 0x40) || - gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & 0x80))) { + if (!gDiggingCaveEntranceTransition.isDiggingCave) { + if ((!gPlayerState.dash_state || (gPlayerState.flags & PL_BURNING)) && + (gPlayerState.swim_state || (gPlayerState.sword_state & 0x40) || + gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & DIR_NOT_MOVING_CHECK))) { gPlayerEntity.subtimer = 0; return FALSE; } @@ -1847,7 +2054,7 @@ void sub_08079708(Entity* this) { this->action = PLAYER_MINISHDIE; this->subAction = 0; sub_080085B0(this); - if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) { + if (!(gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS))) { SetPlayerEventPriority(); } } @@ -1874,7 +2081,7 @@ void sub_08079744(Entity* this) { bool32 sub_08079778(void) { u32 tmp; - if (gPlayerState.swim_state == 0) { + if (!gPlayerState.swim_state) { tmp = gUnk_0811C108[gPlayerEntity.animationState >> 1]; } else { tmp = gUnk_0811C108[gPlayerEntity.direction >> 2]; @@ -1890,76 +2097,77 @@ u32 sub_080797C4(void) { void sub_080797EC(void) { u32 animation; - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - if (gPlayerState.heldObject != 0) { - animation = 0x934; - } else if (gPlayerState.shield_status != 0) { - animation = 0x410; - } else if (gPlayerState.field_0x1f[2] == 0) { - if (gPlayerState.swim_state != 0) { - animation = 0x290; + if (gPlayerState.flags & PL_NO_CAP) { + if (gPlayerState.heldObject) { + animation = ANIM_CARRY_NOCAP; + } else if (gPlayerState.shield_status) { + animation = ANIM_SHIELD_WALK_NOCAP; + } else if (!gPlayerState.bow_state) { + if (gPlayerState.swim_state) { + animation = ANIM_SWIM_MOVE; } else { - animation = 0x16c; - if ((gPlayerState.sword_state & 0x48) != 0) { + animation = ANIM_SWORD_CHARGE_WALK; + if (gPlayerState.sword_state & 0x48) { gPlayerState.prevAnim = 0x6c; return; - } else if (gPlayerState.sword_state == 0) { - if (gPlayerState.framestate == 0) { - gPlayerState.framestate = 1; + } else if (!gPlayerState.sword_state) { + if (gPlayerState.framestate == PL_STATE_IDLE) { + gPlayerState.framestate = PL_STATE_WALK; } - animation = 0x404; + animation = ANIM_WALK_NOCAP; } else { - animation = 0x16c; + animation = ANIM_SWORD_CHARGE_WALK; if (sub_080793E4(0)) { if (GetCollisionDataAtMetaTilePos(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != COLLISION_DATA_255) { gPlayerState.sword_state &= ~8; - animation = 0x170; + animation = ANIM_SWORD_CHARGE_BUMP; } } } } } else { - animation = 0x284; + animation = ANIM_BOW_WALK; } } else { - if (gPlayerState.field_0x1c != 0) { + if (gPlayerState.field_0x1c) { return; - } else if (gPlayerState.heldObject != 0) { - animation = 0x348; - } else if (gPlayerState.dash_state != 0) { - animation = 0x298; - } else if ((gPlayerState.flags & PL_IN_MINECART) != 0) { - animation = 0x710; - } else if (gPlayerState.shield_status != 0) { - animation = 0x160; - } else if (gPlayerState.field_0x1f[2] != 0) { - animation = 0x284; + } else if (gPlayerState.heldObject) { + animation = ANIM_CARRY; + } else if (gPlayerState.dash_state) { + animation = ANIM_DASH; + } else if (gPlayerState.flags & PL_IN_MINECART) { + animation = ANIM_MINECART; + } else if (gPlayerState.shield_status) { + animation = ANIM_SHIELD_WALK; + } else if (gPlayerState.bow_state) { + animation = ANIM_BOW_WALK; } else { - if (gPlayerState.swim_state != 0) { - animation = 0x290; + if (gPlayerState.swim_state) { + animation = ANIM_SWIM_MOVE; } else { - animation = 0x16c; - if ((gPlayerState.sword_state & 0x48) != 0) { + animation = ANIM_SWORD_CHARGE_WALK; + if (gPlayerState.sword_state & 0x48) { gPlayerState.prevAnim = 0x6c; return; - } else if (gPlayerState.sword_state != 0) { - animation = 0x16c; + } else if (gPlayerState.sword_state) { + animation = ANIM_SWORD_CHARGE_WALK; if (sub_080793E4(0)) { if (GetCollisionDataAtMetaTilePos(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != COLLISION_DATA_255) { gPlayerState.sword_state &= ~8; - animation = 0x170; + animation = ANIM_SWORD_CHARGE_BUMP; } } } else { - if (gPlayerState.framestate == 0) { - gPlayerState.framestate = 1; + if (gPlayerState.framestate == PL_STATE_IDLE) { + gPlayerState.framestate = PL_STATE_WALK; } if ((gPlayerState.flags & PL_USE_LANTERN) != 0) { - animation = 0x608; + animation = ANIM_LANTERN; } else { - animation = 0x104; + // Change to test animations I guess + animation = ANIM_WALK; } } } @@ -1967,7 +2175,7 @@ void sub_080797EC(void) { } gPlayerState.animation = animation; - if (gPlayerState.shield_status == 0) { + if (!gPlayerState.shield_status) { UpdateAnimationSingleFrame(&gPlayerEntity); } } @@ -1976,90 +2184,90 @@ void ResolvePlayerAnimation(void) { u32 index; u32 maxAnimPriority; u32 anim; - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - if (gPlayerState.heldObject != 0) { - anim = 0x92c; + if (gPlayerState.flags & PL_NO_CAP) { + if (gPlayerState.heldObject) { + anim = ANIM_CARRY_STAND_NOCAP; } else { - if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) { + if (gPlayerState.field_0x1c | gPlayerState.moleMittsState) { return; } - if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) != 0) { - anim = 0x810; - } else if (gPlayerState.shield_status != 0) { - anim = 0x414; - } else if (gPlayerState.field_0x1f[2] != 0) { - anim = 0x280; - } else if (gPlayerState.swim_state != 0) { - anim = 0x28c; + if (gPlayerState.flags & PL_CONVEYOR_PUSHED) { + anim = ANIM_JUMP; + } else if (gPlayerState.shield_status) { + anim = ANIM_SHIELD_NOCAP; + } else if (gPlayerState.bow_state) { + anim = ANIM_BOW_CHARGE; + } else if (gPlayerState.swim_state) { + anim = ANIM_SWIM_STILL; } else { - if ((gPlayerState.sword_state & 0x48) != 0) { + if (gPlayerState.sword_state & 0x48) { return; } - if (gPlayerState.sword_state == 0) { - if (gPlayerState.attack_status != 0) { + if (!gPlayerState.sword_state) { + if (gPlayerState.attack_status) { return; } - if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { + if (gPlayerState.flags & PL_USE_PORTAL) { switch (gArea.portal_type) { - case 5: - anim = 0x400; + case PT_5: + anim = ANIM_DEFAULT_NOCAP; break; - case 4: - anim = 0x100; + case PT_JAR: + anim = ANIM_DEFAULT; break; default: - anim = 0x2c2; + anim = ANIM_PORTAL; break; } } else { - anim = 0x400; + anim = ANIM_DEFAULT_NOCAP; } } else { - anim = 0x168; + anim = ANIM_SWORD_CHARGE; } } } } else { - if (gPlayerState.heldObject != 0) { - anim = 0x350; + if (gPlayerState.heldObject) { + anim = ANIM_CARRY_STAND; } else { - if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) { + if (gPlayerState.field_0x1c | gPlayerState.moleMittsState) { return; } - if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) { - anim = 0x8b0; - } else if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) != 0) { - anim = 0x810; - } else if (gPlayerState.dash_state != 0) { - anim = 0x298; - } else if ((gPlayerState.flags & PL_IN_MINECART) != 0) { - anim = 0x70c; - } else if (gPlayerState.shield_status != 0) { - anim = 0x164; - } else if (gPlayerState.field_0x1f[2] != 0) { - anim = 0x280; - } else if (gPlayerState.swim_state != 0) { - anim = 0x28c; + if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) { + anim = ANIM_MOLDWORM_CAPTURED; + } else if (gPlayerState.flags & PL_CONVEYOR_PUSHED) { + anim = ANIM_JUMP; + } else if (gPlayerState.dash_state) { + anim = ANIM_DASH; + } else if (gPlayerState.flags & PL_IN_MINECART) { + anim = ANIM_MINECART_PAUSE; + } else if (gPlayerState.shield_status) { + anim = ANIM_SHIELD; + } else if (gPlayerState.bow_state) { + anim = ANIM_BOW_CHARGE; + } else if (gPlayerState.swim_state) { + anim = ANIM_SWIM_STILL; } else { - if ((gPlayerState.sword_state & 0x48) != 0) { + if (gPlayerState.sword_state & 0x48) { return; } - if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { - anim = (gArea.portal_type == 4) ? 0x530 : 0x2c2; + if (gPlayerState.flags & PL_USE_PORTAL) { + anim = (gArea.portal_type == PT_JAR) ? ANIM_IN_POT : ANIM_PORTAL; } else { - if (gPlayerState.sword_state != 0) { - anim = 0x168; + if (gPlayerState.sword_state) { + anim = ANIM_SWORD_CHARGE; } else { - if (gPlayerState.attack_status != 0) { + if (gPlayerState.attack_status) { return; } if (gPlayerState.flags & PL_USE_LANTERN) { - if (gActiveItems[ACTIVE_ITEM_LANTERN].animPriority != 0) { + if (gActiveItems[ACTIVE_ITEM_LANTERN].animPriority) { return; } - anim = 0x604; + anim = ANIM_LANTERN_ON; } else { - anim = 0x100; + anim = ANIM_DEFAULT; } } } @@ -2068,7 +2276,7 @@ void ResolvePlayerAnimation(void) { } gPlayerState.animation = anim; - if (gPlayerState.heldObject == 0) { + if (!gPlayerState.heldObject) { maxAnimPriority = 0; for (index = 0; index < 4; index++) { if (gActiveItems[index].animPriority > maxAnimPriority) { @@ -2100,8 +2308,8 @@ bool32 sub_08079B24(void) { } if ((gPlayerState.jump_status & 0x41) == 0) { gPlayerState.jump_status = 0x41; - gPlayerEntity.direction = 0xff; - gPlayerState.direction = 0xff; + gPlayerEntity.direction = DIR_NONE; + gPlayerState.direction = DIR_NONE; return TRUE; } else { return TRUE; @@ -2371,11 +2579,11 @@ bool32 HasSwordEquipped(void) { } } -void sub_0807A180(Entity* param_1, u32 param_2, u32 param_3, u32 param_4) { +u32 sub_0807A180(Entity* param_1, Entity* param_2, u32 param_3, u32 param_4) { GenericEntity stackEntity; PositionRelative(param_1, &stackEntity.base, 0, -0x40000); stackEntity.base.animationState = param_1->animationState; - sub_08003FDE(&stackEntity.base, param_2, param_3, param_4); + return sub_08003FDE(&stackEntity.base, param_2, param_3, param_4); } void UpdateFloorType(void) { @@ -2423,7 +2631,86 @@ bool32 sub_0807A2B8(void) { } } -ASM_FUNC("asm/non_matching/playerUtils/sub_0807A2F8.inc", u32 sub_0807A2F8(u32 a1)) +u32 sub_0807A2F8(u32 param_1) { + u32 uVar1; + u32 uVar2; + u32 iVar4; + u32 uVar5; + u8 auStack36[4]; + Entity* player; + + if ((gRoomControls.area == 8) || (sub_08079778() | param_1) == 0) + return 0; + if ((gPlayerEntity.animationState & 2) != 0) { + + uVar2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, 0, -gPlayerEntity.hitbox->unk2[3]) << 1; + uVar1 = COORD_TO_TILE_OFFSET(&gPlayerEntity, 0, gPlayerEntity.hitbox->unk2[3]) << 1; + + } else { + uVar2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -gPlayerEntity.hitbox->unk2[0], 0) << 1; + uVar1 = COORD_TO_TILE_OFFSET(&gPlayerEntity, gPlayerEntity.hitbox->unk2[0], 0) << 1; + } + + for (uVar5 = 0; uVar5 < 2; uVar5++) { + iVar4 = 0; + uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + if (GetCollisionDataAtMetaTilePos(uVar2 >> 1, LAYER_BOTTOM)) { + if (!FindValueForKey((u16)GetVvvAtMetaTilePos((u16)(uVar2 >> 1), gPlayerEntity.collisionLayer), + gUnk_0811C1D8[gPlayerEntity.animationState >> 1])) { + break; + } + } else { + iVar4 = 1; + } + + uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + if (GetCollisionDataAtMetaTilePos(uVar1 >> 1, LAYER_BOTTOM)) { + if (!FindValueForKey((u16)GetVvvAtMetaTilePos((uVar1 >> 1), gPlayerEntity.collisionLayer), + gUnk_0811C1D8[gPlayerEntity.animationState >> 1])) { + break; + } + } else { + iVar4++; + } + + if (iVar4 == 2) { + if (uVar5 != 0) { + break; + } + return 0; + } + } + if (uVar5 != 0) { + if (AreaIsDungeon()) { + uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + if (!GetCollisionDataAtMetaTilePos(uVar2 >> 1, LAYER_TOP)) { + uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + if (GetCollisionDataAtMetaTilePos(uVar1 >> 1, LAYER_TOP)) { + return 0; + } + } else { + return 0; + } + } else { + if (uVar5 == 2) { + uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + } + if (GetCollisionDataAtMetaTilePos(uVar2 >> 1, LAYER_BOTTOM) == 0) { + if (uVar5 == 2) { + uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + } + if (GetCollisionDataAtMetaTilePos(uVar1 >> 1, LAYER_BOTTOM)) { + return 0; + } + } else { + return 0; + } + } + return uVar5 + 1; + } + + return 0; +} u32 GetPlayerTilePos(void) { switch (gPlayerEntity.animationState >> 1) { @@ -2690,7 +2977,7 @@ bool32 sub_0807AC54(Entity* this) { this->action = PLAYER_CLIMB; this->subAction = 0; this->y.HALF.LO = 0; - gPlayerState.animation = 0x2cf; + gPlayerState.animation = ANIM_CLIMB1_UP; return TRUE; case SURFACE_AUTO_LADDER: this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8; @@ -2781,7 +3068,7 @@ void PlayerUpdateSwimming(Entity* this) { ModHealth(-2); SoundReq(SFX_PLY_VO6); } - if ((this->direction & 0x80) != 0) { + if (this->direction & DIR_NOT_MOVING_CHECK) { if ((gRoomTransition.frameCount & 0xf) == 0) { CreateRandomWaterTrace(this, 4); } @@ -2856,21 +3143,21 @@ u32 GetSwordBeam(void) { } void sub_0807B068(Entity* entity) { - if ((gPlayerState.dash_state | gPlayerState.attack_status) == 0) { - if (gPlayerState.swim_state != 0) { - if ((gPlayerState.swim_state & 0x80) != 0) { - gPlayerState.animation = 0xc1c; + if (!(gPlayerState.dash_state | gPlayerState.attack_status)) { + if (gPlayerState.swim_state) { + if (gPlayerState.swim_state & 0x80) { + gPlayerState.animation = ANIM_DIVE_MINISH; } else { - gPlayerState.animation = 0xc0c; + gPlayerState.animation = ANIM_SWIM_MINISH; } } else { - if ((gPlayerState.direction & 0x80) != 0) { - if (gPlayerState.animation != 0xc18) { - gPlayerState.animation = 0xc18; + if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) { + if (gPlayerState.animation != ANIM_BOUNCE_MINISH) { + gPlayerState.animation = ANIM_BOUNCE_MINISH; } } else { - if (gPlayerState.animation != 0xc04) { - gPlayerState.animation = 0xc04; + if (gPlayerState.animation != ANIM_WALK_MINISH) { + gPlayerState.animation = ANIM_WALK_MINISH; } } } @@ -2934,7 +3221,7 @@ void sub_0807B1EC(PlayerEntity* this) { if (--super->timer == 0) { this->unk_6e++; super->zVelocity = Q_16_16(1.0); - gPlayerState.animation = 0x2c2; + gPlayerState.animation = ANIM_PORTAL; } } @@ -3519,7 +3806,54 @@ void sub_0807BFA8(void) { gRoomControls.height = (gArea.pCurrentRoomInfo)->pixel_height; } -ASM_FUNC("asm/non_matching/playerUtils/sub_0807BFD0.inc", void sub_0807BFD0()) +void sub_0807BFD0(void) { + s32 index; + u16* puVar2; + u16* puVar3; + u16* ptr; + typeof(gMapTop)* newptr; + + ClearBgAnimations(); + sub_0807BFA8(); + MemFill16(0xffff, gMapBottom.metatileTypes, 0x1000); + gMapBottom.metatileTypes[0] = 0; + MemFill16(0xffff, gMapTop.metatileTypes, 0x1000); + gMapTop.metatileTypes[0] = 0; + + if ((void*)gRoomControls.unk_34 != (gArea.pCurrentRoomInfo)->tileset) { + gRoomControls.unk_34 = (u32)(gArea.pCurrentRoomInfo)->tileset; + LoadMapData((gArea.pCurrentRoomInfo)->tileset); + } + + LoadMapData((gArea.pCurrentRoomInfo)->metatiles); + ptr = gPaletteBuffer; + MemCopy(&ptr[0x30], &ptr[0x150], 0x20); + gUsedPalettes |= 0x200000; + + if ((gArea.pCurrentRoomInfo)->bg_anim != NULL) { + LoadBgAnimations((gArea.pCurrentRoomInfo)->bg_anim); + } + + puVar2 = gMapBottom.metatileTypes; + puVar3 = gMapBottom.unkData2; + MemFill16(0xffff, puVar3, 0x1000); + + for (index = 0; index < 0x800; index++, puVar2++) { + if ((*puVar2 < 0x800) && (puVar3[*puVar2] == 0xffff)) { + puVar3[*puVar2] = index; + } + } + + puVar2 = gMapTop.metatileTypes; + puVar3 = gMapTop.unkData2; + MemFill16(0xffff, puVar3, 0x1000); + + for (index = 0; index < 0x800; index++, puVar2++) { + if ((*puVar2 < 0x800) && (puVar3[*puVar2] == 0xffff)) { + puVar3[*puVar2] = index; + } + } +} void LoadRoomGfx(void) { RoomControls* roomControls; @@ -3544,10 +3878,10 @@ void LoadRoomGfx(void) { MemClear(gMapBottom.mapData, sizeof(gMapBottom.mapData)); clearBottomMap = TRUE; } - if (gRoomTransition.field_0x2c[0] == 0) { + if (gRoomTransition.field2d == 0) { MemCopy(gMapBottom.mapData, gMapBottom.mapDataClone, sizeof(gMapBottom.mapData)); MemCopy(gMapTop.mapData, gMapTop.mapDataClone, sizeof(gMapBottom.mapData)); - } else if (gRoomTransition.field_0x2c[0] == 2) { + } else if (gRoomTransition.field2d == 2) { MemCopy(gMapBottom.mapData, gMapBottom.vvv, 0x1000); MemCopy(gMapBottom.mapDataClone, gMapBottom.mapData, 0x1000); MemCopy(gMapBottom.vvv, gMapBottom.mapDataClone, 0x1000); @@ -3886,18 +4220,56 @@ void sub_0807C810(void) { * This function is used to create a copy of the map data for temporary cutscene changes. */ void CloneMapData(void) { - gRoomTransition.field_0x2c[0] = 1; + gRoomTransition.field2d = 1; MemCopy(&gMapBottom.mapData, &gMapBottom.mapDataClone, 0x2000); MemCopy(&gMapTop.mapData, &gMapTop.mapDataClone, 0x2000); } void sub_0807C898(void) { - gRoomTransition.field_0x2c[0] = 2; + gRoomTransition.field2d = 2; LoadRoomGfx(); - gRoomTransition.field_0x2c[0] = 0; + gRoomTransition.field2d = 0; } -ASM_FUNC("asm/non_matching/playerUtils/sub_0807C8B0.inc", void sub_0807C8B0(u16* a, u32 b, u32 c)) +void sub_0807C8B0(u16* data, u32 width, u32 height) { + u16* dst_ptr; + u16* src_ptr; + u16* dst_ptr_cpy; + u16* src_ptr_cpy; + u32 innerIndex; + u32 index; + u16* prev_line; + u32 diff; + + src_ptr = data + width * height - 1; + dst_ptr = data + (height - 1) * 0x40 + (width - 1); + + for (index = 0; index < height; index++) { + src_ptr_cpy = src_ptr; //[index * -width]; + dst_ptr_cpy = dst_ptr; //[index * -0x40]; + for (innerIndex = 0; innerIndex < width; innerIndex++) { + dst_ptr_cpy[-innerIndex] = src_ptr_cpy[-innerIndex]; + } + dst_ptr -= 0x40; + src_ptr -= width; + } + + diff = 0x40 - width; + for (index = 0; index < 0x40; index++) { + dst_ptr = data + width - index * -0x40; + + for (innerIndex = 0; innerIndex < diff; innerIndex++) { + dst_ptr[innerIndex] = 0; + } + } + + diff = 0x40 - height; + dst_ptr = data + height * 0x40; + for (index = 0; index < diff; index++) { + MemClear(&dst_ptr[index * 0x40], 0x80); + // dst_ptr += 0x40; + } +} void LoadCompressedMapData(void* dest, u32 offset) { void* src; diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index 275a34fd..0320b883 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -1,11 +1,18 @@ -#include "entity.h" +/** + * @file arrowProjectile.c + * @ingroup Projectiles + * + * @brief Arrow Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" #include "object.h" -extern void (*const gArrowProjectile[])(Entity*); -extern void (*const gArrowProjectileActions[])(Entity*); +extern void (*const ArrowProjectile_Functions[])(Entity*); +extern void (*const ArrowProjectile_Actions[])(Entity*); typedef struct { u8 flipX; @@ -20,14 +27,14 @@ void sub_080A9488(Entity*); void sub_080A94C0(Entity*, u32); void ArrowProjectile(Entity* this) { - gArrowProjectile[GetNextFunction(this)](this); + ArrowProjectile_Functions[GetNextFunction(this)](this); } void ArrowProjectile_OnTick(Entity* this) { - gArrowProjectileActions[this->action](this); + ArrowProjectile_Actions[this->action](this); } -void sub_080A9334(Entity* this) { +void ArrowProjectile_OnCollision(Entity* this) { if ((this->contactFlags & 0x80) != 0) { if ((this->contactFlags & 0x3f) != 0) { ModHealth(-2); @@ -119,10 +126,10 @@ void sub_080A94C0(Entity* this, u32 animationState) { InitializeAnimation(this, this->animIndex); } -void (*const gArrowProjectile[])(Entity*) = { - ArrowProjectile_OnTick, sub_080A9334, DeleteEntity, DeleteEntity, DeleteEntity, +void (*const ArrowProjectile_Functions[])(Entity*) = { + ArrowProjectile_OnTick, ArrowProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; -void (*const gArrowProjectileActions[])(Entity*) = { +void (*const ArrowProjectile_Actions[])(Entity*) = { ArrowProjectile_Init, ArrowProjectile_Action1, ArrowProjectile_Action2, ArrowProjectile_Action3, ArrowProjectile_Action4, }; diff --git a/src/projectile/ballAndChain.c b/src/projectile/ballAndChain.c index a5534dfd..62140803 100644 --- a/src/projectile/ballAndChain.c +++ b/src/projectile/ballAndChain.c @@ -1,7 +1,24 @@ +/** + * @file ballAndChain.c + * @ingroup Projectiles + * + * @brief Ball and Chain Projectile + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" -#include "projectile.h" #include "hitbox.h" +#include "projectile.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[19]; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unused2; + /*0x7e*/ u8 unk_7e; + /*0x7f*/ s8 unk_7f; +} BallAndChainEntity; typedef struct { s8 x; @@ -10,41 +27,41 @@ typedef struct { bool32 sub_080AB12C(Entity* this); -extern void (*const gUnk_0812A494[])(Entity*); +extern void (*const gUnk_0812A494[])(BallAndChainEntity*); extern const PosOffset gUnk_0812A4A8[]; -void BallAndChain(Entity* this) { - gUnk_0812A494[this->type](this); +void BallAndChain(BallAndChainEntity* this) { + gUnk_0812A494[super->type](this); } -void sub_080AB074(Entity* this) { - Entity* parent; +void sub_080AB074(BallAndChainEntity* this) { + BallAndChainEntity* parent; const s16* tmp; u32 factor; - parent = this->parent; - if (parent->next == NULL) { + parent = (BallAndChainEntity*)super->parent; + if (parent->base.next == NULL) { DeleteThisEntity(); } - if (this->action == 0) { - if (sub_080AB12C(this) == FALSE) { + if (super->action == 0) { + if (sub_080AB12C(super) == FALSE) { return; } - this->action = 1; - this->frameIndex = 0; - this->spritePriority.b0 = 3; + super->action = 1; + super->frameIndex = 0; + super->spritePriority.b0 = 3; } - sub_0806FA90(this->parent, this, 0, -10 + -(s8)parent->field_0x7c.BYTES.byte3); + sub_0806FA90(super->parent, super, 0, -10 + -parent->unk_7f); - this->x.WORD += gSineTable[parent->field_0x7c.BYTES.byte0] * (parent->field_0x7c.BYTES.byte2 << 8); - this->y.WORD -= gSineTable[parent->field_0x7c.BYTES.byte0 + 0x40] * (parent->field_0x7c.BYTES.byte2 << 8); + super->x.WORD += gSineTable[parent->unk_7c] * (parent->unk_7e << 8); + super->y.WORD -= gSineTable[parent->unk_7c + 0x40] * (parent->unk_7e << 8); - this->z.HALF.HI += (s8)parent->field_0x7c.BYTES.byte3; - if (parent->field_0x7a.HALF.HI != 0) { - parent = CreateProjectile(BALL_AND_CHAIN); + super->z.HALF.HI += parent->unk_7f; + if (parent->unk_7b != 0) { + parent = (BallAndChainEntity*)CreateProjectile(BALL_AND_CHAIN); if (parent != NULL) { - parent->type = 4; - CopyPositionAndSpriteOffset(this, parent); + parent->base.type = 4; + CopyPositionAndSpriteOffset(super, &parent->base); } } } @@ -67,76 +84,76 @@ bool32 sub_080AB12C(Entity* this) { return TRUE; } -void sub_080AB170(Entity* this) { +void sub_080AB170(BallAndChainEntity* this) { s32 val; s32 type; - Entity* ent; - Entity* parent = this->parent; + BallAndChainEntity* ent; + Entity* parent = super->parent; if (parent->next == NULL) { DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - this->spritePriority.b1 = 0; - this->frameIndex = 5; - this->spritePriority.b0 = 3; - this->hitbox = (Hitbox*)&gHitbox_22; + if (super->action == 0) { + super->action = 1; + super->spritePriority.b1 = 0; + super->frameIndex = 5; + super->spritePriority.b0 = 3; + super->hitbox = (Hitbox*)&gHitbox_22; } - ent = parent->parent; - if (this->field_0x7c.BYTES.byte0 != ent->field_0x7c.BYTES.byte0) { - this->flags |= ENT_COLLIDE; + ent = (BallAndChainEntity*)parent->parent; + if (this->unk_7c != ent->unk_7c) { + super->flags |= ENT_COLLIDE; } else { - this->flags &= ~ENT_COLLIDE; + super->flags &= ~ENT_COLLIDE; } - this->field_0x7c.BYTES.byte0 = ent->field_0x7c.BYTES.byte0; + this->unk_7c = ent->unk_7c; - if ((ent->frame & 0x20) == 0) { - u8 index = ent->frame & 0x1f; + if ((ent->base.frame & 0x20) == 0) { + u8 index = ent->base.frame & 0x1f; PosOffset* pOffset = (PosOffset*)((s8*)gUnk_0812A4A8 + index); - sub_0806FA90(ent, this, pOffset->x, pOffset->y); + sub_0806FA90(&ent->base, super, pOffset->x, pOffset->y); } else { - sub_0806FA90(ent, this, 0, -10); + sub_0806FA90(&ent->base, super, 0, -10); } - val = (parent->x.HALF.HI - this->x.HALF.HI) * this->type; + val = (parent->x.HALF.HI - super->x.HALF.HI) * super->type; if (val < 0) { val += 3; } - this->x.HALF.HI += (val >> 2); + super->x.HALF.HI += (val >> 2); - val = (parent->y.HALF.HI - this->y.HALF.HI) * this->type; + val = (parent->y.HALF.HI - super->y.HALF.HI) * super->type; if (val < 0) { val += 3; } - this->y.HALF.HI += (val >> 2); + super->y.HALF.HI += (val >> 2); - val = (parent->z.HALF.HI - this->z.HALF.HI) * this->type; + val = (parent->z.HALF.HI - super->z.HALF.HI) * super->type; if (val < 0) { val += 3; } - this->z.HALF.HI += (val >> 2); + super->z.HALF.HI += (val >> 2); } -void sub_080AB26C(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->timer = 5; - this->frameIndex = 0; +void sub_080AB26C(BallAndChainEntity* this) { + if (super->action == 0) { + super->action = 1; + super->timer = 5; + super->frameIndex = 0; #ifndef EU - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; #endif } - if (--this->timer == 0) { + if (--super->timer == 0) { DeleteThisEntity(); } else { - this->frameIndex++; + super->frameIndex++; } } -void (*const gUnk_0812A494[])(Entity*) = { +void (*const gUnk_0812A494[])(BallAndChainEntity*) = { sub_080AB074, sub_080AB170, sub_080AB170, sub_080AB170, sub_080AB26C, }; const PosOffset gUnk_0812A4A8[] = { diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 6d033095..5593b602 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -1,6 +1,13 @@ -#include "entity.h" +/** + * @file boneProjectile.c + * @ingroup Projectiles + * + * @brief Bone Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const BoneProjectile_Functions[])(Entity*); @@ -16,7 +23,7 @@ void BoneProjectile_OnTick(Entity* this) { BoneProjectile_Actions[this->action](this); } -void sub_080A81C4(Entity* this) { +void BoneProjectile_OnCollision(Entity* this) { if (this->contactFlags == 0x80) { DeleteEntity(this); } else { @@ -81,12 +88,12 @@ void sub_080A82D8(Entity* this) { this->action = 4; COLLISION_OFF(this); this->zVelocity = Q_16_16(1.0); - this->direction ^= 0x10; + this->direction ^= DirectionSouth; this->speed = 0x80; } void (*const BoneProjectile_Functions[])(Entity*) = { - BoneProjectile_OnTick, sub_080A81C4, DeleteEntity, DeleteEntity, DeleteEntity, + BoneProjectile_OnTick, BoneProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const BoneProjectile_Actions[])(Entity*) = { BoneProjectile_Init, BoneProjectile_Action1, BoneProjectile_Action2, BoneProjectile_Action3, BoneProjectile_Action4, diff --git a/src/projectile/cannonballProjectile.c b/src/projectile/cannonballProjectile.c index baa68b53..b8929f6e 100644 --- a/src/projectile/cannonballProjectile.c +++ b/src/projectile/cannonballProjectile.c @@ -1,6 +1,13 @@ -#include "entity.h" +/** + * @file cannonballProjectile.c + * @ingroup Projectiles + * + * @brief Cannonball Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const CannonballProjectile_Functions[])(Entity*); @@ -17,7 +24,7 @@ void CannonballProjectile_OnTick(Entity* this) { CannonballProjectile_Actions[this->action](this); } -void sub_080AB544(Entity* this) { +void CannonballProjectile_OnCollision(Entity* this) { u32 tmp; if (this->iframes < -4) { @@ -90,7 +97,7 @@ bool32 sub_080AB634(Entity* this) { } void (*const CannonballProjectile_Functions[])(Entity*) = { - CannonballProjectile_OnTick, sub_080AB544, DeleteEntity, DeleteEntity, DeleteEntity, + CannonballProjectile_OnTick, CannonballProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const CannonballProjectile_Actions[])(Entity*) = { CannonballProjectile_Init, diff --git a/src/projectile/darkNutSwordSlash.c b/src/projectile/darkNutSwordSlash.c index 700f9629..5bf0dcf9 100644 --- a/src/projectile/darkNutSwordSlash.c +++ b/src/projectile/darkNutSwordSlash.c @@ -1,6 +1,13 @@ +/** + * @file darkNutSwordSlash.c + * @ingroup Projectiles + * + * @brief Dark Nut Sword Slash Projectile + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "physics.h" +#include "player.h" extern const u8 DarkNutSwordSlash_hitTypes[]; extern void (*const DarkNutSwordSlash_UpdatesForType[])(Entity*); diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c index 797de83c..59189ac3 100644 --- a/src/projectile/dekuSeedProjectile.c +++ b/src/projectile/dekuSeedProjectile.c @@ -1,7 +1,14 @@ -#include "entity.h" -#include "enemy.h" -#include "functions.h" +/** + * @file dekuSeedProjectile.c + * @ingroup Projectiles + * + * @brief Deku Seed Projectile + */ +#define NENT_DEPRECATED #include "collision.h" +#include "enemy.h" +#include "entity.h" +#include "functions.h" extern void (*const DekuSeedProjectile_Functions[])(Entity*); extern void (*const DekuSeedProjectile_Actions[])(Entity*); @@ -17,7 +24,7 @@ void DekuSeedProjectile_OnTick(Entity* this) { DekuSeedProjectile_Actions[this->action](this); } -void sub_080A8470(Entity* this) { +void DekuSeedProjectile_OnCollision(Entity* this) { if (this->contactFlags == 0x80) { if (this->hitType == 0x68) { EnqueueSFX(SFX_86); @@ -140,7 +147,7 @@ void sub_080A86A0(Entity* this) { } void (*const DekuSeedProjectile_Functions[])(Entity*) = { - DekuSeedProjectile_OnTick, sub_080A8470, DeleteEntity, DeleteEntity, DeleteEntity, + DekuSeedProjectile_OnTick, DekuSeedProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const DekuSeedProjectile_Actions[])(Entity*) = { DekuSeedProjectile_Init, DekuSeedProjectile_Action1, DekuSeedProjectile_Action2, diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index 5118394c..d1205188 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -1,9 +1,22 @@ -#include "sound.h" -#include "entity.h" +/** + * @file dirtBallProjectile.c + * @ingroup Projectiles + * + * @brief Dirt Ball Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" -#include "player.h" -#include "physics.h" +#include "entity.h" #include "functions.h" +#include "physics.h" +#include "player.h" +#include "sound.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[27]; + /*0x83*/ u8 unk_83; +} DirtBallProjectileEntity; extern void (*const DirtBallProjectile_Functions[])(Entity*); extern void (*const DirtBallProjectile_Actions[])(Entity*); @@ -25,7 +38,7 @@ void DirtBallProjectile_OnTick(Entity* this) { DirtBallProjectile_Actions[this->action](this); } -void sub_080A881C(Entity* this) { +void DirtBallProjectile_OnCollision(Entity* this) { this->knockbackSpeed = 0; if (this->type == 0) { this->parent->child = NULL; @@ -37,7 +50,7 @@ void sub_080A881C(Entity* this) { } else { if (this->action < 2) { this->action = 2; - this->parent->field_0x82.HALF.HI = 0xc0; + ((DirtBallProjectileEntity*)this->parent)->unk_83 = 0xc0; } } } @@ -88,7 +101,7 @@ void DirtBallProjectile_Action1(Entity* this) { entity->subtimer++; } if ((this->child->subtimer < 0x20) && ((this->child->subtimer & 3) == 3)) { - parent->field_0x82.HALF.HI = 0xc0; + ((DirtBallProjectileEntity*)parent)->unk_83 = 0xc0; this->action = 2; } } @@ -97,7 +110,7 @@ void DirtBallProjectile_Action1(Entity* this) { this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0); if (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe) != 0) { this->action = 2; - parent->field_0x82.HALF.HI = 0xc0; + ((DirtBallProjectileEntity*)parent)->unk_83 = 0xc0; } break; } @@ -165,7 +178,7 @@ void DirtBallProjectile_Action3(Entity* this) { } void (*const DirtBallProjectile_Functions[])(Entity*) = { - DirtBallProjectile_OnTick, sub_080A881C, DeleteEntity, DeleteEntity, DeleteEntity, + DirtBallProjectile_OnTick, DirtBallProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const DirtBallProjectile_Actions[])(Entity*) = { DirtBallProjectile_Init, diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c index 5aec66d8..833930f0 100644 --- a/src/projectile/fireProjectile.c +++ b/src/projectile/fireProjectile.c @@ -1,6 +1,12 @@ - -#include "entity.h" +/** + * @file fireProjectile.c + * @ingroup Projectiles + * + * @brief Fire Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const FireProjectile_Actions[])(Entity*); @@ -18,7 +24,7 @@ void FireProjectile_Init(Entity* this) { InitializeAnimation(this, this->direction >> 3); } else { this->action = 2; - InitializeAnimation(this, this->direction >> 3 | 4); + InitializeAnimation(this, this->direction >> 3 | IdleSouth); EnqueueSFX(SFX_15E); } } @@ -35,7 +41,7 @@ void FireProjectile_Action1(Entity* this) { if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); if (this->timer != 0) { - direction = parent->direction & 0x18; + direction = parent->direction & DirectionWest; this->direction = direction; this->timer = 0; InitializeAnimation(this, direction >> 3); diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index 5c217299..fc22b84a 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -1,50 +1,62 @@ - -#include "entity.h" +/** + * @file gleerokProjectile.c + * @ingroup Projectiles + * + * @brief Gleerok Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" -#include "player.h" +#include "entity.h" #include "functions.h" +#include "player.h" -extern void (*const GleerokProjectile_Functions[])(Entity*); -extern void (*const GleerokProjectile_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[12]; + /*0x74*/ u16 unk_74; +} GleerokProjectileEntity; + +extern void (*const GleerokProjectile_Functions[])(GleerokProjectileEntity*); +extern void (*const GleerokProjectile_Actions[])(GleerokProjectileEntity*); extern const s8 gUnk_08129978[]; extern const s8 gUnk_08129980[]; extern const s8 gUnk_08129988[]; -void sub_080A90D8(Entity*); +void sub_080A90D8(GleerokProjectileEntity*); -void GleerokProjectile(Entity* this) { - GleerokProjectile_Functions[GetNextFunction(this)](this); +void GleerokProjectile(GleerokProjectileEntity* this) { + GleerokProjectile_Functions[GetNextFunction(super)](this); } -void GleerokProjectile_OnTick(Entity* this) { - if (((this->type != 3) && ((this->contactFlags & 0x80) != 0)) && ((this->contactFlags & 0x7f) != 0x1e)) { - this->action = 3; - COLLISION_OFF(this); - InitializeAnimation(this, 0x53); +void GleerokProjectile_OnTick(GleerokProjectileEntity* this) { + if (((super->type != 3) && ((super->contactFlags & 0x80) != 0)) && ((super->contactFlags & 0x7f) != 0x1e)) { + super->action = 3; + COLLISION_OFF(super); + InitializeAnimation(super, 0x53); } - GleerokProjectile_Actions[this->action](this); + GleerokProjectile_Actions[super->action](this); } -void GleerokProjectile_Init(Entity* this) { +void GleerokProjectile_Init(GleerokProjectileEntity* this) { u32 uVar1; s32 iVar2; - this->action = 1; - this->zVelocity = Q_16_16(-1.0); - if (this->type != 3) { - CopyPosition(this->parent, this); - LinearMoveDirection(this, 0x1000, this->direction); - this->z.WORD = this->parent->y.WORD - this->child->y.WORD; - this->y.WORD -= this->z.WORD; - InitializeAnimation(this, 0x51); + super->action = 1; + super->zVelocity = Q_16_16(-1.0); + if (super->type != 3) { + CopyPosition(super->parent, super); + LinearMoveDirection(super, 0x1000, super->direction); + super->z.WORD = super->parent->y.WORD - super->child->y.WORD; + super->y.WORD -= super->z.WORD; + InitializeAnimation(super, 0x51); SoundReq(SFX_1B5); } - switch (this->type) { + switch (super->type) { case 0: case 1: - iVar2 = sub_080041DC(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); - if (this->type == 1) { + iVar2 = sub_080041DC(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + if (super->type == 1) { uVar1 = Random() & 0x1ff; if ((gRoomTransition.frameCount & 1U) == 0) { iVar2 += uVar1; @@ -57,100 +69,104 @@ void GleerokProjectile_Init(Entity* this) { } else if (0x400 < iVar2) { iVar2 = 0x400; } - this->zVelocity = this->z.WORD / (iVar2 << 8) << 0xd; - this->subtimer = 30; + super->zVelocity = super->z.WORD / (iVar2 << 8) << 0xd; + super->subtimer = 30; break; case 2: - this->zVelocity = (this->z.WORD / 0x18000) << 0xc; + super->zVelocity = (super->z.WORD / 0x18000) << 0xc; break; case 3: - this->z.WORD = Q_16_16(-160.0); + super->z.WORD = Q_16_16(-160.0); uVar1 = (Random() & 3) * 2; - this->x.HALF.HI = gUnk_08129978[uVar1] + this->x.HALF.HI; - this->y.HALF.HI = gUnk_08129978[uVar1 + 1] + this->y.HALF.HI; + super->x.HALF.HI = gUnk_08129978[uVar1] + super->x.HALF.HI; + super->y.HALF.HI = gUnk_08129978[uVar1 + 1] + super->y.HALF.HI; if ((uVar1 & 2) != 0) { - this->x.HALF.HI += gUnk_08129988[Random() & 0xf]; - this->y.HALF.HI += gUnk_08129980[Random() & 7]; + super->x.HALF.HI += gUnk_08129988[Random() & 0xf]; + super->y.HALF.HI += gUnk_08129980[Random() & 7]; } else { - this->x.HALF.HI += gUnk_08129980[Random() & 7]; - this->y.HALF.HI += gUnk_08129988[Random() & 0xf]; + super->x.HALF.HI += gUnk_08129980[Random() & 7]; + super->y.HALF.HI += gUnk_08129988[Random() & 0xf]; } - sub_08004168(this); - InitializeAnimation(this, 0); + sub_08004168(super); + InitializeAnimation(super, 0); break; } } -void GleerokProjectile_Action1(Entity* this) { - if (this->type == 3) { - if (GravityUpdate(this, Q_8_8(24.0)) == 0) { - sub_08008790(this, 7); - CreateFx(this, FX_ROCK, 0); +void GleerokProjectile_Action1(GleerokProjectileEntity* this) { + if (super->type == 3) { + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { + sub_08008790(super, 7); + CreateFx(super, FX_ROCK, 0); DeleteThisEntity(); } } else { - GetNextFrame(this); - LinearMoveUpdate(this); - if ((this->type != 2) && (this->subtimer-- == 0)) { - this->subtimer = 30; - sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); + GetNextFrame(super); + LinearMoveUpdate(super); + if ((super->type != 2) && (super->subtimer-- == 0)) { + super->subtimer = 30; + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); } - if (GravityUpdate(this, 0) == 0) { - this->action = 2; + if (GravityUpdate(super, 0) == 0) { + super->action = 2; sub_080A90D8(this); - if (this->type == 2) { - this->timer = 15; - InitializeAnimation(this, 0x54); + if (super->type == 2) { + super->timer = 15; + InitializeAnimation(super, 0x54); } else { - InitializeAnimation(this, 0x52); + InitializeAnimation(super, 0x52); } } } } -void GleerokProjectile_Action2(Entity* this) { - GetNextFrame(this); - if (this->type == 2) { - if (this->timer-- == 0) { - COLLISION_OFF(this); - this->action = 3; - InitializeAnimation(this, 0x55); +void GleerokProjectile_Action2(GleerokProjectileEntity* this) { + GetNextFrame(super); + if (super->type == 2) { + if (super->timer-- == 0) { + COLLISION_OFF(super); + super->action = 3; + InitializeAnimation(super, 0x55); } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); sub_080A90D8(this); } } else { - if ((this->frame & ANIM_DONE) != 0) { - this->action = 3; - COLLISION_OFF(this); - InitializeAnimation(this, 0x53); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 3; + COLLISION_OFF(super); + InitializeAnimation(super, 0x53); } } } -void GleerokProjectile_Action3(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { +void GleerokProjectile_Action3(GleerokProjectileEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } -void sub_080A90D8(Entity* this) { +void sub_080A90D8(GleerokProjectileEntity* this) { u32 tmp; - if (this->field_0x74.HWORD != TILE(this->x.HALF.HI, this->y.HALF.HI)) { - this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - tmp = GetMetaTileTypeByEntity(this); + if (this->unk_74 != TILE(super->x.HALF.HI, super->y.HALF.HI)) { + this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI); + tmp = GetMetaTileTypeByEntity(super); if ((tmp == 0x13) || (tmp == 0x34)) { - sub_0807B7D8(0x34c, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + sub_0807B7D8(0x34c, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); } } } -void (*const GleerokProjectile_Functions[])(Entity*) = { - GleerokProjectile_OnTick, GleerokProjectile_OnTick, DeleteEntity, DeleteEntity, DeleteEntity, +void (*const GleerokProjectile_Functions[])(GleerokProjectileEntity*) = { + GleerokProjectile_OnTick, + GleerokProjectile_OnTick, + (void (*)(GleerokProjectileEntity*))DeleteEntity, + (void (*)(GleerokProjectileEntity*))DeleteEntity, + (void (*)(GleerokProjectileEntity*))DeleteEntity, }; -void (*const GleerokProjectile_Actions[])(Entity*) = { +void (*const GleerokProjectile_Actions[])(GleerokProjectileEntity*) = { GleerokProjectile_Init, GleerokProjectile_Action1, GleerokProjectile_Action2, diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c index f6ffeaf0..fcbe71bf 100644 --- a/src/projectile/guardLineOfSight.c +++ b/src/projectile/guardLineOfSight.c @@ -1,10 +1,17 @@ -#include "entity.h" +/** + * @file guardLineOfSightProjectile.c + * @ingroup Projectiles + * + * @brief Guard Line of Sight Projectile + */ +#define NENT_DEPRECATED #include "asm.h" -#include "physics.h" -#include "functions.h" -#include "projectile.h" -#include "hitbox.h" #include "collision.h" +#include "entity.h" +#include "functions.h" +#include "hitbox.h" +#include "physics.h" +#include "projectile.h" extern u32 sub_080644C8(Entity*); diff --git a/src/projectile/guruguruBarProjectile.c b/src/projectile/guruguruBarProjectile.c index b0c9eeb1..6554e43e 100644 --- a/src/projectile/guruguruBarProjectile.c +++ b/src/projectile/guruguruBarProjectile.c @@ -1,4 +1,10 @@ - +/** + * @file guruguruBarProjectile.c + * @ingroup Projectiles + * + * @brief Guruguru Bar Projectile + */ +#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c index c71a8e39..45bbff69 100644 --- a/src/projectile/gyorgMaleEnergyProjectile.c +++ b/src/projectile/gyorgMaleEnergyProjectile.c @@ -1,8 +1,15 @@ -#include "entity.h" +/** + * @file gyorgMaleEnergyProjectile.c + * @ingroup Projectiles + * + * @brief Gyorg Male Energy Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" +#include "functions.h" #include "physics.h" #include "player.h" -#include "functions.h" extern void (*const GyorgMaleEnergyProjectile_Functions[])(Entity*); extern void (*const GyorgMaleEnergyProjectile_Actions[])(Entity*); @@ -17,7 +24,7 @@ void GyorgMaleEnergyProjectile_OnTick(Entity* this) { GyorgMaleEnergyProjectile_Actions[this->action](this); } -void sub_080AC8DC(Entity* this) { +void GyorgMaleEnergyProjectile_OnCollision(Entity* this) { switch ((s8)(this->contactFlags & 0x7f)) { case 0: case 1: @@ -92,7 +99,7 @@ void GyorgMaleEnergyProjectile_Action3(Entity* this) { } void (*const GyorgMaleEnergyProjectile_Functions[])(Entity*) = { - GyorgMaleEnergyProjectile_OnTick, sub_080AC8DC, DeleteEntity, DeleteEntity, DeleteEntity, + GyorgMaleEnergyProjectile_OnTick, GyorgMaleEnergyProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const GyorgMaleEnergyProjectile_Actions[])(Entity*) = { GyorgMaleEnergyProjectile_Init, diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c index 1f191f7a..0ed9e396 100644 --- a/src/projectile/gyorgTail.c +++ b/src/projectile/gyorgTail.c @@ -1,241 +1,255 @@ -#include "entity.h" +/** + * @file gyorgTail.c + * @ingroup Projectiles + * + * @brief Gyorg Tail Projectile + */ +#define NENT_DEPRECATED #include "asm.h" -#include "physics.h" -#include "sound.h" +#include "entity.h" #include "functions.h" -#include "projectile.h" #include "hitbox.h" +#include "physics.h" +#include "projectile.h" +#include "sound.h" -bool32 sub_080AC5E4(Entity*); -void sub_080AC388(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[10]; + /*0x72*/ u16 unk_72; + /*0x74*/ u8 unused2[5]; + /*0x79*/ u8 unk_79; + /*0x7a*/ s16 unk_7a; + /*0x7c*/ u16 unk_7c; +} GyorgTailEntity; + +bool32 sub_080AC5E4(GyorgTailEntity*); +void GyorgTail_Action1(GyorgTailEntity*); void sub_080AC6F0(Entity*); void sub_080AC760(Entity*); -void sub_080AC7C4(Entity*); -void sub_080AC328(Entity*); -void sub_080AC510(Entity*); -void sub_080AC560(Entity*); -void sub_080AC884(Entity*); -void sub_080AC480(Entity*); -void GyorgTail_Init(Entity*); +void sub_080AC7C4(GyorgTailEntity*); +void sub_080AC328(GyorgTailEntity*); +void sub_080AC510(GyorgTailEntity*); +void sub_080AC560(GyorgTailEntity*); +void sub_080AC884(GyorgTailEntity*); +void GyorgTail_Action2(GyorgTailEntity*); +void GyorgTail_Init(GyorgTailEntity*); -void GyorgTail(Entity* this) { - static void (*const gUnk_0812A994[])(Entity*) = { +void GyorgTail(GyorgTailEntity* this) { + static void (*const gUnk_0812A994[])(GyorgTailEntity*) = { sub_080AC328, sub_080AC510, sub_080AC510, sub_080AC510, sub_080AC560, }; - Entity* parent; + GyorgTailEntity* parent; - if (this->parent->next == NULL) { + if (super->parent->next == NULL) { DeleteThisEntity(); } - gUnk_0812A994[this->type2](this); - if (this->type == 0) { - this->spriteOrientation.flipY = 3; - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = 1; + gUnk_0812A994[super->type2](this); + if (super->type == 0) { + super->spriteOrientation.flipY = 3; + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = 1; } else { - parent = this->parent; - this->spriteOrientation.flipY = parent->spriteOrientation.flipY; - this->spriteRendering.b3 = parent->spriteRendering.b3; - this->spritePriority.b0 = parent->spritePriority.b0 - 2; + parent = (GyorgTailEntity*)super->parent; + super->spriteOrientation.flipY = parent->base.spriteOrientation.flipY; + super->spriteRendering.b3 = parent->base.spriteRendering.b3; + super->spritePriority.b0 = parent->base.spritePriority.b0 - 2; - if ((parent->spriteRendering.b3 == 3) && (parent->field_0x7c.BYTES.byte0 == 0)) { - COLLISION_OFF(this); + if ((parent->base.spriteRendering.b3 == 3) && (*(u8*)&parent->unk_7c == 0)) { + COLLISION_OFF(super); } else { - COLLISION_ON(this); + COLLISION_ON(super); } } } -void sub_080AC328(Entity* this) { - static void (*const GyorgTail_Actions[])(Entity*) = { +void sub_080AC328(GyorgTailEntity* this) { + static void (*const GyorgTail_Actions[])(GyorgTailEntity*) = { GyorgTail_Init, - sub_080AC388, - sub_080AC480, + GyorgTail_Action1, + GyorgTail_Action2, }; - GyorgTail_Actions[this->action](this); + GyorgTail_Actions[super->action](this); } -void GyorgTail_Init(Entity* this) { +void GyorgTail_Init(GyorgTailEntity* this) { static const s16 gUnk_0812A9B4[] = { -64, 64 }; if (sub_080AC5E4(this) != 0) { - this->action = 1; - this->frameIndex = 0xc; - this->spriteSettings.draw = 1; - this->field_0x7a.HWORD = gUnk_0812A9B4[Random() & 1]; - this->collisionLayer = 2; - sub_080AC388(this); + super->action = 1; + super->frameIndex = 0xc; + super->spriteSettings.draw = 1; + this->unk_7a = gUnk_0812A9B4[Random() & 1]; + super->collisionLayer = 2; + GyorgTail_Action1(this); } } -void sub_080AC388(Entity* this) { +void GyorgTail_Action1(GyorgTailEntity* this) { static const u8 gUnk_0812A9B8[] = { 24, 20 }; Entity* pEVar2; int iVar3; u32 uVar5; - uVar5 = gUnk_0812A9B8[this->type]; - pEVar2 = this->parent; - iVar3 = (pEVar2->animationState ^ 0x80) - (this->field_0x7c.HALF_U.LO >> 8); - if ((short)this->field_0x7a.HWORD < 0) { + uVar5 = gUnk_0812A9B8[super->type]; + pEVar2 = super->parent; + iVar3 = (pEVar2->animationState ^ 0x80) - (this->unk_7c >> 8); + if ((short)this->unk_7a < 0) { if (((iVar3 - uVar5) & 0xff) <= 0x7f) { - s32 tmp = -(short)this->field_0x7a.HWORD; - this->field_0x7a.HWORD = tmp; - this->field_0x7c.HALF_U.LO = (short)((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8); + s32 tmp = -(short)this->unk_7a; + this->unk_7a = tmp; + this->unk_7c = (short)((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8); sub_080AC884(this); } else { - this->field_0x7c.HALF_U.LO = this->field_0x7c.HALF_U.LO + this->field_0x7a.HWORD; + this->unk_7c = this->unk_7c + this->unk_7a; if (((iVar3 + uVar5) & 0xff) >= 0x81) { - this->field_0x7c.HALF_U.LO = ((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8) | 0x80; + this->unk_7c = ((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8) | 0x80; } } } else { if (((iVar3 + uVar5) & 0xff) >= 0x81) { - s32 tmp = -(short)this->field_0x7a.HWORD; - this->field_0x7a.HWORD = tmp; - this->field_0x7c.HALF_U.LO = (short)((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8); + s32 tmp = -(short)this->unk_7a; + this->unk_7a = tmp; + this->unk_7c = (short)((((pEVar2->animationState ^ 0x80) + uVar5) & 0xff) << 8); sub_080AC884(this); } else { - this->field_0x7c.HALF_U.LO = this->field_0x7c.HALF_U.LO + this->field_0x7a.HWORD; + this->unk_7c = this->unk_7c + this->unk_7a; if (0x7e >= ((iVar3 - uVar5) & 0xff) - 1) { - this->field_0x7c.HALF_U.LO = ((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8) | 0x80; + this->unk_7c = ((((pEVar2->animationState ^ 0x80) - uVar5) & 0xff) << 8) | 0x80; } } } - this->direction = this->field_0x7c.HALF_U.LO >> 8; - sub_080AC6F0(this); - sub_080AC760(this); + super->direction = this->unk_7c >> 8; + sub_080AC6F0(super); + sub_080AC760(super); sub_080AC7C4(this); } -void sub_080AC480(Entity* this) { - if (this->timer != 0) { - if (this->parent->health == 0) { - this->action = 1; - this->hitType = 0x1d; +void GyorgTail_Action2(GyorgTailEntity* this) { + if (super->timer != 0) { + if (super->parent->health == 0) { + super->action = 1; + super->hitType = 0x1d; } else { - if (--this->timer == 0) { - this->hitType = 0x1c; + if (--super->timer == 0) { + super->hitType = 0x1c; SoundReq(SFX_116); } } } else { - if (--this->subtimer == 0) { - this->action = 1; - this->hitType = 0x1d; + if (--super->subtimer == 0) { + super->action = 1; + super->hitType = 0x1d; } - this->field_0x7c.HALF_U.LO += ((s16)this->field_0x7a.HWORD >= 1) ? 0x300 : -0x300; - this->direction = this->field_0x7c.HALF.LO >> 8; - sub_080AC6F0(this); - sub_080AC760(this); + this->unk_7c += ((s16)this->unk_7a >= 1) ? 0x300 : -0x300; + super->direction = this->unk_7c >> 8; + sub_080AC6F0(super); + sub_080AC760(super); sub_080AC7C4(this); } } -void sub_080AC510(Entity* this) { +void sub_080AC510(GyorgTailEntity* this) { static const u8 gUnk_0812A9BA[] = { 24, 25, 25, 24, 24, 24 }; - if (this->action == 0) { - this->action = 1; - this->frameIndex = gUnk_0812A9BA[this->type * 3 + this->type2 - 1]; - this->spriteSettings.draw = 1; - this->collisionLayer = 2; - if (*(u16*)&this->type == 0x300) { - this->hitbox = (Hitbox*)&gHitbox_21; + if (super->action == 0) { + super->action = 1; + super->frameIndex = gUnk_0812A9BA[super->type * 3 + super->type2 - 1]; + super->spriteSettings.draw = 1; + super->collisionLayer = 2; + if (*(u16*)&super->type == 0x300) { + super->hitbox = (Hitbox*)&gHitbox_21; } } } -void sub_080AC560(Entity* this) { +void sub_080AC560(GyorgTailEntity* this) { s32 factor; Entity* entity; - entity = this->child; + entity = super->child; if (entity->next == NULL) { DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - this->collisionLayer = 2; - if (this->type == 0) { - this->hitbox = (Hitbox*)&gHitbox_1; + if (super->action == 0) { + super->action = 1; + super->collisionLayer = 2; + if (super->type == 0) { + super->hitbox = (Hitbox*)&gHitbox_1; } else { - this->hitbox = (Hitbox*)&gHitbox_20; + super->hitbox = (Hitbox*)&gHitbox_20; } - this->frameIndex = 0xff; - this->spriteSettings.draw = 1; + super->frameIndex = 0xff; + super->spriteSettings.draw = 1; } - factor = this->field_0x78.HALF.HI << 8; - this->x.WORD = entity->x.WORD + gSineTable[entity->direction] * factor; - this->y.WORD = entity->y.WORD - gSineTable[entity->direction + 0x40] * factor; + factor = this->unk_79 << 8; + super->x.WORD = entity->x.WORD + gSineTable[entity->direction] * factor; + super->y.WORD = entity->y.WORD - gSineTable[entity->direction + 0x40] * factor; } -bool32 sub_080AC5E4(Entity* this) { - // TODO regalloc - Entity* entity; - Entity* new_var2; - Entity* entity2; - Entity* entity3; - Entity* entity4; +bool32 sub_080AC5E4(GyorgTailEntity* this) { + GyorgTailEntity* entity; + GyorgTailEntity* entity2; + GyorgTailEntity* entity3; - if (this->type == 0) { + if (super->type == 0) { if (gEntCount > 0x43) { return FALSE; } - this->field_0x78.HALF.HI = 0x11; - entity = CreateProjectile(GYORG_TAIL); - entity->type = this->type; - entity->type2 = 1; - entity->parent = this->parent; - entity->field_0x78.HALF.HI = 0x12; - this->child = entity; + this->unk_79 = 0x11; + entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity->base.type = super->type; + entity->base.type2 = 1; + entity->base.parent = super->parent; + entity->unk_79 = 0x12; + super->child = &entity->base; - entity2 = CreateProjectile(GYORG_TAIL); - entity2->type = this->type; - entity2->type2 = 2; - entity2->parent = this->parent; - entity2->field_0x78.HALF.HI = 0x14; - entity->child = entity2; + entity2 = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity2->base.type = super->type; + entity2->base.type2 = 2; + entity2->base.parent = super->parent; + entity2->unk_79 = 0x14; + entity->base.child = &entity2->base; - entity3 = CreateProjectile(GYORG_TAIL); - entity3->type = this->type; - entity3->type2 = 3; - entity3->parent = this->parent; - entity3->child = NULL; - entity3->field_0x78.HALF.HI = 0; - entity2->child = entity3; + entity3 = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity3->base.type = super->type; + entity3->base.type2 = 3; + entity3->base.parent = super->parent; + entity3->base.child = NULL; + entity3->unk_79 = 0; + entity2->base.child = &entity3->base; - entity = CreateProjectile(GYORG_TAIL); - entity->type = this->type; - entity->type2 = 4; - entity->parent = this->parent; - entity->child = this; - entity->field_0x78.HALF.HI = 0x14; + entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity->base.type = super->type; + entity->base.type2 = 4; + entity->base.parent = super->parent; + entity->base.child = super; + entity->unk_79 = 0x14; } else { if (gEntCount > 0x44) { return FALSE; } - this->field_0x78.HALF.HI = 0xf; - entity = CreateProjectile(GYORG_TAIL); - entity->type = this->type; - entity->type2 = 1; - entity->parent = this->parent; - entity->field_0x78.HALF.HI = 0x10; - this->child = entity; + this->unk_79 = 0xf; + entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity->base.type = super->type; + entity->base.type2 = 1; + entity->base.parent = super->parent; + entity->unk_79 = 0x10; + super->child = &entity->base; - entity2 = CreateProjectile(GYORG_TAIL); - entity2->type = this->type; - entity2->type2 = 2; - entity2->parent = this->parent; - entity2->child = NULL; - entity2->field_0x78.HALF.HI = 0x20; - entity->child = entity2; + entity2 = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity2->base.type = super->type; + entity2->base.type2 = 2; + entity2->base.parent = super->parent; + entity2->base.child = NULL; + entity2->unk_79 = 0x20; + entity->base.child = &entity2->base; - entity = CreateProjectile(GYORG_TAIL); - entity->type = this->type; - entity->type2 = 4; - entity->parent = this->parent; - entity->child = this; - entity->field_0x78.HALF.HI = 0x10; + entity = (GyorgTailEntity*)CreateProjectile(GYORG_TAIL); + entity->base.type = super->type; + entity->base.type2 = 4; + entity->base.parent = super->parent; + entity->base.child = super; + entity->unk_79 = 0x10; } return TRUE; } @@ -250,7 +264,7 @@ void sub_080AC6F0(Entity* this) { u32 uVar4; u32 tmp; - uVar4 = this->direction & 0x1f; + uVar4 = this->direction & (0x3 | DirectionNorthWest); uVar1 = this->direction >> 5; iVar3 = uVar1 * 3; tmp = gUnk_0812A9C0[this->animationState] - uVar1 * 3; @@ -322,10 +336,10 @@ void sub_080AC760(Entity* param_1) { } } -void sub_080AC7C4(Entity* this) { - Entity* entity1; - Entity* entity2; - Entity* entity3; +void sub_080AC7C4(GyorgTailEntity* this) { + GyorgTailEntity* entity1; + GyorgTailEntity* entity2; + GyorgTailEntity* entity3; s32 tmp; s32 tmp2; s32 tmp3; @@ -334,36 +348,36 @@ void sub_080AC7C4(Entity* this) { s32 tmp6; s32 r6; - entity1 = this->child; - entity2 = entity1->child; - entity3 = entity2->child; + entity1 = (GyorgTailEntity*)super->child; + entity2 = (GyorgTailEntity*)entity1->base.child; + entity3 = (GyorgTailEntity*)entity2->base.child; if (entity3 != NULL) { - CopyPosition(this->parent, entity3); + CopyPosition(super->parent, &entity3->base); } else { - entity3 = this->parent; + entity3 = (GyorgTailEntity*)super->parent; } - tmp = entity2->field_0x78.HALF.HI << 8; - tmp2 = gSineTable[entity2->direction]; + tmp = entity2->unk_79 << 8; + tmp2 = gSineTable[entity2->base.direction]; r6 = tmp2 * tmp; - tmp2 = gSineTable[entity2->direction + 0x40] * tmp; - PositionRelative(entity3, entity2, r6, -tmp2); - tmp3 = entity1->field_0x78.HALF.HI << 8; - tmp4 = gSineTable[entity1->direction]; + tmp2 = gSineTable[entity2->base.direction + 0x40] * tmp; + PositionRelative(&entity3->base, &entity2->base, r6, -tmp2); + tmp3 = entity1->unk_79 << 8; + tmp4 = gSineTable[entity1->base.direction]; r6 = tmp4 * tmp3; - tmp4 = gSineTable[entity1->direction + 0x40] * tmp3; - PositionRelative(entity2, entity1, r6, -tmp4); - tmp5 = this->field_0x78.HALF.HI << 8; - tmp6 = gSineTable[this->direction]; + tmp4 = gSineTable[entity1->base.direction + 0x40] * tmp3; + PositionRelative(&entity2->base, &entity1->base, r6, -tmp4); + tmp5 = this->unk_79 << 8; + tmp6 = gSineTable[super->direction]; r6 = tmp6 * tmp5; - tmp6 = gSineTable[this->direction + 0x40] * tmp5; - PositionRelative(entity1, this, r6, -tmp6); + tmp6 = gSineTable[super->direction + 0x40] * tmp5; + PositionRelative(&entity1->base, super, r6, -tmp6); } -void sub_080AC884(Entity* this) { - if (this->parent->field_0x70.HALF_U.HI != 0) { - this->parent->field_0x70.HALF_U.HI = 0; - this->action = 2; - this->timer = 60; - this->subtimer = 86; +void sub_080AC884(GyorgTailEntity* this) { + if (((GyorgTailEntity*)super->parent)->unk_72 != 0) { + ((GyorgTailEntity*)super->parent)->unk_72 = 0; + super->action = 2; + super->timer = 60; + super->subtimer = 86; } } diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c index c3e0e6ca..1ad42525 100644 --- a/src/projectile/iceProjectile.c +++ b/src/projectile/iceProjectile.c @@ -1,6 +1,12 @@ - -#include "entity.h" +/** + * @file iceProjectile.c + * @ingroup Projectiles + * + * @brief Ice Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const IceProjectile_Actions[])(Entity*); @@ -18,7 +24,7 @@ void IceProjectile_Init(Entity* this) { InitializeAnimation(this, this->direction >> 3); } else { this->action = 2; - InitializeAnimation(this, this->direction >> 3 | 4); + InitializeAnimation(this, this->direction >> 3 | IdleSouth); EnqueueSFX(SFX_160); } } @@ -37,7 +43,7 @@ void IceProjectile_Action1(Entity* this) { if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); if (this->timer != 0) { - direction = parent->direction & 0x18; + direction = parent->direction & DirectionWest; this->direction = direction; this->timer = 0; InitializeAnimation(this, direction >> 3); diff --git a/src/projectile/keatonDagger.c b/src/projectile/keatonDagger.c index 53a61687..baf5044b 100644 --- a/src/projectile/keatonDagger.c +++ b/src/projectile/keatonDagger.c @@ -1,3 +1,10 @@ +/** + * @file keatonDagger.c + * @ingroup Projectiles + * + * @brief Keaton Dagger Projectile + */ +#define NENT_DEPRECATED #include "entity.h" #include "player.h" #include "physics.h" diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index a766f97b..26331589 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -1,5 +1,12 @@ -#include "entity.h" +/** + * @file lakituCloudProjectile.c + * @ingroup Projectiles + * + * @brief Lakitu Cloud Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void SoundReqClipped(Entity*, u32); @@ -20,10 +27,10 @@ void LakituCloudProjectile_OnTick(Entity* this) { LakituCloudProjectile_Actions[this->action](this); } -void nullsub_539(Entity* this) { +void LakituCloudProjectile_OnCollision(Entity* this) { } -void sub_080A9CF0(Entity* this) { +void LakituCloudProjectile_OnGrabbed(Entity* this) { if (!sub_0806F520(this)) { CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); @@ -63,7 +70,8 @@ void LakituCloudProjectile_Action1(Entity* this) { } void (*const LakituCloudProjectile_Functions[])(Entity*) = { - LakituCloudProjectile_OnTick, nullsub_539, DeleteEntity, DeleteEntity, DeleteEntity, sub_080A9CF0, + LakituCloudProjectile_OnTick, LakituCloudProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, + LakituCloudProjectile_OnGrabbed, }; void (*const LakituCloudProjectile_Actions[])(Entity*) = { LakituCloudProjectile_Init, diff --git a/src/projectile/lakituLightning.c b/src/projectile/lakituLightning.c index e89834a9..92edbc5e 100644 --- a/src/projectile/lakituLightning.c +++ b/src/projectile/lakituLightning.c @@ -1,6 +1,13 @@ -#include "entity.h" +/** + * @file lakituLightning.c + * @ingroup Projectiles + * + * @brief Lakitu Lightning Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const LakituLightning_Functions[])(Entity*); @@ -16,7 +23,7 @@ void LakituLightning_OnTick(Entity* this) { LakituLightning_Actions[this->action](this); } -void sub_080A9DD8(Entity* this) { +void LakituLightning_OnCollision(Entity* this) { if ((this->health == 0) || (this->contactFlags == 0x80)) { DeleteThisEntity(); } @@ -43,7 +50,7 @@ void LakituLightning_Action1(Entity* this) { } void (*const LakituLightning_Functions[])(Entity*) = { - LakituLightning_OnTick, sub_080A9DD8, DeleteEntity, DeleteEntity, DeleteEntity, + LakituLightning_OnTick, LakituLightning_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const LakituLightning_Actions[])(Entity*) = { LakituLightning_Init, diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 6ccc88f9..dd9c966e 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -1,119 +1,135 @@ -#include "entity.h" +/** + * @file mandiblesProjectile.c + * @ingroup Projectiles + * + * @brief Mandibles Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" -#include "physics.h" +#include "entity.h" #include "functions.h" #include "game.h" #include "hitbox.h" +#include "physics.h" #include "tiles.h" -extern void (*const MandiblesProjectile_Functions[])(Entity*); -extern void (*const MandiblesProjectile_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unused2[6]; + /*0x80*/ u16 unk_80; + /*0x82*/ u8 unk_82; +} MandiblesProjectileEntity; + +extern void (*const MandiblesProjectile_Functions[])(MandiblesProjectileEntity*); +extern void (*const MandiblesProjectile_Actions[])(MandiblesProjectileEntity*); extern const u8 gUnk_08129CA4[]; extern const Hitbox* const gUnk_08129CF4[]; extern const u8 gUnk_08129CAC[]; extern const s8 gUnk_08129D14[]; void sub_080AA1D8(Entity*); -void sub_080AA270(Entity*); +void sub_080AA270(MandiblesProjectileEntity*); bool32 sub_080AA2E0(Entity*); -void sub_080AA320(Entity*); -void sub_080AA3E0(Entity*, u32); +void sub_080AA320(MandiblesProjectileEntity*); +void sub_080AA3E0(MandiblesProjectileEntity*, u32); bool32 sub_080AA374(Entity*); -void MandiblesProjectile(Entity* this) { - Entity* entity = this->child; +void MandiblesProjectile(MandiblesProjectileEntity* this) { + Entity* entity = super->child; if (entity == NULL) { - entity = this->parent; + entity = super->parent; } - if ((entity->confusedTime == 0) && ((this->flags & ENT_COLLIDE) == 0)) { - COLLISION_ON(this); + if ((entity->confusedTime == 0) && ((super->flags & ENT_COLLIDE) == 0)) { + COLLISION_ON(super); } - MandiblesProjectile_Functions[GetNextFunction(this)](this); + MandiblesProjectile_Functions[GetNextFunction(super)](this); } -void MandiblesProjectile_OnTick(Entity* this) { - if (this->action < 3) { - sub_080AA1D8(this); +void MandiblesProjectile_OnTick(MandiblesProjectileEntity* this) { + if (super->action < 3) { + sub_080AA1D8(super); } - MandiblesProjectile_Actions[this->action](this); + MandiblesProjectile_Actions[super->action](this); } -void sub_080A9EBC(Entity* this) { +void MandiblesProjectile_OnCollision(MandiblesProjectileEntity* this) { Entity* parent; - if ((this->contactFlags & 0x80) != 0) { - switch (this->action) { + if ((super->contactFlags & 0x80) != 0) { + switch (super->action) { case 4: - this->subtimer = 0; + super->subtimer = 0; ModHealth(-2); - ProcessMovement3(this); - UpdateAnimationSingleFrame(this); + ProcessMovement3(super); + UpdateAnimationSingleFrame(super); break; case 3: - if (this->confusedTime != 0) { - this->field_0x82.HALF.LO = 2; - this->animationState = 0xff; + if (super->confusedTime != 0) { + this->unk_82 = 2; + super->animationState = 0xff; sub_080AA270(this); - this->subtimer = 32; + super->subtimer = 32; } break; default: - parent = this->parent; - parent->iframes = this->iframes; - parent->knockbackDirection = this->knockbackDirection; - parent->knockbackDuration = this->knockbackDuration; - if (this->action == 1) { + parent = super->parent; + parent->iframes = super->iframes; + parent->knockbackDirection = super->knockbackDirection; + parent->knockbackDuration = super->knockbackDuration; + if (super->action == 1) { sub_080AA320(this); } break; } - this->knockbackDuration = 0; + super->knockbackDuration = 0; } } -void MandiblesProjectile_Init(Entity* this) { - this->action = 1; - this->field_0x80.HWORD = 0; - this->animationState = 0xff; - this->field_0x82.HALF.LO = 0; - this->spritePriority.b0 = 4; - SortEntityBelow(this, this->parent); +void MandiblesProjectile_Init(MandiblesProjectileEntity* this) { + super->action = 1; + this->unk_80 = 0; + super->animationState = 0xff; + this->unk_82 = 0; + super->spritePriority.b0 = 4; + SortEntityBelow(super, super->parent); sub_080AA270(this); } -void MandiblesProjectile_Action1(Entity* this) { - if (this->field_0x80.HWORD != 0) { - this->field_0x80.HWORD--; +void MandiblesProjectile_Action1(MandiblesProjectileEntity* this) { + if (this->unk_80 != 0) { + this->unk_80--; } else { - if (--this->subtimer == 0) { + if (--super->subtimer == 0) { sub_080AA270(this); } else { - if (sub_080AA2E0(this) != 0) { + if (sub_080AA2E0(super) != 0) { sub_080AA320(this); } } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void MandiblesProjectile_Action2(Entity* this) { - UpdateAnimationSingleFrame(this); - if ((this->frame & 0x40) != 0) { - this->frame &= ~0x40; +void MandiblesProjectile_Action2(MandiblesProjectileEntity* this) { + UpdateAnimationSingleFrame(super); + if ((super->frame & 0x40) != 0) { + super->frame &= ~0x40; EnqueueSFX(SFX_15D); } - this->field_0x78.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - if (GetMetaTileType(this->field_0x78.HWORD, this->collisionLayer) == SPECIAL_META_TILE_0) { - SetMetaTile(SPECIAL_META_TILE_5, this->field_0x78.HWORD, this->collisionLayer); + this->unk_78 = TILE(super->x.HALF.HI, super->y.HALF.HI); + if (GetMetaTileType(this->unk_78, super->collisionLayer) == SPECIAL_META_TILE_0) { + SetMetaTile(SPECIAL_META_TILE_5, this->unk_78, super->collisionLayer); } } -void MandiblesProjectile_Action3(Entity* this) { +void MandiblesProjectile_Action3(MandiblesProjectileEntity* this) { u32 uVar1; s8* tmp; Entity* entity; - entity = this->child; + entity = super->child; if (entity == NULL) { DeleteThisEntity(); } @@ -122,30 +138,30 @@ void MandiblesProjectile_Action3(Entity* this) { } else { tmp = GetSpriteSubEntryOffsetDataPointer((u16)entity->spriteIndex, entity->frameIndex); if ((entity->animationState & 4) != 0) { - PositionRelative(entity, this, Q_16_16(-tmp[0]), Q_16_16(tmp[1])); + PositionRelative(entity, super, Q_16_16(-tmp[0]), Q_16_16(tmp[1])); } else { - PositionRelative(entity, this, Q_16_16(tmp[0]), Q_16_16(tmp[1])); + PositionRelative(entity, super, Q_16_16(tmp[0]), Q_16_16(tmp[1])); } } if (entity->confusedTime == 0) { - if (this->subtimer != 0) { - this->subtimer--; + if (super->subtimer != 0) { + super->subtimer--; } else { - UpdateAnimationSingleFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 4; - this->field_0x82.HALF.LO = 3; - this->subtimer = 64; + UpdateAnimationSingleFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 4; + this->unk_82 = 3; + super->subtimer = 64; uVar1 = entity->animationState; - this->direction = uVar1 << 2; - this->animationState = uVar1 << 0x1a >> 0x1a; + super->direction = uVar1 << 2; + super->animationState = uVar1 << 0x1a >> 0x1a; #ifdef EU - this->spriteOrientation.flipY = 1; - this->hitbox = (Hitbox*)&gHitbox_0; + super->spriteOrientation.flipY = 1; + super->hitbox = (Hitbox*)&gHitbox_0; #else - this->hitbox = (Hitbox*)&gHitbox_0; + super->hitbox = (Hitbox*)&gHitbox_0; if (AreaIsDungeon() != 0) { - this->spriteOrientation.flipY = 1; + super->spriteOrientation.flipY = 1; } #endif sub_080AA3E0(this, 0); @@ -154,51 +170,51 @@ void MandiblesProjectile_Action3(Entity* this) { } } -void MandiblesProjectile_Action4(Entity* this) { +void MandiblesProjectile_Action4(MandiblesProjectileEntity* this) { s32 iVar1; u32 uVar2; - Entity* entity; + MandiblesProjectileEntity* entity; - entity = this->child; + entity = (MandiblesProjectileEntity*)super->child; if (entity != NULL) { - if (entity->next == NULL) { - this->child = NULL; + if (entity->base.next == NULL) { + super->child = NULL; } - if (this->subtimer != 0) { - this->subtimer--; + if (super->subtimer != 0) { + super->subtimer--; } else { - if (sub_080AA374(this) != 0) { - if (entity->health == 0) { + if (sub_080AA374(super) != 0) { + if (entity->base.health == 0) { DeleteThisEntity(); } EnqueueSFX(SFX_F2); - this->action = 1; - this->animationState = 0xff; - this->field_0x82.HALF.LO = 0; - this->timer = 0; - this->field_0x80.HWORD = 0x20; - this->spriteOrientation.flipY = 2; - this->parent = this->child; - this->child = NULL; + super->action = 1; + super->animationState = 0xff; + this->unk_82 = 0; + super->timer = 0; + this->unk_80 = 0x20; + super->spriteOrientation.flipY = 2; + super->parent = super->child; + super->child = NULL; sub_080AA270(this); - entity = this->parent; - entity->action = 1; - entity->direction = entity->animationState << 2; - entity->speed = 0; - entity->field_0x82.HALF.LO = 1; - entity->timer = 0; - entity->subtimer = 120; - entity->field_0x80.HWORD = 0x20; + entity = (MandiblesProjectileEntity*)super->parent; + entity->base.action = 1; + entity->base.direction = entity->base.animationState << 2; + entity->base.speed = 0; + entity->unk_82 = 1; + entity->base.timer = 0; + entity->base.subtimer = 120; + entity->unk_80 = 0x20; sub_080AA3E0(entity, 1); } } } else { - if (CheckOnScreen(this) == 0) { + if (CheckOnScreen(super) == 0) { DeleteThisEntity(); } } - LinearMoveUpdate(this); - UpdateAnimationSingleFrame(this); + LinearMoveUpdate(super); + UpdateAnimationSingleFrame(super); } void sub_080AA1D8(Entity* this) { @@ -232,21 +248,21 @@ void sub_080AA1D8(Entity* this) { } } -void sub_080AA270(Entity* this) { +void sub_080AA270(MandiblesProjectileEntity* this) { u32 animationState; Entity* parent; - parent = this->parent; - this->subtimer = gUnk_08129CA4[Random() & 7]; + parent = super->parent; + super->subtimer = gUnk_08129CA4[Random() & 7]; animationState = parent->animationState; - if (this->animationState == 0xff) { - this->animationState = animationState; - this->hitbox = (Hitbox*)gUnk_08129CF4[animationState]; + if (super->animationState == 0xff) { + super->animationState = animationState; + super->hitbox = (Hitbox*)gUnk_08129CF4[animationState]; sub_080AA3E0(this, 0); } else { animationState = (gUnk_08129CAC[Random() & 7] + animationState) & 7; - if (animationState != this->animationState) { - this->animationState = animationState; - this->hitbox = (Hitbox*)gUnk_08129CF4[animationState]; + if (animationState != super->animationState) { + super->animationState = animationState; + super->hitbox = (Hitbox*)gUnk_08129CF4[animationState]; sub_080AA3E0(this, 0); } } @@ -272,25 +288,25 @@ bool32 sub_080AA2E0(Entity* this) { return TRUE; } -void sub_080AA320(Entity* this) { +void sub_080AA320(MandiblesProjectileEntity* this) { u32 uVar2; - Entity* parent; + MandiblesProjectileEntity* parent; - parent = this->parent; - this->action = 2; - this->field_0x82.HALF.LO = 1; - this->subtimer = 0; - parent->action = 2; - parent->subtimer = 48; - parent->field_0x80.HWORD = 0x50; - parent->speed = 0; - parent->direction = sub_08049F84(parent, 0); + parent = (MandiblesProjectileEntity*)super->parent; + super->action = 2; + this->unk_82 = 1; + super->subtimer = 0; + parent->base.action = 2; + parent->base.subtimer = 48; + parent->unk_80 = 0x50; + parent->base.speed = 0; + parent->base.direction = sub_08049F84(&parent->base, 0); // TODO regalloc - uVar2 = Direction8Round(parent->direction + 4); - this->animationState = uVar2 >> 2; - parent->animationState = DirectionRound(uVar2) >> 2; + uVar2 = Direction8Round(parent->base.direction + 4); + super->animationState = uVar2 >> 2; + parent->base.animationState = DirectionRound(uVar2) >> 2; sub_080AA3E0(parent, 1); - sub_080AA1D8(this); + sub_080AA1D8(super); } bool32 sub_080AA374(Entity* this) { @@ -313,20 +329,24 @@ bool32 sub_080AA374(Entity* this) { return result; } -void sub_080AA3E0(Entity* this, u32 param) { +void sub_080AA3E0(MandiblesProjectileEntity* this, u32 param) { u32 tmp; - tmp = this->animationState | this->field_0x82.HALF.LO << 3; + tmp = super->animationState | this->unk_82 << 3; if (param != 0) { tmp >>= 1; } - InitAnimationForceUpdate(this, tmp); + InitAnimationForceUpdate(super, tmp); } -void (*const MandiblesProjectile_Functions[])(Entity*) = { - MandiblesProjectile_OnTick, sub_080A9EBC, DeleteEntity, DeleteEntity, DeleteEntity, +void (*const MandiblesProjectile_Functions[])(MandiblesProjectileEntity*) = { + MandiblesProjectile_OnTick, + MandiblesProjectile_OnCollision, + (void (*)(MandiblesProjectileEntity*))DeleteEntity, + (void (*)(MandiblesProjectileEntity*))DeleteEntity, + (void (*)(MandiblesProjectileEntity*))DeleteEntity, }; -void (*const MandiblesProjectile_Actions[])(Entity*) = { +void (*const MandiblesProjectile_Actions[])(MandiblesProjectileEntity*) = { MandiblesProjectile_Init, MandiblesProjectile_Action1, MandiblesProjectile_Action2, MandiblesProjectile_Action3, MandiblesProjectile_Action4, }; diff --git a/src/projectile/mazaalEnergyBeam.c b/src/projectile/mazaalEnergyBeam.c index 21287caa..0493b76f 100644 --- a/src/projectile/mazaalEnergyBeam.c +++ b/src/projectile/mazaalEnergyBeam.c @@ -1,6 +1,13 @@ +/** + * @file mazaalEnergyBeam.c + * @ingroup Projectiles + * + * @brief Mazaal Energy Beam Projectile + */ +#define NENT_DEPRECATED #include "entity.h" -#include "sound.h" #include "physics.h" +#include "sound.h" extern void (*const MazaalEnergyBeam_Actions[])(Entity*); diff --git a/src/projectile/moblinSpear.c b/src/projectile/moblinSpear.c index 0cf5f0c6..22220438 100644 --- a/src/projectile/moblinSpear.c +++ b/src/projectile/moblinSpear.c @@ -1,5 +1,12 @@ -#include "entity.h" +/** + * @file moblinSpear.c + * @ingroup Projectiles + * + * @brief Moblin Spear Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "physics.h" typedef struct { @@ -10,13 +17,13 @@ typedef struct { } HitboxChange; void MoblinSpear_OnTick(Entity* this); -void sub_080A832C(Entity* this); +void MoblinSpear_OnCollision(Entity* this); void MoblinSpear_Init(Entity* this); void MoblinSpear_Action1(Entity* this); void MoblinSpear(Entity* this) { static void (*const MoblinSpear_Functions[])(Entity*) = { - MoblinSpear_OnTick, sub_080A832C, DeleteEntity, DeleteEntity, DeleteEntity, + MoblinSpear_OnTick, MoblinSpear_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; MoblinSpear_Functions[GetNextFunction(this)](this); } @@ -29,7 +36,7 @@ void MoblinSpear_OnTick(Entity* this) { MoblinSpear_Actions[this->action](this); } -void sub_080A832C(Entity* this) { +void MoblinSpear_OnCollision(Entity* this) { u8 tmp; if (this->contactFlags == 0x80) { diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index e25a0db8..132bf8a5 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -1,13 +1,28 @@ -#include "entity.h" +/** + * @file octorockBossProjectile.c + * @ingroup Projectiles + * + * @brief Octorock Boss Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" #include "projectile.h" -void OctorokBossProjectile_Action2(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u8 unk_7c; +} OctorokBossProjectileEntity; -extern void (*const OctorokBossProjectile_Functions[])(Entity*); -extern void (*const OctorokBossProjectile_Actions[])(Entity*); +void OctorokBossProjectile_Action2(OctorokBossProjectileEntity*); + +extern void (*const OctorokBossProjectile_Functions[])(OctorokBossProjectileEntity*); +extern void (*const OctorokBossProjectile_Actions[])(OctorokBossProjectileEntity*); extern const u8 gUnk_08129ADC[]; enum OctorokBossProjectileType { @@ -17,192 +32,196 @@ enum OctorokBossProjectileType { TYPE3 // falling stones }; -void OctorokBossProjectile(Entity* this) { - OctorokBossProjectile_Functions[GetNextFunction(this)](this); +void OctorokBossProjectile(OctorokBossProjectileEntity* this) { + OctorokBossProjectile_Functions[GetNextFunction(super)](this); } -void OctorokBossProjectile_OnTick(Entity* this) { - OctorokBossProjectile_Actions[this->action](this); +void OctorokBossProjectile_OnTick(OctorokBossProjectileEntity* this) { + OctorokBossProjectile_Actions[super->action](this); } -void OctorokBossProjectile_Init(Entity* this) { +void OctorokBossProjectile_Init(OctorokBossProjectileEntity* this) { u32 uVar1; u32 uVar2; - this->action = 1; + super->action = 1; - switch (this->type) { + switch (super->type) { case 0: - LinearMoveAngle(this, 0x4800, this->direction); - this->speed = 0x200; - this->timer = 0; - this->subtimer = this->direction; - this->field_0x78.HWORD = 300; - InitAnimationForceUpdate(this, 0); + LinearMoveAngle(super, 0x4800, super->direction); + super->speed = 0x200; + super->timer = 0; + super->subtimer = super->direction; + this->unk_78 = 300; + InitAnimationForceUpdate(super, 0); break; case 1: - this->spriteRendering.b3 = 3; - this->spritePriority.b0 = 6; - this->speed = (Random() & 0x1ff) + 0x200; - this->zVelocity = (Random() & 0x1fff) + Q_16_16(1.5); + super->spriteRendering.b3 = 3; + super->spritePriority.b0 = 6; + super->speed = (Random() & 0x1ff) + 0x200; + super->zVelocity = (Random() & 0x1fff) + Q_16_16(1.5); uVar1 = (((u8)Random() & 7) - 4); - this->direction -= uVar1; - *(u32*)&this->field_0x78 = 600; - LinearMoveAngle(this, this->speed, this->direction); - InitializeAnimation(this, 4); + super->direction -= uVar1; + *(u32*)&this->unk_78 = 600; + LinearMoveAngle(super, super->speed, super->direction); + InitializeAnimation(super, 4); break; case 2: if ((Random() & 1) != 0) { - this->direction = (Random() & 7) + this->direction; + super->direction = (Random() & 7) + super->direction; } else { - this->direction = this->direction - (Random() & 7); + super->direction = super->direction - (Random() & 7); } - this->speed = 0x200; - this->timer = 48; - LinearMoveAngle(this, 0x5000, this->direction); - InitializeAnimation(this, 5); + super->speed = 0x200; + super->timer = 48; + LinearMoveAngle(super, 0x5000, super->direction); + InitializeAnimation(super, 5); break; case 3: - CopyPosition(&gPlayerEntity, this); - this->z.WORD = Q_16_16(-160.0); - this->x.HALF.HI += 0x60; - this->y.HALF.HI += 0x40; - this->x.HALF.HI -= (s32)Random() % 0xc0; + CopyPosition(&gPlayerEntity, super); + super->z.WORD = Q_16_16(-160.0); + super->x.HALF.HI += 0x60; + super->y.HALF.HI += 0x40; + super->x.HALF.HI -= (s32)Random() % 0xc0; uVar2 = Random() & 0x7f; - this->y.HALF.HI -= uVar2; - InitializeAnimation(this, 0); + super->y.HALF.HI -= uVar2; + InitializeAnimation(super, 0); break; } SoundReq(SFX_1B5); } -void OctorokBossProjectile_Action1(Entity* this) { +void OctorokBossProjectile_Action1(OctorokBossProjectileEntity* this) { u32 index; - switch (this->type) { + switch (super->type) { case 0: - if (this->parent->action == 2) { + if (super->parent->action == 2) { DeleteThisEntity(); } - if ((this->type2 == 0) && ((this->contactFlags & 0x80) != 0)) { - if ((this->contactFlags & 0x7f) == 0) { + if ((super->type2 == 0) && ((super->contactFlags & 0x80) != 0)) { + if ((super->contactFlags & 0x7f) == 0) { OctorokBossProjectile_Action2(this); } - this->direction = this->knockbackDirection << 3; - this->speed = 0x400; - this->type2 = 1; - this->timer = 0; - COLLISION_OFF(this); + super->direction = super->knockbackDirection << 3; + super->speed = 0x400; + super->type2 = 1; + super->timer = 0; + COLLISION_OFF(super); } - if (sub_0806FC80(this, this->parent, 0x40) != 0) { - if (this->type2 == 0) { - this->direction ^= 0x80; - this->speed = 0x400; + if (sub_0806FC80(super, super->parent, 0x40) != 0) { + if (super->type2 == 0) { + super->direction ^= 0x80; + super->speed = 0x400; } else { - this->parent->health--; - this->parent->iframes = 0x1e; - if (this->parent->field_0x7c.BYTES.byte0 != 0) { - this->parent->knockbackDuration = 0x18; - this->parent->knockbackSpeed = 0x200; - this->parent->knockbackDirection = this->direction >> 3; + super->parent->health--; + super->parent->iframes = 0x1e; + if (((OctorokBossProjectileEntity*)super->parent)->unk_7c != 0) { + super->parent->knockbackDuration = 0x18; + super->parent->knockbackSpeed = 0x200; + super->parent->knockbackDirection = super->direction >> 3; } SoundReq(SFX_BOSS_HIT); OctorokBossProjectile_Action2(this); } } - UpdateAnimationSingleFrame(this); - this->field_0x78.HWORD--; - LinearMoveAngle(this, this->speed, this->direction); - CalculateEntityTileCollisions(this, this->direction >> 3, 0); - if ((this->collisions & (COL_WEST_ANY | COL_EAST_ANY)) != COL_NONE) { - this->direction = -this->direction; + UpdateAnimationSingleFrame(super); + this->unk_78--; + LinearMoveAngle(super, super->speed, super->direction); + CalculateEntityTileCollisions(super, super->direction >> 3, 0); + if ((super->collisions & (COL_WEST_ANY | COL_EAST_ANY)) != COL_NONE) { + super->direction = -super->direction; } - if ((this->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) { - this->direction = -this->direction ^ 0x80; + if ((super->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) { + super->direction = -super->direction ^ 0x80; } - if (this->direction == this->subtimer) { + if (super->direction == super->subtimer) { return; } SoundReq(SFX_164); - if (this->field_0x78.HWORD == 0) { - this->timer = 4; + if (this->unk_78 == 0) { + super->timer = 4; } else { - this->timer++; + super->timer++; } - this->subtimer = this->direction; - if (this->timer < 2) { + super->subtimer = super->direction; + if (super->timer < 2) { return; } for (index = 0; index < 3; ++index) { - this->child = CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 1); - if (this->child != NULL) { - this->child->parent = this->parent; - this->child->direction = this->direction + gUnk_08129ADC[index]; - CopyPosition(this, this->child); + super->child = CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 1); + if (super->child != NULL) { + super->child->parent = super->parent; + super->child->direction = super->direction + gUnk_08129ADC[index]; + CopyPosition(super, super->child); } } OctorokBossProjectile_Action2(this); break; case 1: - if (this->parent->action == 2) { + if (super->parent->action == 2) { OctorokBossProjectile_Action2(this); } - GetNextFrame(this); - if (GravityUpdate(this, Q_8_8(24.0)) != 0) { - CalculateEntityTileCollisions(this, this->direction >> 3, 0); - if (this->collisions == COL_NONE) { - LinearMoveAngle(this, (s32)this->speed, (u32)this->direction); + GetNextFrame(super); + if (GravityUpdate(super, Q_8_8(24.0)) != 0) { + CalculateEntityTileCollisions(super, super->direction >> 3, 0); + if (super->collisions == COL_NONE) { + LinearMoveAngle(super, (s32)super->speed, (u32)super->direction); } else { OctorokBossProjectile_Action2(this); } } - if (*(u32*)&this->field_0x78 < 0x1e) { - if ((*(u32*)&this->field_0x78 & 7) != 0) { - this->spriteSettings.draw = 1; + if (*(u32*)&this->unk_78 < 0x1e) { + if ((*(u32*)&this->unk_78 & 7) != 0) { + super->spriteSettings.draw = 1; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } } - if (--*(u32*)&this->field_0x78 == -1) { + if (--*(u32*)&this->unk_78 == -1) { OctorokBossProjectile_Action2(this); } - if ((this->contactFlags & 0x80) == 0) { + if ((super->contactFlags & 0x80) == 0) { return; } OctorokBossProjectile_Action2(this); break; case 2: - GetNextFrame(this); - if (this->timer-- != 0) { - LinearMoveAngle(this, this->speed, this->direction); + GetNextFrame(super); + if (super->timer-- != 0) { + LinearMoveAngle(super, super->speed, super->direction); return; } - if (this->child != NULL) { - this->child->timer = 1; + if (super->child != NULL) { + super->child->timer = 1; } DeleteThisEntity(); break; case 3: - if (GravityUpdate(this, Q_8_8(24.0)) != 0) { + if (GravityUpdate(super, Q_8_8(24.0)) != 0) { return; } - CreateFx(this, FX_ROCK, 0); + CreateFx(super, FX_ROCK, 0); DeleteThisEntity(); break; } } -void OctorokBossProjectile_Action2(Entity* this) { - CreateFx(this, FX_ROCK, 0); +void OctorokBossProjectile_Action2(OctorokBossProjectileEntity* this) { + CreateFx(super, FX_ROCK, 0); DeleteThisEntity(); } -void (*const OctorokBossProjectile_Functions[])(Entity*) = { - OctorokBossProjectile_OnTick, OctorokBossProjectile_OnTick, DeleteEntity, DeleteEntity, DeleteEntity, +void (*const OctorokBossProjectile_Functions[])(OctorokBossProjectileEntity*) = { + OctorokBossProjectile_OnTick, + OctorokBossProjectile_OnTick, + (void (*)(OctorokBossProjectileEntity*))DeleteEntity, + (void (*)(OctorokBossProjectileEntity*))DeleteEntity, + (void (*)(OctorokBossProjectileEntity*))DeleteEntity, }; -void (*const OctorokBossProjectile_Actions[])(Entity*) = { +void (*const OctorokBossProjectile_Actions[])(OctorokBossProjectileEntity*) = { OctorokBossProjectile_Init, OctorokBossProjectile_Action1, OctorokBossProjectile_Action2, diff --git a/src/projectile/projectile5.c b/src/projectile/projectile5.c index 2f55e82d..36419870 100644 --- a/src/projectile/projectile5.c +++ b/src/projectile/projectile5.c @@ -1,9 +1,22 @@ +/** + * @file projectile5.c + * @ingroup Projectiles + * + * @brief Projectile 5 + */ +#define NENT_DEPRECATED #include "asm.h" -#include "entity.h" #include "enemy.h" +#include "entity.h" +#include "physics.h" #include "player.h" #include "room.h" -#include "physics.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[27]; + /*0x83*/ u8 unk_83; +} Projectile5Entity; extern void (*const Projectile5_Functions[])(Entity*); extern void (*const Projectile5_Actions[])(Entity*); @@ -18,14 +31,14 @@ void Projectile5_OnTick(Entity* this) { Projectile5_Actions[this->action](this); } -void sub_080A86F0(Entity* this) { +void Projectile5_OnCollision(Entity* this) { u8* pbVar2; if (this->parent == NULL) { DeleteThisEntity(); } else { - pbVar2 = &this->parent->field_0x82.HALF.HI; - if ((this->parent->field_0x82.HALF.HI & 0x3f) == 3) { + pbVar2 = &((Projectile5Entity*)this->parent)->unk_83; + if ((((Projectile5Entity*)this->parent)->unk_83 & 0x3f) == 3) { if (gPlayerState.hurtBlinkSpeed != 0) { if (GetCollisionDataAtMetaTilePos(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.collisionLayer) == 0) { @@ -48,22 +61,22 @@ void Projectile5_Init(Entity* this) { } void Projectile5_Action1(Entity* this) { - Entity* parent = this->parent; + Projectile5Entity* parent = (Projectile5Entity*)this->parent; if (parent == NULL) { DeleteThisEntity(); } - if (parent->next == NULL) { + if (parent->base.next == NULL) { DeleteThisEntity(); } - if ((parent->field_0x82.HALF.HI & 0x7f) != 3) { + if ((parent->unk_83 & 0x7f) != 3) { DeleteThisEntity(); } - CopyPosition(parent, this); + CopyPosition(&parent->base, this); this->z.HALF.HI += 2; } void (*const Projectile5_Functions[])(Entity*) = { - Projectile5_OnTick, sub_080A86F0, DeleteEntity, DeleteEntity, DeleteEntity, + Projectile5_OnTick, Projectile5_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const Projectile5_Actions[])(Entity*) = { Projectile5_Init, diff --git a/src/projectile/removableDust.c b/src/projectile/removableDust.c index 72b10cf4..d7b46a6a 100644 --- a/src/projectile/removableDust.c +++ b/src/projectile/removableDust.c @@ -1,67 +1,81 @@ -#include "entity.h" +/** + * @file removableDust.c + * @ingroup Projectiles + * + * @brief Removable Dust Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" -#include "physics.h" +#include "entity.h" #include "functions.h" #include "object.h" +#include "physics.h" #include "room.h" #include "tiles.h" -extern void (*const RemovableDust_Functions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ EntityData* unk_68; + /*0x6c*/ u8 unused[26]; + /*0x86*/ u16 unk_86; +} RemovableDustEntity; + +extern void (*const RemovableDust_Functions[])(RemovableDustEntity*); extern const u16 gUnk_08129FD0[]; extern const u16 gUnk_08129FE4[]; extern const s8 gUnk_08129FF8[]; extern const u8 gUnk_0812A004[]; -void sub_080AA494(Entity*); +void sub_080AA494(RemovableDustEntity*); void sub_080AA534(Entity*); -void sub_080AA464(Entity*); -void sub_080AA544(Entity*); -void sub_080AA654(Entity*, u32); +void RemovableDust_OnGrabbed(RemovableDustEntity*); +void sub_080AA544(RemovableDustEntity*); +void sub_080AA654(RemovableDustEntity*, u32); -void RemovableDust(Entity* this) { - RemovableDust_Functions[GetNextFunction(this)](this); +void RemovableDust(RemovableDustEntity* this) { + RemovableDust_Functions[GetNextFunction(super)](this); } -void RemovableDust_OnTick(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->frameIndex = this->type; - this->gustJarFlags = 1; - this->speed = this->field_0x86.HWORD; - if (this->type == 0) { +void RemovableDust_OnTick(RemovableDustEntity* this) { + if (super->action == 0) { + super->action = 1; + super->frameIndex = super->type; + super->gustJarFlags = 1; + super->speed = this->unk_86; + if (super->type == 0) { sub_080AA494(this); } else { - sub_080AA534(this); + sub_080AA534(super); } } } -void sub_080AA450(Entity* this) { - if (this->contactFlags == 0x96) { - sub_080AA464(this); +void RemovableDust_OnCollision(RemovableDustEntity* this) { + if (super->contactFlags == 0x96) { + RemovableDust_OnGrabbed(this); } } -void sub_080AA464(Entity* this) { +void RemovableDust_OnGrabbed(RemovableDustEntity* this) { Entity* entity; - if (this->type == 0) { + if (super->type == 0) { sub_080AA544(this); } entity = CreateObject(DIRT_PARTICLE, 3, 0); if (entity != NULL) { - CopyPosition(this, entity); + CopyPosition(super, entity); } - DeleteEntity(this); + DeleteEntity(super); } -void sub_080AA494(Entity* this) { +void sub_080AA494(RemovableDustEntity* this) { u32 tileType; const u16* iterator; u32 index; index = 0; - tileType = GetMetaTileTypeByEntity(this); + tileType = GetMetaTileTypeByEntity(super); iterator = gUnk_08129FD0; while (*iterator != 0) { if (*(iterator++) == tileType) { @@ -69,15 +83,15 @@ void sub_080AA494(Entity* this) { } index++; } - if (CheckFlags((u16)this->speed) != 0) { + if (CheckFlags((u16)super->speed) != 0) { if (index == 4) { - sub_080AA654(this, TILE(this->x.HALF.HI, this->y.HALF.HI)); + sub_080AA654(this, TILE(super->x.HALF.HI, super->y.HALF.HI)); } DeleteThisEntity(); } - this->type2 = index; - this->spritePriority.b0 = 7; - SetMetaTile(SPECIAL_META_TILE_104, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + super->type2 = index; + super->spritePriority.b0 = 7; + SetMetaTile(SPECIAL_META_TILE_104, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); } void sub_080AA534(Entity* this) { @@ -85,7 +99,7 @@ void sub_080AA534(Entity* this) { UpdateSpriteForCollisionLayer(this); } -void sub_080AA544(Entity* this) { +void sub_080AA544(RemovableDustEntity* this) { u8* pbVar1; s32 vvv; u32 uVar3; @@ -94,13 +108,13 @@ void sub_080AA544(Entity* this) { u32 param; const s8* tmp; - if (this->type2 < 9) { + if (super->type2 < 9) { tmp = gUnk_08129FF8; - param = TILE(this->x.HALF.HI, this->y.HALF.HI) + tmp[this->type2]; + param = TILE(super->x.HALF.HI, super->y.HALF.HI) + tmp[super->type2]; uVar3 = 0; iVar4 = 0; do { - vvv = GetVvvAtMetaTilePos((param - tmp[uVar3]) & 0xffff, this->collisionLayer); + vvv = GetVvvAtMetaTilePos((param - tmp[uVar3]) & 0xffff, super->collisionLayer); if (vvv == VVV_62) { iVar4++; } @@ -111,24 +125,24 @@ void sub_080AA544(Entity* this) { uVar3 = 0; puVar5 = gUnk_08129FD0; do { - sub_0807B7D8((u32)*puVar5, param - tmp[uVar3], this->collisionLayer); + sub_0807B7D8((u32)*puVar5, param - tmp[uVar3], super->collisionLayer); puVar5++; uVar3++; } while (uVar3 < 9); sub_080AA654(this, param); - SetFlag((u16)this->speed); + SetFlag((u16)super->speed); } else { - sub_0807B7D8(gUnk_08129FE4[this->type2], param - tmp[this->type2], this->collisionLayer); + sub_0807B7D8(gUnk_08129FE4[super->type2], param - tmp[super->type2], super->collisionLayer); } } else { - RestorePrevTileEntity(TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); - SetFlag((u16)this->speed); + RestorePrevTileEntity(TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); + SetFlag((u16)super->speed); } } -void sub_080AA654(Entity* this, u32 param) { +void sub_080AA654(RemovableDustEntity* this, u32 param) { EntityData* entityData; - entityData = (EntityData*)&this->field_0x68; + entityData = (EntityData*)&this->unk_68; MemCopy(&gUnk_0812A004, entityData, 0x10); @@ -138,8 +152,13 @@ void sub_080AA654(Entity* this, u32 param) { LoadRoomEntity(entityData); } -void (*const RemovableDust_Functions[])(Entity*) = { - RemovableDust_OnTick, sub_080AA450, DeleteEntity, DeleteEntity, DeleteEntity, sub_080AA464, +void (*const RemovableDust_Functions[])(RemovableDustEntity*) = { + RemovableDust_OnTick, + RemovableDust_OnCollision, + (void (*)(RemovableDustEntity*))DeleteEntity, + (void (*)(RemovableDustEntity*))DeleteEntity, + (void (*)(RemovableDustEntity*))DeleteEntity, + RemovableDust_OnGrabbed, }; const u16 gUnk_08129FD0[] = { 387, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 0 }; const u16 gUnk_08129FE4[] = { 388, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 0 }; diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index 3124605a..786fe69a 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -1,5 +1,12 @@ -#include "entity.h" +/** + * @file rockProjectile.c + * @ingroup Projectiles + * + * @brief Rock Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const RockProjectile_Functions[])(Entity*); @@ -15,7 +22,7 @@ void RockProjectile_OnTick(Entity* this) { RockProjectile_Actions[this->action](this); } -void sub_080A8064(Entity* this) { +void RockProjectile_OnCollision(Entity* this) { if (this->contactFlags == 0x80) { DeleteEntity(this); } else { @@ -86,7 +93,7 @@ void sub_080A8178(Entity* this) { } void (*const RockProjectile_Functions[])(Entity*) = { - RockProjectile_OnTick, sub_080A8064, DeleteEntity, DeleteEntity, DeleteEntity, + RockProjectile_OnTick, RockProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const RockProjectile_Actions[])(Entity*) = { RockProjectile_Init, diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c index 1876c8ab..b613cb8f 100644 --- a/src/projectile/spiderWeb.c +++ b/src/projectile/spiderWeb.c @@ -1,3 +1,10 @@ +/** + * @file spiderWeb.c + * @ingroup Projectiles + * + * @brief Spider Web Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" @@ -5,145 +12,158 @@ #include "object.h" #include "tiles.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unused2; + /*0x86*/ u16 unk_86; +} SpiderWebEntity; + typedef struct { u8 b0; u8 direction; } PACKED Struct_0812A074; -void SpiderWeb_OnTick(Entity*); -void sub_080AA6C0(Entity*); -void sub_080AAAA8(Entity*); +void SpiderWeb_OnTick(SpiderWebEntity*); +void SpiderWeb_OnCollision(SpiderWebEntity*); +void sub_080AAAA8(SpiderWebEntity*); void sub_080AAA68(Entity*); void sub_080AA9E0(Entity*); -void sub_080AA78C(Entity*); -void SpiderWeb_Init(Entity*); -void SpiderWeb_Action1(Entity*); -void SpiderWeb_Action2(Entity*); -void SpiderWeb_Action3(Entity*); -void SpiderWeb_SubAction0(Entity*); -void SpiderWeb_SubAction1(Entity*); +void SpiderWeb_OnGrabbed(SpiderWebEntity*); +void SpiderWeb_Init(SpiderWebEntity*); +void SpiderWeb_Action1(SpiderWebEntity*); +void SpiderWeb_Action2(SpiderWebEntity*); +void SpiderWeb_Action3(SpiderWebEntity*); +void SpiderWeb_SubAction0(SpiderWebEntity*); +void SpiderWeb_SubAction1(SpiderWebEntity*); -void SpiderWeb(Entity* this) { - static void (*const SpiderWeb_Functions[])(Entity*) = { - SpiderWeb_OnTick, sub_080AA6C0, DeleteEntity, DeleteEntity, DeleteEntity, sub_080AA78C, +void SpiderWeb(SpiderWebEntity* this) { + static void (*const SpiderWeb_Functions[])(SpiderWebEntity*) = { + SpiderWeb_OnTick, + SpiderWeb_OnCollision, + (void (*)(SpiderWebEntity*))DeleteEntity, + (void (*)(SpiderWebEntity*))DeleteEntity, + (void (*)(SpiderWebEntity*))DeleteEntity, + SpiderWeb_OnGrabbed, }; - SpiderWeb_Functions[GetNextFunction(this)](this); + SpiderWeb_Functions[GetNextFunction(super)](this); } -void SpiderWeb_OnTick(Entity* this) { - static void (*const SpiderWeb_Actions[])(Entity*) = { +void SpiderWeb_OnTick(SpiderWebEntity* this) { + static void (*const SpiderWeb_Actions[])(SpiderWebEntity*) = { SpiderWeb_Init, SpiderWeb_Action1, SpiderWeb_Action2, SpiderWeb_Action3, }; - SpiderWeb_Actions[this->action](this); + SpiderWeb_Actions[super->action](this); } -void sub_080AA6C0(Entity* this) { +void SpiderWeb_OnCollision(SpiderWebEntity* this) { static const s8 typeSpritOffsets[] = { -8, -4, 6, 1, 4, -11, -3, 3, -7, -3, 6, 4, -4, -11, 3, 3, }; Entity* object; - if (this->contactFlags == 0x87) { - this->action = 3; - this->timer = 90; - COLLISION_OFF(this); - InitAnimationForceUpdate(this, this->type + 0x10); + if (super->contactFlags == 0x87) { + super->action = 3; + super->timer = 90; + COLLISION_OFF(super); + InitAnimationForceUpdate(super, super->type + 0x10); object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = 0x5a; object->spritePriority.b0 = 3; - object->spriteOffsetX = typeSpritOffsets[this->type * 4]; - object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 1]; - object->parent = this; + object->spriteOffsetX = typeSpritOffsets[super->type * 4]; + object->spriteOffsetY = typeSpritOffsets[super->type * 4 + 1]; + object->parent = super; } object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = 0x5a; object->spritePriority.b0 = 3; - object->spriteOffsetX = typeSpritOffsets[this->type * 4 + 2]; - object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 3]; - object->parent = this; + object->spriteOffsetX = typeSpritOffsets[super->type * 4 + 2]; + object->spriteOffsetY = typeSpritOffsets[super->type * 4 + 3]; + object->parent = super; } } else { - InitAnimationForceUpdate(this, this->type + 0x10); + InitAnimationForceUpdate(super, super->type + 0x10); EnqueueSFX(SFX_101); } } -void sub_080AA78C(Entity* this) { +void SpiderWeb_OnGrabbed(SpiderWebEntity* this) { u32 animationState; - if (this->subAction == 0) { + if (super->subAction == 0) { animationState = (gPlayerEntity.animationState >> 1); - if (animationState != this->type) { - this->gustJarState &= ~4; - if (AnimationStateFlip90(animationState) != this->type) { + if (animationState != super->type) { + super->gustJarState &= ~4; + if (AnimationStateFlip90(animationState) != super->type) { return; } - this->iframes = 0xe2; - sub_080AA6C0(this); + super->iframes = 0xe2; + SpiderWeb_OnCollision(this); return; } - this->subAction = 1; - InitAnimationForceUpdate(this, animationState + 8); + super->subAction = 1; + InitAnimationForceUpdate(super, animationState + 8); } - if (sub_0806F520(this)) { - UpdateAnimationSingleFrame(this); - if ((this->frame & 0x10) != 0) { - this->frame &= ~0x10; + if (sub_0806F520(super)) { + UpdateAnimationSingleFrame(super); + if ((super->frame & 0x10) != 0) { + super->frame &= ~0x10; EnqueueSFX(SFX_100); } - if ((this->frame & ANIM_DONE) != 0) { + if ((super->frame & ANIM_DONE) != 0) { sub_080AAAA8(this); } } else { - if ((this->frame & 1) != 0) { + if ((super->frame & 1) != 0) { sub_080AAAA8(this); } else { - InitAnimationForceUpdate(this, this->type + 0x10); + InitAnimationForceUpdate(super, super->type + 0x10); } } } -void SpiderWeb_Init(Entity* this) { +void SpiderWeb_Init(SpiderWebEntity* this) { static const Hitbox* const typeHitboxes[] = { &gUnk_080FD41C, &gUnk_080FD424, &gUnk_080FD42C, &gUnk_080FD434, }; - if (CheckFlags(this->field_0x86.HWORD) != 0) { + if (CheckFlags(this->unk_86) != 0) { DeleteThisEntity(); } - this->action = 1; - this->gustJarFlags = 1; - this->carryFlags = 1; - this->hitbox = (Hitbox*)typeHitboxes[this->type]; - this->cutsceneBeh.HALF.LO = 0; - InitAnimationForceUpdate(this, this->type); - sub_080AAA68(this); + super->action = 1; + super->gustJarFlags = 1; + super->carryFlags = 1; + super->hitbox = (Hitbox*)typeHitboxes[super->type]; + this->unk_84 = 0; + InitAnimationForceUpdate(super, super->type); + sub_080AAA68(super); } -void SpiderWeb_Action1(Entity* this) { - if ((this->frame & ANIM_DONE) == 0) { - UpdateAnimationSingleFrame(this); +void SpiderWeb_Action1(SpiderWebEntity* this) { + if ((super->frame & ANIM_DONE) == 0) { + UpdateAnimationSingleFrame(super); } - sub_080AA9E0(this); + sub_080AA9E0(super); } -void SpiderWeb_Action2(Entity* this) { - static void (*const SpiderWeb_SubActions[])(Entity*) = { +void SpiderWeb_Action2(SpiderWebEntity* this) { + static void (*const SpiderWeb_SubActions[])(SpiderWebEntity*) = { SpiderWeb_SubAction0, SpiderWeb_SubAction1, }; - sub_0806FBB4(this); - SpiderWeb_SubActions[this->subAction - 5](this); + sub_0806FBB4(super); + SpiderWeb_SubActions[super->subAction - 5](this); } -void SpiderWeb_SubAction0(Entity* this) { +void SpiderWeb_SubAction0(SpiderWebEntity* this) { static const s8 gUnk_0812A064[] = { 0, 17, -15, 4, 0, -11, 15, 4 }; static const s8 gUnk_0812A06C[] = { 0, 2, -2, 0, 0, -2, 2, 0 }; @@ -154,24 +174,24 @@ void SpiderWeb_SubAction0(Entity* this) { entity = &gPlayerEntity; - if (this->cutsceneBeh.HALF.LO == 0) { - tmp = this->type; + if (this->unk_84 == 0) { + tmp = super->type; if (tmp * 2 - entity->animationState == 0) { - x = gUnk_0812A064[tmp * 2] + this->x.HALF.HI; - y = gUnk_0812A064[tmp * 2 + 1] + this->y.HALF.HI; + x = gUnk_0812A064[tmp * 2] + super->x.HALF.HI; + y = gUnk_0812A064[tmp * 2 + 1] + super->y.HALF.HI; if (GetCollisionDataAtWorldCoords(x, y, entity->collisionLayer) == 0) { entity->x.HALF.HI = x; entity->y.HALF.HI = y; } } - this->cutsceneBeh.HALF.LO = 1; - this->subtimer = 2; - InitAnimationForceUpdate(this, this->type + 4); + this->unk_84 = 1; + super->subtimer = 2; + InitAnimationForceUpdate(super, super->type + 4); } - if ((entity->animationState >> 1 == this->type) && (gPlayerState.framestate == PL_STATE_PULL) && - ((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frame & 2) != 0) && ((this->frame & ANIM_DONE) == 0)) { - UpdateAnimationSingleFrame(this); - if ((this->frame & 1) != 0) { + if ((entity->animationState >> 1 == super->type) && (gPlayerState.framestate == PL_STATE_PULL) && + ((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frame & 2) != 0) && ((super->frame & ANIM_DONE) == 0)) { + UpdateAnimationSingleFrame(super); + if ((super->frame & 1) != 0) { entity->x.HALF.HI = gUnk_0812A06C[entity->animationState] + entity->x.HALF.HI; entity->y.HALF.HI = gUnk_0812A06C[entity->animationState + 1] + entity->y.HALF.HI; EnqueueSFX(SFX_100); @@ -179,15 +199,15 @@ void SpiderWeb_SubAction0(Entity* this) { } } -void SpiderWeb_SubAction1(Entity* this) { - this->action = 1; - this->cutsceneBeh.HALF.LO = 0; - InitAnimationForceUpdate(this, this->type + 0xc); +void SpiderWeb_SubAction1(SpiderWebEntity* this) { + super->action = 1; + this->unk_84 = 0; + InitAnimationForceUpdate(super, super->type + 0xc); } -void SpiderWeb_Action3(Entity* this) { - GetNextFrame(this); - if (--this->timer == 0) { +void SpiderWeb_Action3(SpiderWebEntity* this) { + GetNextFrame(super); + if (--super->timer == 0) { sub_080AAAA8(this); } } @@ -231,8 +251,8 @@ void sub_080AAA68(Entity* this) { SetMetaTile(typeTiles[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); } -void sub_080AAAA8(Entity* this) { - SetFlag(this->field_0x86.HWORD); - RestorePrevTileEntity(TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); +void sub_080AAAA8(SpiderWebEntity* this) { + SetFlag(this->unk_86); + RestorePrevTileEntity(TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); DeleteThisEntity(); } diff --git a/src/projectile/spikedRollers.c b/src/projectile/spikedRollers.c index 5a9c63bb..51ea296a 100644 --- a/src/projectile/spikedRollers.c +++ b/src/projectile/spikedRollers.c @@ -1,15 +1,21 @@ +/** + * @file spikedRollers.c + * @ingroup Projectiles + * + * @brief Spiked Rollers Projectile + */ #define NENT_DEPRECATED #include "entity.h" #include "functions.h" typedef struct { - Entity base; - s16 x2; - s16 y2; - s16 unk_0x6c; - u8 fill[0x16]; - u16 unk_0x84; - u16 speed2; + /*0x00*/ Entity base; + /*0x68*/ s16 x2; + /*0x6a*/ s16 y2; + /*0x6c*/ s16 unk_0x6c; + /*0x6e*/ u8 fill[0x16]; + /*0x84*/ u16 unk_0x84; + /*0x86*/ u16 speed2; } SpikedRollersEntity; static void (*const SpikedRollers_Actions[])(SpikedRollersEntity*); @@ -19,7 +25,7 @@ void SpikedRollers(SpikedRollersEntity* this) { SpikedRollers_Actions[super->action](this); } -void sub_080ABA74(SpikedRollersEntity* this) { +void SpikedRollers_Init(SpikedRollersEntity* this) { s32 val; super->action++; super->speed = this->speed2; @@ -46,7 +52,7 @@ void sub_080ABA74(SpikedRollersEntity* this) { InitializeAnimation(super, super->type); } -void sub_080ABAE0(SpikedRollersEntity* this) { +void SpikedRollers_Action1(SpikedRollersEntity* this) { s32 diff, unk_0x6c; ProcessMovement3(super); @@ -85,8 +91,8 @@ void sub_080ABAE0(SpikedRollersEntity* this) { } static void (*const SpikedRollers_Actions[])(SpikedRollersEntity*) = { - sub_080ABA74, - sub_080ABAE0, + SpikedRollers_Init, + SpikedRollers_Action1, }; static const u8 gSpikedRollersOffsets[] = { diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index 28e5e93f..a87f3eca 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -1,5 +1,12 @@ -#include "entity.h" +/** + * @file stalfosProjectile.c + * @ingroup Projectiles + * + * @brief Stalfos Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const StalfosProjectile_Functions[])(Entity*); @@ -28,7 +35,7 @@ void StalfosProjectile_OnTick(Entity* this) { StalfosProjectile_Actions[this->action](this); } -void sub_080A9A34(Entity* this) { +void StalfosProjectile_OnCollision(Entity* this) { if (this->contactFlags == 0x9d) { this->action = 3; COLLISION_OFF(this); @@ -37,7 +44,7 @@ void sub_080A9A34(Entity* this) { } } -void sub_080A9A64(Entity* this) { +void StalfosProjectile_OnGrabbed(Entity* this) { if ((this->subAction < 3) && !sub_0806F520(this)) { sub_080A9BA8(this); } @@ -185,7 +192,8 @@ void sub_080A9C50(Entity* this) { } void (*const StalfosProjectile_Functions[])(Entity*) = { - StalfosProjectile_OnTick, sub_080A9A34, DeleteEntity, DeleteEntity, DeleteEntity, sub_080A9A64, + StalfosProjectile_OnTick, StalfosProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, + StalfosProjectile_OnGrabbed, }; void (*const StalfosProjectile_Actions[])(Entity*) = { StalfosProjectile_Init, diff --git a/src/projectile/torchTrapProjectile.c b/src/projectile/torchTrapProjectile.c index a42eee74..a1c95101 100644 --- a/src/projectile/torchTrapProjectile.c +++ b/src/projectile/torchTrapProjectile.c @@ -1,6 +1,13 @@ -#include "entity.h" +/** + * @file torchTrapProjectile.c + * @ingroup Projectiles + * + * @brief Torch Trap Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const TorchTrapProjectile_Functions[])(Entity*); @@ -14,7 +21,7 @@ void TorchTrapProjectile_OnTick(Entity* this) { TorchTrapProjectile_Actions[this->action](this); } -void sub_080AAB1C(Entity* this) { +void TorchTrapProjectile_OnCollision(Entity* this) { DeleteThisEntity(); } @@ -49,7 +56,7 @@ void TorchTrapProjectile_Action2(Entity* this) { } void (*const TorchTrapProjectile_Functions[])(Entity*) = { - TorchTrapProjectile_OnTick, sub_080AAB1C, DeleteEntity, DeleteEntity, DeleteEntity, + TorchTrapProjectile_OnTick, TorchTrapProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; void (*const TorchTrapProjectile_Actions[])(Entity*) = { TorchTrapProjectile_Init, diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index 6bf78af5..eabc0260 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -1,96 +1,115 @@ -#include "entity.h" +/** + * @file v1DarkMagicProjectile.c + * @ingroup Projectiles + * + * @brief V1 Dark Magic Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" +#include "functions.h" #include "physics.h" #include "player.h" -#include "functions.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unused2[11]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x92*/ u8 unused3[2]; + /*0x84*/ u16 unk_84; + /*0x86*/ u8 unk_86; +} V1DarkMagicProjectileEntity; extern void SoundReqClipped(Entity*, u32); -extern void (*const V1DarkMagicProjectile_Functions[])(Entity*); -extern void (*const V1DarkMagicProjectile_Actions[])(Entity*); +extern void (*const V1DarkMagicProjectile_Functions[])(V1DarkMagicProjectileEntity*); +extern void (*const V1DarkMagicProjectile_Actions[])(V1DarkMagicProjectileEntity*); extern void (*const V1DarkMagicProjectile_SubActions[])(Entity*); -void sub_080AAF74(Entity*); +void sub_080AAF74(V1DarkMagicProjectileEntity*); void sub_080AB034(Entity*); -void V1DarkMagicProjectile(Entity* this) { - V1DarkMagicProjectile_Functions[GetNextFunction(this)](this); +void V1DarkMagicProjectile(V1DarkMagicProjectileEntity* this) { + V1DarkMagicProjectile_Functions[GetNextFunction(super)](this); } -void V1DarkMagicProjectile_OnTick(Entity* this) { - V1DarkMagicProjectile_Actions[this->action](this); - if ((this->type2 == 0) && (--this->cutsceneBeh.HWORD == 0)) { - this->health = 0; +void V1DarkMagicProjectile_OnTick(V1DarkMagicProjectileEntity* this) { + V1DarkMagicProjectile_Actions[super->action](this); + if ((super->type2 == 0) && (--this->unk_84 == 0)) { + super->health = 0; } } -void sub_080AAC44(Entity* this) { - if ((this->contactFlags & 0x80) != 0) { - if (this->type2 == 0) { - if ((this->contactFlags & 0x3f) == 0) { - this->action = 2; - COLLISION_OFF(this); - if (this->type == 0) { - SortEntityAbove(&gPlayerEntity, this); +void V1DarkMagicProjectile_OnCollision(V1DarkMagicProjectileEntity* this) { + if ((super->contactFlags & 0x80) != 0) { + if (super->type2 == 0) { + if ((super->contactFlags & 0x3f) == 0) { + super->action = 2; + COLLISION_OFF(super); + if (super->type == 0) { + SortEntityAbove(&gPlayerEntity, super); } else { - SortEntityAbove(this->parent, this); + SortEntityAbove(super->parent, super); } ResetActiveItems(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; } if (gPlayerEntity.health == 0) { - this->health = 0; + super->health = 0; } } else { SoundReq(SFX_ITEM_GLOVES_KNOCKBACK); - CopyPosition(this->parent, this); + CopyPosition(super->parent, super); } } - if (this->knockbackDuration != 0) { - this->knockbackDuration = 0; + if (super->knockbackDuration != 0) { + super->knockbackDuration = 0; } } -void sub_080AACE0(Entity* this) { - Entity* parent; - if (this->type && this->type2) { +void V1DarkMagicProjectile_OnDeath(V1DarkMagicProjectileEntity* this) { + V1DarkMagicProjectileEntity* parent; + if (super->type && super->type2) { DeleteThisEntity(); } - if (this->spriteSettings.draw == 1) { - this->spriteSettings.draw = 0; - this->field_0x86.HALF.LO = 1; - CreateFx(this, FX_DEATH, 0); + if (super->spriteSettings.draw == 1) { + super->spriteSettings.draw = 0; + this->unk_86 = 1; + CreateFx(super, FX_DEATH, 0); } - parent = this->parent; - if (this->type2 == 0) { - u8* ptr = &(parent->field_0x74.HALF.LO); - parent->field_0x74.HALF.LO = 3; - parent->field_0x80.HALF.LO += this->field_0x80.HALF.HI >> 1; - if (parent->field_0x80.HALF.LO > 8) { - parent->field_0x80.HALF.LO = 8; - } else if (parent->field_0x80.HALF.LO == 0) { - parent->field_0x80.HALF.LO = 1; + parent = (V1DarkMagicProjectileEntity*)super->parent; + if (super->type2 == 0) { + u8* ptr = &(parent->unk_74); + parent->unk_74 = 3; + parent->unk_80 += this->unk_81 >> 1; + if (parent->unk_80 > 8) { + parent->unk_80 = 8; + } else if (parent->unk_80 == 0) { + parent->unk_80 = 1; } } else { - parent->cutsceneBeh.HALF.LO = 0; - parent->hitType = 0x2b; + *(u8*)&parent->unk_84 = 0; + parent->base.hitType = 0x2b; } - if (this->field_0x86.HALF.LO == 0) { - CreateFx(this, FX_DEATH, 0); + if (this->unk_86 == 0) { + CreateFx(super, FX_DEATH, 0); } DeleteThisEntity(); } -void sub_080AAD70(Entity* this) { - if (!sub_0806F520(this)) { - this->health = 0; +void V1DarkMagicProjectile_OnGrabbed(V1DarkMagicProjectileEntity* this) { + if (!sub_0806F520(super)) { + super->health = 0; } - V1DarkMagicProjectile_SubActions[this->subAction](this); + V1DarkMagicProjectile_SubActions[super->subAction](super); } void V1DarkMagicProjectile_SubAction0(Entity* this) { @@ -106,120 +125,120 @@ void V1DarkMagicProjectile_SubAction2(Entity* this) { } } -void V1DarkMagicProjectile_Init(Entity* this) { +void V1DarkMagicProjectile_Init(V1DarkMagicProjectileEntity* this) { Entity* entity; - if (this->type2 == 0) { - this->action = 1; + if (super->type2 == 0) { + super->action = 1; } else { - this->action = 3; - this->hitType = 0x2c; - SortEntityAbove(this->parent, this); + super->action = 3; + super->hitType = 0x2c; + SortEntityAbove(super->parent, super); } - if (this->type == 0) { - this->timer = 0; - this->subtimer = 4; - this->field_0x80.HALF.LO = 0; - this->field_0x80.HALF.HI = 0; - this->health = 0x10; - this->z.HALF.HI += 4; - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 1; - this->spritePriority.b0 = 4; - this->direction = GetFacingDirection(this, &gPlayerEntity); - this->field_0x86.HALF.LO = 0; - this->cutsceneBeh.HWORD = 300; + if (super->type == 0) { + super->timer = 0; + super->subtimer = 4; + this->unk_80 = 0; + this->unk_81 = 0; + super->health = 0x10; + super->z.HALF.HI += 4; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; + super->spritePriority.b0 = 4; + super->direction = GetFacingDirection(super, &gPlayerEntity); + this->unk_86 = 0; + this->unk_84 = 300; entity = CreateProjectile(V1_DARK_MAGIC_PROJECTILE); if (entity != NULL) { entity->type = 1; - entity->type2 = this->type2; - entity->parent = this; + entity->type2 = super->type2; + entity->parent = super; } } else { - SortEntityAbove(this->parent, this); - COLLISION_OFF(this); - CopyPosition(this->parent, this); + SortEntityAbove(super->parent, super); + COLLISION_OFF(super); + CopyPosition(super->parent, super); } - InitializeAnimation(this, this->type); + InitializeAnimation(super, super->type); } -void V1DarkMagicProjectile_Action1(Entity* this) { +void V1DarkMagicProjectile_Action1(V1DarkMagicProjectileEntity* this) { u8 bVar1; u32 uVar2; - switch (this->type) { + switch (super->type) { case 0: - if (--this->subtimer == 0) { - this->subtimer = 4; - uVar2 = GetFacingDirection(this, &gPlayerEntity); - sub_08004596(this, uVar2); + if (--super->subtimer == 0) { + super->subtimer = 4; + uVar2 = GetFacingDirection(super, &gPlayerEntity); + sub_08004596(super, uVar2); } - LinearMoveUpdate(this); + LinearMoveUpdate(super); break; case 1: - if ((this->parent == NULL) || (this->parent->next == NULL)) { + if ((super->parent == NULL) || (super->parent->next == NULL)) { DeleteThisEntity(); } case 2: - if (this->parent->spriteSettings.draw == 0) { + if (super->parent->spriteSettings.draw == 0) { DeleteThisEntity(); } - CopyPosition(this->parent, this); + CopyPosition(super->parent, super); break; } - sub_080AB034(this); + sub_080AB034(super); } -void V1DarkMagicProjectile_Action2(Entity* this) { +void V1DarkMagicProjectile_Action2(V1DarkMagicProjectileEntity* this) { sub_080AAF74(this); - sub_080AB034(this); + sub_080AB034(super); } -void V1DarkMagicProjectile_Action3(Entity* this) { - CopyPosition(this->parent, this); - sub_080AB034(this); - this->spriteSettings.draw = this->parent->spriteSettings.draw; - if (this->type != 0) { - this->health = this->parent->health; +void V1DarkMagicProjectile_Action3(V1DarkMagicProjectileEntity* this) { + CopyPosition(super->parent, super); + sub_080AB034(super); + super->spriteSettings.draw = super->parent->spriteSettings.draw; + if (super->type != 0) { + super->health = super->parent->health; } #ifndef EU - if (this->parent->action == 2) { - if ((this->flags & ENT_COLLIDE) != 0) { - COLLISION_OFF(this); + if (super->parent->action == 2) { + if ((super->flags & ENT_COLLIDE) != 0) { + COLLISION_OFF(super); } } else { - if ((this->flags & ENT_COLLIDE) == 0) { - COLLISION_ON(this); + if ((super->flags & ENT_COLLIDE) == 0) { + COLLISION_ON(super); } } #endif } -void sub_080AAF74(Entity* this) { +void sub_080AAF74(V1DarkMagicProjectileEntity* this) { if (sub_0807953C() != 0) { - this->field_0x80.HALF.LO += (Random() & 1) + 1; + this->unk_80 += (Random() & 1) + 1; } - if (++this->timer == 0x3c) { - this->timer = 30; + if (++super->timer == 0x3c) { + super->timer = 30; gPlayerEntity.iframes = 8; ModHealth(-4); SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); if (gPlayerEntity.health == 0) { - this->health = 0; + super->health = 0; } } - if (!((this->field_0x80.HALF.LO < 0x31) && (this->field_0x80.HALF.HI != 0x10))) { - this->action = 1; - this->field_0x80.HALF.LO = 0; + if (!((this->unk_80 < 0x31) && (this->unk_81 != 0x10))) { + super->action = 1; + this->unk_80 = 0; gPlayerEntity.iframes = 0xf0; gPlayerState.mobility = 0; - this->health = 0; + super->health = 0; } else { ResetActiveItems(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; - CopyPosition(&gPlayerEntity, this); - this->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4; + CopyPosition(&gPlayerEntity, super); + super->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4; } } @@ -235,10 +254,15 @@ void sub_080AB034(Entity* this) { ChangeObjPalette(this, tmp); } -void (*const V1DarkMagicProjectile_Functions[])(Entity*) = { - V1DarkMagicProjectile_OnTick, sub_080AAC44, DeleteEntity, sub_080AACE0, DeleteEntity, sub_080AAD70, +void (*const V1DarkMagicProjectile_Functions[])(V1DarkMagicProjectileEntity*) = { + V1DarkMagicProjectile_OnTick, + V1DarkMagicProjectile_OnCollision, + (void (*)(V1DarkMagicProjectileEntity*))DeleteEntity, + V1DarkMagicProjectile_OnDeath, + (void (*)(V1DarkMagicProjectileEntity*))DeleteEntity, + V1DarkMagicProjectile_OnGrabbed, }; -void (*const V1DarkMagicProjectile_Actions[])(Entity*) = { +void (*const V1DarkMagicProjectile_Actions[])(V1DarkMagicProjectileEntity*) = { V1DarkMagicProjectile_Init, V1DarkMagicProjectile_Action1, V1DarkMagicProjectile_Action2, diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c index a94c71bb..0dacce08 100644 --- a/src/projectile/v1EyeLaser.c +++ b/src/projectile/v1EyeLaser.c @@ -1,8 +1,21 @@ +/** + * @file v1EyeLaser.c + * @ingroup Projectiles + * + * @brief V1 Eye Laser Projectile + */ +#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "projectile.h" -extern void (*const V1EyeLaser_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u32 unk_74; +} V1EyeLaserEntity; + +extern void (*const V1EyeLaser_Actions[])(V1EyeLaserEntity*); extern const Hitbox* const gUnk_0812A5F4[]; extern const Hitbox gUnk_0812A614; extern const Hitbox gUnk_0812A61C; @@ -11,42 +24,42 @@ void sub_080AB758(Entity*); void sub_080AB888(Entity*); void sub_080AB844(Entity* this, s32 param_1, s32 param_2); -void V1EyeLaser(Entity* this) { - if (this->parent->spriteSettings.draw == 0) { +void V1EyeLaser(V1EyeLaserEntity* this) { + if (super->parent->spriteSettings.draw == 0) { DeleteThisEntity(); } - V1EyeLaser_Actions[this->action](this); + V1EyeLaser_Actions[super->action](this); } -void V1EyeLaser_Init(Entity* this) { - *(u32*)&this->field_0x74 = this->parent->x.WORD; - if (this->type == 0) { - this->action = 1; - COLLISION_OFF(this); - this->hitbox = (Hitbox*)&gUnk_0812A614; - InitializeAnimation(this, 0); +void V1EyeLaser_Init(V1EyeLaserEntity* this) { + this->unk_74 = super->parent->x.WORD; + if (super->type == 0) { + super->action = 1; + COLLISION_OFF(super); + super->hitbox = (Hitbox*)&gUnk_0812A614; + InitializeAnimation(super, 0); } else { - this->action = 2; - this->subtimer = 4; - InitializeAnimation(this, this->timer); + super->action = 2; + super->subtimer = 4; + InitializeAnimation(super, super->timer); } } -void V1EyeLaser_Action1(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 2; - InitializeAnimation(this, 1); - sub_080AB758(this); +void V1EyeLaser_Action1(V1EyeLaserEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 2; + InitializeAnimation(super, 1); + sub_080AB758(super); } } -void V1EyeLaser_Action2(Entity* this) { - GetNextFrame(this); - this->x.WORD += (this->parent->x.WORD - *(u32*)&this->field_0x74); - *(u32*)&this->field_0x74 = this->parent->x.WORD; - sub_080AB888(this); - if (this->parent->subtimer == 0) { +void V1EyeLaser_Action2(V1EyeLaserEntity* this) { + GetNextFrame(super); + super->x.WORD += (super->parent->x.WORD - this->unk_74); + this->unk_74 = super->parent->x.WORD; + sub_080AB888(super); + if (super->parent->subtimer == 0) { DeleteThisEntity(); } } @@ -128,7 +141,7 @@ void sub_080AB888(Entity* this) { } } -void (*const V1EyeLaser_Actions[])(Entity*) = { +void (*const V1EyeLaser_Actions[])(V1EyeLaserEntity*) = { V1EyeLaser_Init, V1EyeLaser_Action1, V1EyeLaser_Action2, diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c index 7183f2b7..a8404fab 100644 --- a/src/projectile/v1FireProjectile.c +++ b/src/projectile/v1FireProjectile.c @@ -1,54 +1,67 @@ -#include "entity.h" +/** + * @file v1FireProjectile.c + * @ingroup Projectiles + * + * @brief V1 Fire Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" -#include "player.h" +#include "entity.h" #include "functions.h" +#include "player.h" -extern void (*const V1FireProjectile_Functions[])(Entity*); -extern void (*const V1FireProjectile_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[14]; + /*0x76*/ u16 unk_76; +} V1FireProjectileEntity; + +extern void (*const V1FireProjectile_Functions[])(V1FireProjectileEntity*); +extern void (*const V1FireProjectile_Actions[])(V1FireProjectileEntity*); extern const s8 gUnk_0812A4EC[]; -void sub_080AB4A4(Entity*); +void sub_080AB4A4(V1FireProjectileEntity*); s8* sub_080AB4F8(Entity*); -void V1FireProjectile(Entity* this) { - V1FireProjectile_Functions[GetNextFunction(this)](this); +void V1FireProjectile(V1FireProjectileEntity* this) { + V1FireProjectile_Functions[GetNextFunction(super)](this); } -void V1FireProjectile_OnTick(Entity* this) { - V1FireProjectile_Actions[this->action](this); +void V1FireProjectile_OnTick(V1FireProjectileEntity* this) { + V1FireProjectile_Actions[super->action](this); } -void sub_080AB2DC(Entity* this) { - if ((this->contactFlags & 0x80) != 0) { - this->action = 3; - COLLISION_OFF(this); - InitializeAnimation(this, 0x53); - if ((this->contactFlags & 0x7f) == 0) { +void V1FireProjectile_OnCollision(V1FireProjectileEntity* this) { + if ((super->contactFlags & 0x80) != 0) { + super->action = 3; + COLLISION_OFF(super); + InitializeAnimation(super, 0x53); + if ((super->contactFlags & 0x7f) == 0) { ModHealth(-4); } } } -void V1FireProjectile_Init(Entity* this) { +void V1FireProjectile_Init(V1FireProjectileEntity* this) { s32 iVar2; u32 rnd; u32 x; u32 y; s8* data; - this->action = 1; - this->zVelocity = Q_16_16(-1.0); - this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - CopyPosition(this->parent, this); - LinearMoveDirection(this, 0x1000, this->direction); - this->spritePriority.b0 = 1; - this->z = this->parent->z; - InitializeAnimation(this, 0x51); + super->action = 1; + super->zVelocity = Q_16_16(-1.0); + this->unk_76 = TILE(super->x.HALF.HI, super->y.HALF.HI); + CopyPosition(super->parent, super); + LinearMoveDirection(super, 0x1000, super->direction); + super->spritePriority.b0 = 1; + super->z = super->parent->z; + InitializeAnimation(super, 0x51); SoundReq(SFX_1B5); - data = sub_080AB4F8(this); - x = this->x.HALF.HI + data[0]; - y = this->y.HALF.HI + data[1]; - iVar2 = sub_080041DC(this, x, y); + data = sub_080AB4F8(super); + x = super->x.HALF.HI + data[0]; + y = super->y.HALF.HI + data[1]; + iVar2 = sub_080041DC(super, x, y); rnd = Random() & 0x1ff; if ((gRoomTransition.frameCount & 1U) != 0) { @@ -63,54 +76,54 @@ void V1FireProjectile_Init(Entity* this) { iVar2 = 0x20; } } - this->zVelocity = (this->z.WORD / (iVar2 << 8)) << 0xd; + super->zVelocity = (super->z.WORD / (iVar2 << 8)) << 0xd; - this->direction = sub_080045B4(this, x, y); + super->direction = sub_080045B4(super, x, y); } -void V1FireProjectile_Action1(Entity* this) { - GetNextFrame(this); - LinearMoveUpdate(this); - if (GravityUpdate(this, 0) == 0) { - this->action = 2; - this->timer = 15; - InitializeAnimation(this, 0x54); +void V1FireProjectile_Action1(V1FireProjectileEntity* this) { + GetNextFrame(super); + LinearMoveUpdate(super); + if (GravityUpdate(super, 0) == 0) { + super->action = 2; + super->timer = 15; + InitializeAnimation(super, 0x54); sub_080AB4A4(this); } else { - if (++this->timer > 0xe0) { + if (++super->timer > 0xe0) { DeleteThisEntity(); } } } -void V1FireProjectile_Action2(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 3; - COLLISION_OFF(this); - InitializeAnimation(this, 0x53); +void V1FireProjectile_Action2(V1FireProjectileEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 3; + COLLISION_OFF(super); + InitializeAnimation(super, 0x53); } } -void V1FireProjectile_Action3(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { +void V1FireProjectile_Action3(V1FireProjectileEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } -void sub_080AB4A4(Entity* this) { +void sub_080AB4A4(V1FireProjectileEntity* this) { u32 tmp; u16 tile; - tmp = this->field_0x76.HWORD; - tile = TILE(this->x.HALF.HI, this->y.HALF.HI); + tmp = this->unk_76; + tile = TILE(super->x.HALF.HI, super->y.HALF.HI); if (tmp != tile) { - this->field_0x76.HWORD = tile; - switch (GetMetaTileTypeByEntity(this)) { + this->unk_76 = tile; + switch (GetMetaTileTypeByEntity(super)) { case 0x13: case 0x34: - sub_0807B7D8(0x34c, this->field_0x76.HWORD, this->collisionLayer); + sub_0807B7D8(0x34c, this->unk_76, super->collisionLayer); break; } } @@ -120,10 +133,14 @@ s8* sub_080AB4F8(Entity* this) { return (s8*)&gUnk_0812A4EC[this->type << 5 | this->subtimer << 1]; } -void (*const V1FireProjectile_Functions[])(Entity*) = { - V1FireProjectile_OnTick, sub_080AB2DC, DeleteEntity, DeleteEntity, DeleteEntity, +void (*const V1FireProjectile_Functions[])(V1FireProjectileEntity*) = { + V1FireProjectile_OnTick, + V1FireProjectile_OnCollision, + (void (*)(V1FireProjectileEntity*))DeleteEntity, + (void (*)(V1FireProjectileEntity*))DeleteEntity, + (void (*)(V1FireProjectileEntity*))DeleteEntity, }; -void (*const V1FireProjectile_Actions[])(Entity*) = { +void (*const V1FireProjectile_Actions[])(V1FireProjectileEntity*) = { V1FireProjectile_Init, V1FireProjectile_Action1, V1FireProjectile_Action2, diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index 2bea1469..b8062ac8 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -1,50 +1,63 @@ - +/** + * @file v2Projectile.c + * @ingroup Projectiles + * + * @brief V2 Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" #include "object.h" #include "tiles.h" -extern void (*const V2Projectile_Functions[])(Entity*); -extern void (*const gUnk_0812A7EC[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; +} V2ProjectileEntity; + +extern void (*const V2Projectile_Functions[])(V2ProjectileEntity*); +extern void (*const gUnk_0812A7EC[])(V2ProjectileEntity*); extern void (*const gUnk_0812A7F8[])(Entity*); extern void (*const gUnk_0812A800[])(Entity*); extern void (*const gUnk_0812A808[])(Entity*); -void V2Projectile(Entity* this) { - V2Projectile_Functions[GetNextFunction(this)](this); +void V2Projectile(V2ProjectileEntity* this) { + V2Projectile_Functions[GetNextFunction(super)](this); } -void sub_080ABBA8(Entity* this) { - switch (this->type) { +void V2Projectile_OnTick(V2ProjectileEntity* this) { + switch (super->type) { case 0: { - gUnk_0812A7EC[this->action](this); + gUnk_0812A7EC[super->action](this); break; } case 1: { - gUnk_0812A7F8[this->action](this); + gUnk_0812A7F8[super->action](super); break; } case 2: default: - gUnk_0812A800[this->action](this); + gUnk_0812A800[super->action](super); } } -void sub_080ABBF4(Entity* this) { - if ((this->contactFlags & 0x80) == 0) +void V2Projectile_OnCollision(V2ProjectileEntity* this) { + if ((super->contactFlags & 0x80) == 0) return; - switch (this->type) { + switch (super->type) { case 2: { - switch ((this->contactFlags & 0x3f)) { + switch ((super->contactFlags & 0x3f)) { case 0: { ModHealth(-4); // fallthrough } case 3: case 0x14: { - CreateDust(this); + CreateDust(super); DeleteThisEntity(); break; } @@ -53,7 +66,7 @@ void sub_080ABBF4(Entity* this) { } case 0: case 1: { - if ((this->contactFlags & 0x3f) == 0) { + if ((super->contactFlags & 0x3f) == 0) { ModHealth(-2); DeleteThisEntity(); } @@ -62,12 +75,12 @@ void sub_080ABBF4(Entity* this) { } } -void sub_080ABC54(Entity* this) { - if (!sub_0806F520(this)) { - CreateFx(this, FX_DEATH, 0); +void V2Projectile_OnGrabbed(V2ProjectileEntity* this) { + if (!sub_0806F520(super)) { + CreateFx(super, FX_DEATH, 0); DeleteThisEntity(); } - gUnk_0812A808[this->subAction](this); + gUnk_0812A808[super->subAction](super); } void sub_080ABC84(Entity* this) { @@ -87,45 +100,45 @@ void sub_080ABC90(Entity* this) { } } -void sub_080ABCC4(Entity* this) { - this->action = 1; - this->timer = (Random() & 0x3f) + 48; - this->subtimer = 0; - this->direction = Random() & 0x1f; - this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - this->field_0x76.HWORD = GetMetaTileType(this->field_0x74.HWORD, LAYER_TOP); - this->spritePriority.b0 = 2; - InitializeAnimation(this, 0); +void sub_080ABCC4(V2ProjectileEntity* this) { + super->action = 1; + super->timer = (Random() & 0x3f) + 48; + super->subtimer = 0; + super->direction = Random() & 0x1f; + this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI); + this->unk_76 = GetMetaTileType(this->unk_74, LAYER_TOP); + super->spritePriority.b0 = 2; + InitializeAnimation(super, 0); SoundReq(SFX_14B); } -void sub_080ABD44(Entity* this) { - if (--this->timer == 0) { - this->action = 2; - InitializeAnimation(this, 1); +void sub_080ABD44(V2ProjectileEntity* this) { + if (--super->timer == 0) { + super->action = 2; + InitializeAnimation(super, 1); } - ProcessMovement3(this); - GetNextFrame(this); + ProcessMovement3(super); + GetNextFrame(super); } -void sub_080ABD70(Entity* this) { +void sub_080ABD70(V2ProjectileEntity* this) { u32 tmp; - GetNextFrame(this); - if ((this->frame & 0x10) != 0) { - this->frame &= 0xef; - this->speed = 0; - this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - this->field_0x76.HWORD = GetMetaTileType(this->field_0x74.HWORD, LAYER_TOP); - tmp = this->field_0x76.HWORD; + GetNextFrame(super); + if ((super->frame & 0x10) != 0) { + super->frame &= 0xef; + super->speed = 0; + this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI); + this->unk_76 = GetMetaTileType(this->unk_74, LAYER_TOP); + tmp = this->unk_76; if (tmp != 0x13) { if (tmp == 0x315) { - SetMetaTileType(META_TILE_TYPE_110, this->field_0x74.HWORD, LAYER_TOP); + SetMetaTileType(META_TILE_TYPE_110, this->unk_74, LAYER_TOP); } } else { - SetMetaTileType(META_TILE_TYPE_109, this->field_0x74.HWORD, LAYER_TOP); + SetMetaTileType(META_TILE_TYPE_109, this->unk_74, LAYER_TOP); } } - if ((this->frame & ANIM_DONE) != 0) { + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } @@ -181,10 +194,15 @@ void sub_080ABF04(Entity* this) { GetNextFrame(this); } -void (*const V2Projectile_Functions[])(Entity*) = { - sub_080ABBA8, sub_080ABBF4, DeleteEntity, DeleteEntity, DeleteEntity, sub_080ABC54, +void (*const V2Projectile_Functions[])(V2ProjectileEntity*) = { + V2Projectile_OnTick, + V2Projectile_OnCollision, + (void (*)(V2ProjectileEntity*))DeleteEntity, + (void (*)(V2ProjectileEntity*))DeleteEntity, + (void (*)(V2ProjectileEntity*))DeleteEntity, + V2Projectile_OnGrabbed, }; -void (*const gUnk_0812A7EC[])(Entity*) = { +void (*const gUnk_0812A7EC[])(V2ProjectileEntity*) = { sub_080ABCC4, sub_080ABD44, sub_080ABD70, diff --git a/src/projectile/v3ElectricProjectile.c b/src/projectile/v3ElectricProjectile.c index beec1f6a..ccb207fb 100644 --- a/src/projectile/v3ElectricProjectile.c +++ b/src/projectile/v3ElectricProjectile.c @@ -1,59 +1,73 @@ -#include "entity.h" +/** + * @file v3ElectricProjectile.c + * @ingroup Projectiles + * + * @brief V3 Electric Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" -#include "player.h" -#include "physics.h" +#include "entity.h" #include "functions.h" +#include "physics.h" +#include "player.h" -extern void (*const V3ElectricProjectile_Functions[])(Entity*); -extern void (*const V3ElectricProjectile_Actions[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unk_85; +} V3ElectricProjectileEntity; + +extern void (*const V3ElectricProjectile_Functions[])(V3ElectricProjectileEntity*); +extern void (*const V3ElectricProjectile_Actions[])(V3ElectricProjectileEntity*); static const u16 projectileSpeeds[]; static const u8 gUnk_0812A982[]; static const u8 projectileDirections[]; -void V3ElectricProjectile(Entity* this) { - V3ElectricProjectile_Functions[GetNextFunction(this)](this); +void V3ElectricProjectile(V3ElectricProjectileEntity* this) { + V3ElectricProjectile_Functions[GetNextFunction(super)](this); } -void V3ElectricProjectile_OnTick(Entity* this) { - V3ElectricProjectile_Actions[this->action](this); +void V3ElectricProjectile_OnTick(V3ElectricProjectileEntity* this) { + V3ElectricProjectile_Actions[super->action](this); } -void sub_080ABFE4(Entity* this) { +void V3ElectricProjectile_OnCollision(V3ElectricProjectileEntity* this) { DeleteThisEntity(); } -void sub_080ABFEC(Entity* this) { +void V3ElectricProjectile_Init(V3ElectricProjectileEntity* this) { Sound sound; - InitializeAnimation(this, this->type + 1); + InitializeAnimation(super, super->type + 1); - switch (this->type) { + switch (super->type) { case 0: { - this->action = 1; - this->timer = 0; - this->subtimer = 7; - this->cutsceneBeh.HALF.HI = 0x18; - this->damage = 0x88; - CopyPositionAndSpriteOffset(this->parent, this); - this->z.HALF.HI -= 0x14; + super->action = 1; + super->timer = 0; + super->subtimer = 7; + this->unk_85 = 0x18; + super->damage = 0x88; + CopyPositionAndSpriteOffset(super->parent, super); + super->z.HALF.HI -= 0x14; sound = SFX_149; break; } case 1: { - this->action = 1; - this->flags &= ~ENT_COLLIDE; - this->cutsceneBeh.HALF.HI = 0x18; - CopyPositionAndSpriteOffset(this->parent, this); - this->z.HALF.HI -= 0x14; + super->action = 1; + super->flags &= ~ENT_COLLIDE; + this->unk_85 = 0x18; + CopyPositionAndSpriteOffset(super->parent, super); + super->z.HALF.HI -= 0x14; sound = SFX_149; break; } default: { - this->action = 2; - this->timer = 0; - this->subtimer = 255; - this->speed = projectileSpeeds[this->type2]; - this->damage = 0x88; + super->action = 2; + super->timer = 0; + super->subtimer = 255; + super->speed = projectileSpeeds[super->type2]; + super->damage = 0x88; sound = SFX_193; break; } @@ -62,119 +76,124 @@ void sub_080ABFEC(Entity* this) { SoundReq(sound); } -void V3ElectricProjectile_Action1(Entity* this) { - if (this->parent->next == NULL) { +void V3ElectricProjectile_Action1(V3ElectricProjectileEntity* this) { + if (super->parent->next == NULL) { DeleteThisEntity(); } - CopyPositionAndSpriteOffset(this->parent, this); - this->z.HALF.HI -= 0x14; - if (this->cutsceneBeh.HALF.HI != 0) { - if (((--this->cutsceneBeh.HALF.HI) & 7) == 0) { + CopyPositionAndSpriteOffset(super->parent, super); + super->z.HALF.HI -= 0x14; + if (this->unk_85 != 0) { + if (((--this->unk_85) & 7) == 0) { SoundReq(SFX_149); } } - GetNextFrame(this); - if ((this->frame & 1) != 0) { - if (this->type == 0) { - this->action = 2; - this->direction = GetFacingDirection(this, &gPlayerEntity); - this->speed = 0x180; + GetNextFrame(super); + if ((super->frame & 1) != 0) { + if (super->type == 0) { + super->action = 2; + super->direction = GetFacingDirection(super, &gPlayerEntity); + super->speed = 0x180; SoundReq(SFX_193); } else { - this->action = 3; - this->timer = 16; + super->action = 3; + super->timer = 16; } - this->z.HALF.HI -= 0x28; + super->z.HALF.HI -= 0x28; } } -void V3ElectricProjectile_Action2(Entity* this) { +void V3ElectricProjectile_Action2(V3ElectricProjectileEntity* this) { u8 bVar1; s32 iVar2; u32 uVar3; - if (this->z.HALF.HI < -6) { - this->z.HALF.HI += 3; + if (super->z.HALF.HI < -6) { + super->z.HALF.HI += 3; } - ProcessMovement3(this); - if (this->collisions != COL_NONE) { + ProcessMovement3(super); + if (super->collisions != COL_NONE) { DeleteThisEntity(); } - GetNextFrame(this); - if (IsProjectileOffScreen(this)) { + GetNextFrame(super); + if (IsProjectileOffScreen(super)) { DeleteThisEntity(); } - if (this->timer < 0x1e) { - if (((++this->timer) & this->subtimer) == 0) { - sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); + if (super->timer < 0x1e) { + if (((++super->timer) & super->subtimer) == 0) { + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); } } } -void sub_080AC168(Entity* this) { +void V3ElectricProjectile_Action3(V3ElectricProjectileEntity* this) { u8 timer; - GetNextFrame(this); - this->z.WORD -= Q_16_16(0.5); - timer = --this->timer; + GetNextFrame(super); + super->z.WORD -= Q_16_16(0.5); + timer = --super->timer; if (timer == 0) { u32 rand; u32 dir; - this->action = 4; - this->timer = 4; + super->action = 4; + super->timer = 4; rand = Random() & 0x7; - this->subtimer = gUnk_0812A982[rand]; - dir = GetFacingDirection(this, &gPlayerEntity); - if (this->parent->cutsceneBeh.HALF.LO == 3) { + super->subtimer = gUnk_0812A982[rand]; + dir = GetFacingDirection(super, &gPlayerEntity); + if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 3) { dir -= projectileDirections[rand]; - this->type2 = 0; - } else if (this->parent->cutsceneBeh.HALF.LO == 2) { + super->type2 = 0; + } else if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 2) { dir -= projectileDirections[rand]; - this->type2 = 1; + super->type2 = 1; } else { dir -= projectileDirections[rand] >> 1; - this->type2 = 2; + super->type2 = 2; } - this->direction = dir & 0x1f; + super->direction = dir & 0x1f; } } -void sub_080AC200(Entity* this) { +void V3ElectricProjectile_Action4(V3ElectricProjectileEntity* this) { Entity* proj; - GetNextFrame(this); + GetNextFrame(super); - if (--this->timer) + if (--super->timer) return; - this->timer = 16; + super->timer = 16; proj = CreateProjectile(V3_ELECTRIC_PROJECTILE); if (proj) { proj->type = 2; - proj->type2 = this->type2; - proj->direction = this->direction; - proj->parent = this->parent; - CopyPosition(this, proj); + proj->type2 = super->type2; + proj->direction = super->direction; + proj->parent = super->parent; + CopyPosition(super, proj); } - if (--this->subtimer == 0) { + if (--super->subtimer == 0) { DeleteThisEntity(); } - if (this->parent->cutsceneBeh.HALF.LO == 3) { - this->direction = (this->direction + 3) & 0x1f; - } else if (this->parent->cutsceneBeh.HALF.LO == 2) { - this->direction = (this->direction + 3) & 0x1f; + if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 3) { + super->direction = (super->direction + 3) & 0x1f; + } else if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 2) { + super->direction = (super->direction + 3) & 0x1f; } else { - this->direction = (this->direction + 2) & 0x1f; + super->direction = (super->direction + 2) & 0x1f; } } -void (*const V3ElectricProjectile_Functions[])(Entity*) = { - V3ElectricProjectile_OnTick, sub_080ABFE4, DeleteEntity, DeleteEntity, DeleteEntity, +void (*const V3ElectricProjectile_Functions[])(V3ElectricProjectileEntity*) = { + V3ElectricProjectile_OnTick, + V3ElectricProjectile_OnCollision, + (void (*)(V3ElectricProjectileEntity*))DeleteEntity, + (void (*)(V3ElectricProjectileEntity*))DeleteEntity, + (void (*)(V3ElectricProjectileEntity*))DeleteEntity, }; -void (*const V3ElectricProjectile_Actions[])(Entity*) = { - sub_080ABFEC, V3ElectricProjectile_Action1, V3ElectricProjectile_Action2, sub_080AC168, sub_080AC200, +void (*const V3ElectricProjectile_Actions[])(V3ElectricProjectileEntity*) = { + V3ElectricProjectile_Init, V3ElectricProjectile_Action1, V3ElectricProjectile_Action2, + V3ElectricProjectile_Action3, V3ElectricProjectile_Action4, }; static const u16 projectileSpeeds[] = { 352, 480, 480 }; static const u8 gUnk_0812A982[] = { diff --git a/src/projectile/v3HandProjectile.c b/src/projectile/v3HandProjectile.c index ce11e1ef..e95e05f5 100644 --- a/src/projectile/v3HandProjectile.c +++ b/src/projectile/v3HandProjectile.c @@ -1,8 +1,15 @@ -#include "entity.h" +/** + * @file v3HandProjectile.c + * @ingroup Projectiles + * + * @brief V3 Hand Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" -#include "player.h" +#include "entity.h" #include "functions.h" +#include "player.h" extern void (*const V3HandProjectile_Functions[])(Entity*); @@ -30,10 +37,10 @@ void V3HandProjectile_OnTick(Entity* this) { } } -void sub_080ABFA8(Entity* this) { +void V3HandProjectile_OnCollision(Entity* this) { DeleteThisEntity(); } void (*const V3HandProjectile_Functions[])(Entity*) = { - V3HandProjectile_OnTick, sub_080ABFA8, DeleteEntity, DeleteEntity, DeleteEntity, + V3HandProjectile_OnTick, V3HandProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, }; diff --git a/src/projectile/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c index a8459c26..f731832b 100644 --- a/src/projectile/v3TennisBallProjectile.c +++ b/src/projectile/v3TennisBallProjectile.c @@ -1,6 +1,13 @@ -#include "entity.h" +/** + * @file v3TennisBallProjectile.c + * @ingroup Projectiles + * + * @brief V3 Tennis Ball Projectile + */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const V3TennisBallProjectile_Functions[])(Entity*); @@ -17,7 +24,7 @@ void V3TennisBallProjectile_OnTick(Entity* this) { V3TennisBallProjectile_Actions[this->action](this); } -void sub_080ACA68(Entity* this) { +void V3TennisBallProjectile_OnCollision(Entity* this) { switch (this->contactFlags & 0x7f) { case 0x1a: case 0xa: @@ -29,7 +36,7 @@ void sub_080ACA68(Entity* this) { this->speed += 0x80 * 2; this->child = this->contactedEntity; if (sub_080ACB40(this)) { - this->direction = 0; + this->direction = DirectionNorth; } else { this->direction = this->knockbackDirection; } @@ -46,7 +53,7 @@ void sub_080ACA68(Entity* this) { void V3TennisBallProjectile_Init(Entity* this) { this->action = 1; - this->direction = 0x10; + this->direction = DirectionSouth; this->z.HALF.HI = -4; this->child = NULL; InitializeAnimation(this, 7); @@ -114,7 +121,7 @@ void sub_080ACB90(Entity* this) { } void (*const V3TennisBallProjectile_Functions[])(Entity*) = { - V3TennisBallProjectile_OnTick, sub_080ACA68, DeleteEntity, DeleteEntity, DeleteEntity, + V3TennisBallProjectile_OnTick, V3TennisBallProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity, V3TennisBallProjectile_OnTick, }; void (*const V3TennisBallProjectile_Actions[])(Entity*) = { diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c index c8d0bfad..e3ce3d57 100644 --- a/src/projectile/windProjectile.c +++ b/src/projectile/windProjectile.c @@ -1,5 +1,12 @@ -#include "entity.h" +/** + * @file windProjectile.c + * @ingroup Projectiles + * + * @brief Wind Projectile + */ +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const WindProjectile_Actions[])(Entity*); @@ -17,7 +24,7 @@ void WindProjectile_Init(Entity* this) { InitializeAnimation(this, this->direction >> 3); } else { this->action = 2; - InitializeAnimation(this, this->direction >> 3 | 4); + InitializeAnimation(this, this->direction >> 3 | IdleSouth); EnqueueSFX(SFX_15F); } } @@ -33,7 +40,7 @@ void WindProjectile_Action1(Entity* this) { } else { if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); - direction = (parent->direction + 4) & 0x18; + direction = (parent->direction + 4) & DirectionWest; if (this->timer != 0) { this->direction = direction; this->animationState = direction >> 2; diff --git a/src/projectile/winder.c b/src/projectile/winder.c index 009997a9..fc5b877e 100644 --- a/src/projectile/winder.c +++ b/src/projectile/winder.c @@ -1,11 +1,17 @@ +/** + * @file winder.c + * @ingroup Projectiles + * + * @brief Winder Projectile + */ #define NENT_DEPRECATED -#include "collision.h" -#include "entity.h" -#include "asm.h" -#include "functions.h" -#include "common.h" -#include "projectile.h" #include "projectile/winder.h" +#include "asm.h" +#include "collision.h" +#include "common.h" +#include "entity.h" +#include "functions.h" +#include "projectile.h" extern s16 gUnk_080B4488[]; diff --git a/src/room.c b/src/room.c index 6337eaa6..ebfbc261 100644 --- a/src/room.c +++ b/src/room.c @@ -379,6 +379,6 @@ void sub_0804B388(u32 a1, u32 a2) { ModDungeonKeys(-1); } -void sub_0804B3C4(TileEntity* tile) { +void LoadSmallChestTile2(TileEntity* tile) { LoadSmallChestTile(tile); } diff --git a/src/roomInit.c b/src/roomInit.c index 825c7892..015bd220 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -14,6 +14,7 @@ #include "screenTransitions.h" #include "sound.h" #include "tiles.h" +#include "windcrest.h" extern u32 sub_08060354(void); extern void sub_08057E64(void); @@ -1220,7 +1221,7 @@ void sub_StateChange_CastorWilds_Main(void) { if (CheckKinstoneFused(KINSTONE_5B)) LoadRoomEntityList(&gUnk_080D9CC8); - if ((gSave.windcrests & 0x20000000) == 0) + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CASTOR_WILDS)) LoadRoomEntityList(&gUnk_080D9CE8); if (!GetInventoryValue(ITEM_PEGASUS_BOOTS)) @@ -1228,7 +1229,7 @@ void sub_StateChange_CastorWilds_Main(void) { } void sub_unk1_CastorWilds_Main(void) { - if ((gSave.windcrests & 0x20000000) == 0) + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CASTOR_WILDS)) LoadRoomEntityList(&gUnk_080D9CE8); } @@ -1581,7 +1582,7 @@ extern EntityData gUnk_080DB4D0; extern EntityData gUnk_080DB4A0; void sub_StateChange_TownMinishHoles_MayorsHouse(void) { - if (!GetInventoryValue(ITEM_FLIPPERS) && !GetInventoryValue(ITEM_QST_BOOK3) && CheckLocalFlag(KOBITO_DOUKUTU_04_T0)) + if (!GetInventoryValue(ITEM_FLIPPERS) && !GetInventoryValue(ITEM_QST_BOOK3) && CheckLocalFlag(MIZUKAKI_HINT3_MAYOR)) LoadRoomEntityList(&gUnk_080DB4D0); else LoadRoomEntityList(&gUnk_080DB4A0); @@ -1632,7 +1633,7 @@ void sub_StateChange_TownMinishHoles_5(void) { extern u32 gUnk_080DB910; u32 sub_unk3_TownMinishHoles_LibraryBookshelf(void) { - if (CheckGlobalFlag(MIZUKAKI_START) && !CheckLocalFlag(KOBITO_DOUKUTU_09_T0)) { + if (CheckGlobalFlag(MIZUKAKI_START) && !CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK)) { gRoomVars.field_0x6c[1] = &gUnk_080DB910; } return 1; @@ -1656,7 +1657,7 @@ u32 sub_unk3_TownMinishHoles_LibrariBookHouse(void) { extern EntityData gUnk_080DBA08; void sub_StateChange_TownMinishHoles_LibrariBookHouse(void) { - if (GetInventoryValue(ITEM_FLIPPERS) || !CheckLocalFlag(KOBITO_DOUKUTU_09_T0)) { + if (GetInventoryValue(ITEM_FLIPPERS) || !CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK)) { LoadRoomEntityList(&gUnk_080DBA08); } sub_0801AFE4(); @@ -1780,7 +1781,7 @@ extern EntityData gUnk_080DC4C0; void sub_StateChange_MinishVillage_Main(void) { if (!GetInventoryValue(ITEM_JABBERNUT)) { LoadRoomEntityList(&gUnk_080DC390); - if (!CheckLocalFlagByBank(FLAG_BANK_2, 0x80)) { + if (!CheckLocalFlagByBank(FLAG_BANK_2, M_PRIEST_TALK)) { LoadRoomEntityList(&gUnk_080DC3F0); } } else { @@ -1792,7 +1793,7 @@ void sub_StateChange_MinishVillage_Main(void) { if ((!CheckLocalFlagByBank(FLAG_BANK_2, M_ELDER_TALK2ND)) && GetInventoryValue(ITEM_GUST_JAR)) { LoadRoomEntityList(&gUnk_080DC470); } - if (!CheckLocalFlag(0x8d)) { + if (!CheckLocalFlag(KOBITO_MORI_1ST)) { LoadRoomEntityList(&gUnk_080DC4C0); } sub_08057E64(); @@ -1989,12 +1990,12 @@ void sub_StateChange_MelarisMine_Main(void) { if (!CheckGlobalFlag(WHITE_SWORD_END)) { LoadRoomEntityList(&gUnk_additional_8_MelarisMine_Main); } - if (!CheckLocalFlag(0x7f)) { + if (!CheckLocalFlag(YAMAKOBITO_OPEN)) { LoadRoomEntityList(&gUnk_additional_9_MelarisMine_Main); } else { LoadRoomEntityList(&gUnk_080DD294); } - SetLocalFlag(0x8e); + SetLocalFlag(KOBITO_YAMA_ENTER); } u32 sub_unk3_CloudTops_House(void) { @@ -2004,13 +2005,13 @@ u32 sub_unk3_CloudTops_House(void) { extern EntityData gUnk_080DD364; void sub_StateChange_CloudTops_House(void) { - if (!(gSave.windcrests & 0x4000000)) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CLOUD_TOPS)) { LoadRoomEntityList(&gUnk_080DD364); } } void sub_unk1_CloudTops_House(void) { - if (!(gSave.windcrests & 0x4000000)) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_CLOUD_TOPS)) { LoadRoomEntityList(&gUnk_080DD364); } } @@ -2188,7 +2189,7 @@ u32 sub_unk3_DeepwoodShrine_Barrel(void) { } void sub_StateChange_DeepwoodShrine_Barrel(void) { - switch (gSave.unk7) { + switch (gSave.dws_barrel_state) { case 0: default: SetMetaTileType(META_TILE_TYPE_144, TILE_POS(11, 8), LAYER_BOTTOM); @@ -2726,7 +2727,7 @@ void sub_StateChange_FortressOfWindsTop_Main(void) { SetGlobalFlag(LV3_CLEAR); UpdateGlobalProgress(); LoadStaticBackground(3); - if (!GetInventoryValue(ITEM_OCARINA) && CheckLocalFlag(0x45)) { + if (!GetInventoryValue(ITEM_OCARINA) && CheckLocalFlag(LV3_OCARINA_FALL)) { LoadRoomEntityList(&gUnk_080E3850); } } @@ -4421,7 +4422,7 @@ void sub_StateChange_HyruleTown_0(void) { if ((gSave.global_progress < 6) && !CheckGlobalFlag(MIZUKAKI_START)) { LoadRoomEntityList(&gUnk_080EEA9C); } - if ((gSave.windcrests & 0x8000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_HYRULE_TOWN)) { LoadRoomEntityList(&gUnk_080EEBAC); } sub_0804E150(); @@ -4429,7 +4430,7 @@ void sub_StateChange_HyruleTown_0(void) { } void sub_unk1_HyruleTown_8(void) { - if ((gSave.windcrests & 0x8000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_HYRULE_TOWN)) { LoadRoomEntityList(&gUnk_080EEBAC); } } @@ -4658,7 +4659,7 @@ void sub_StateChange_SimonsSimulation_Main(void) { SetLocalFlag(0xC6); index = 0xE; } - sub_0804B3C4(&gUnk_080F0E1C[index]); + LoadSmallChestTile2(&gUnk_080F0E1C[index]); SoundReq(SONG_STOP_BGM); } @@ -4799,14 +4800,14 @@ extern EntityData gUnk_080F2798; void sub_StateChange_HouseInteriors2_Percy(void) { if (CheckKinstoneFused(KINSTONE_21)) { - if (!CheckLocalFlag(0x42)) { - if (!CheckLocalFlag(0x43)) { + if (!CheckLocalFlag(MHOUSE08_03)) { + if (!CheckLocalFlag(MHOUSE08_04)) { LoadRoomEntityList(&gUnk_additional_9_HouseInteriors2_Percy); LoadRoomTileEntities(&gUnk_080F2860); } else { LoadRoomEntityList(&gUnk_additional_a_HouseInteriors2_Percy); } - } else if (!CheckLocalFlag(0x3f)) { + } else if (!CheckLocalFlag(MHOUSE08_00)) { LoadRoomEntityList(&gUnk_080F27D8); } else { LoadRoomEntityList(&gUnk_080F2798); @@ -4895,7 +4896,7 @@ u32 sub_unk3_HouseInteriors2_Dampe(void) { extern EntityData gUnk_080F2FD4; void sub_StateChange_HouseInteriors2_Dampe(void) { - if (!CheckLocalFlag(0x69) || GetInventoryValue(ITEM_QST_GRAVEYARD_KEY) > 1) { + if (!CheckLocalFlag(DANPEI_TALK1ST) || GetInventoryValue(ITEM_QST_GRAVEYARD_KEY) > 1) { LoadRoomEntityList(&gUnk_080F2FD4); } } @@ -5208,7 +5209,7 @@ void sub_StateChange_MinishWoods_Main(void) { if (CheckKinstoneFused(KINSTONE_4E)) { LoadRoomEntityList(&gUnk_080F4F10); } - if ((s32)gSave.windcrests > -1) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MINISH_WOODS)) { LoadRoomEntityList(&gUnk_080F4E10); } #ifdef DEMO_USA @@ -5218,7 +5219,7 @@ void sub_StateChange_MinishWoods_Main(void) { } void sub_unk1_MinishWoods_Main(void) { - if ((s32)gSave.windcrests > -1) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MINISH_WOODS)) { LoadRoomEntityList(&gUnk_080F4E10); } } @@ -5352,10 +5353,10 @@ extern EntityData gUnk_080F5788; void sub_StateChange_HouseInteriors3_StockwellShop(void) { LoadRoomEntityList(&gUnk_080F5758); - if (!GetInventoryValue(ITEM_QST_DOGFOOD) && CheckLocalFlagByBank(FLAG_BANK_2, 0x8f)) { + if (!GetInventoryValue(ITEM_QST_DOGFOOD) && CheckLocalFlagByBank(FLAG_BANK_2, KHOUSE52_KINOKO)) { LoadRoomEntityList(&gUnk_080F57E8); } - if (!CheckLocalFlag(0x55)) { + if (!CheckLocalFlag(SHOP00_SAIFU)) { LoadRoomEntityList(&gUnk_080F57A8); } else { if (gBombBagSizes[gSave.stats.bombBagType] >= 30) { @@ -5365,7 +5366,7 @@ void sub_StateChange_HouseInteriors3_StockwellShop(void) { LoadRoomEntityList(&gUnk_080F5888); #ifndef EU } else { - if (!CheckLocalFlag(0xcd)) { + if (!CheckLocalFlag(SHOP00_BOMBBAG)) { LoadRoomEntityList(&gUnk_080F58A8); } #endif @@ -5373,7 +5374,7 @@ void sub_StateChange_HouseInteriors3_StockwellShop(void) { } if (GetInventoryValue(ITEM_BOW) || CheckGlobalFlag(LV3_CLEAR)) { LoadRoomEntityList(&gUnk_080F5868); - if (!CheckLocalFlag(0x56)) { + if (!CheckLocalFlag(SHOP00_YAZUTSU)) { LoadRoomEntityList(&gUnk_080F5828); } else { LoadRoomEntityList(&gUnk_080F5848); @@ -5509,7 +5510,7 @@ void sub_StateChange_WindTribeTower_Floor2(void) { if (!CheckGlobalFlag(WARP_EVENT_END)) { LoadRoomEntityList(&gUnk_080F62E4); } else { - if (CheckLocalFlag(99)) { + if (CheckLocalFlag(SORA_ELDER_RECOVER)) { LoadRoomEntityList(&gUnk_080F6324); } } @@ -5653,7 +5654,7 @@ void sub_StateChange_HyruleField_SouthHyruleField(void) { if (!CheckGlobalFlag(TABIDACHI)) { gArea.queued_bgm = BGM_FESTIVAL_APPROACH; } - if ((gSave.windcrests & 0x40000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_SOUTH_HYRULE_FIELD)) { LoadRoomEntityList(&gUnk_080F70D8); } if (gSave.global_progress > 3) { @@ -5662,7 +5663,7 @@ void sub_StateChange_HyruleField_SouthHyruleField(void) { } void sub_unk1_HyruleField_SouthHyruleField(void) { - if ((gSave.windcrests & 0x40000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_SOUTH_HYRULE_FIELD)) { LoadRoomEntityList(&gUnk_080F70D8); } } @@ -5720,9 +5721,8 @@ extern EntityData gUnk_080F7860; extern EntityData gUnk_080F78A0; void sub_StateChange_HyruleField_LonLonRanch(void) { - - CloudOverlayManager_Main(0); - if (CheckLocalFlagByBank(FLAG_BANK_2, 0x8f)) { + CloudOverlayManager_Main(NULL); + if (CheckLocalFlagByBank(FLAG_BANK_2, KHOUSE52_KINOKO)) { if (!CheckGlobalFlag(INLOCK)) { LoadRoomEntityList(&gUnk_080F77C0); } @@ -6172,13 +6172,13 @@ u32 sub_unk3_VeilFalls_Main(void) { extern EntityData gUnk_080F9304; void sub_StateChange_VeilFalls_Main(void) { - if ((gSave.windcrests & 0x2000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_VEIL_FALLS)) { LoadRoomEntityList(&gUnk_080F9304); } } void sub_unk1_VeilFalls_Main(void) { - if ((gSave.windcrests & 0x2000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_VEIL_FALLS)) { LoadRoomEntityList(&gUnk_080F9304); } } @@ -6584,7 +6584,7 @@ void sub_StateChange_MtCrenel_CaveOfFlamesEntrance(void) { if (CheckGlobalFlag(LV2_CLEAR) && !CheckLocalFlag(LV1_CLEAR)) { LoadRoomEntityList(&gUnk_080FAFE4); } - if ((gSave.windcrests & 0x1000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MT_CRENEL)) { LoadRoomEntityList(&gUnk_080FB004); } if (GetInventoryValue(ITEM_GREEN_SWORD)) { @@ -6593,7 +6593,7 @@ void sub_StateChange_MtCrenel_CaveOfFlamesEntrance(void) { } void sub_unk1_MtCrenel_CaveOfFlamesEntrance(void) { - if ((gSave.windcrests & 0x1000000) == 0) { + if (!IS_BIT_SET(gSave.windcrests, WINDCREST_MT_CRENEL)) { LoadRoomEntityList(&gUnk_080FB004); } } diff --git a/src/screenTilemap.c b/src/screenTilemap.c index b16ca401..4c8e02ee 100644 --- a/src/screenTilemap.c +++ b/src/screenTilemap.c @@ -1,10 +1,343 @@ #include "global.h" +#include "room.h" // Called when gUpdateVisibleTiles == 2 -ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D280.inc", void sub_0807D280(u32 unk_1, u32 unk_2)) +void sub_0807D280(u16* mapspecial, u16* bgbuffer) { + u32 unk_18; + s32 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6; + s32 xdiff, ydiff; + s32 i, j, index_hack; + + xdiff = (gRoomControls.scroll_x - gRoomControls.origin_x); + ydiff = (gRoomControls.scroll_y - gRoomControls.origin_y); + switch (gRoomControls.scroll_direction) { + case 0: + if ((gRoomControls.unk_18 & 3) != 1) { + return; + } + for (i = 0x1c; i > 0; i--) { + DmaSet(3, bgbuffer + 0x20 * (i - 1), bgbuffer + 0x20 * (i + 1), 0x80000020); + } + + tmp1 = (gRoomControls.height >> 4) - 1; + tmp2 = (gRoomControls.unk_18 >> 2); + tmp3 = (tmp1 - tmp2) << 8; + tmp3 += (xdiff >> 4) * 2; + mapspecial = mapspecial + tmp3; + DmaSet(3, mapspecial, bgbuffer, 0x80000020); + DmaSet(3, mapspecial + 0x80, bgbuffer + 0x20, 0x80000020); + return; + case 1: + if ((gRoomControls.unk_18 & 3) != 0) { + return; + } else if (gRoomControls.unk_18 != 0) { + for (i = 0; i < 0x16; i++) { + DmaSet(3, bgbuffer + 0x20 * i + 2, bgbuffer + 0x20 * i, 0x8000001e); + } + } + + mapspecial = mapspecial + ((ydiff >> 4) * 0x100 + ((gRoomControls.unk_18 >> 2) << 1)); + bgbuffer = bgbuffer + 0x1e; + + for (i = 0; i < 0x16; bgbuffer += 0x20, mapspecial += 0x80, i++) { + bgbuffer[0] = mapspecial[0]; + bgbuffer[1] = mapspecial[1]; + } + + return; + case 2: + unk_18 = gRoomControls.unk_18; + + if ((unk_18 & 3) != 0) { + return; + } else if (unk_18 << 0x10 != 0) { + DmaSet(3, bgbuffer + 0x40, bgbuffer, 0x800003c0); + } + + mapspecial = mapspecial + (((unk_18 * 0x10000 >> 0x12) << 8) + ((xdiff >> 4) << 1)); + DmaSet(3, mapspecial, bgbuffer + 0x280, 0x80000020); + DmaSet(3, mapspecial + 0x80, bgbuffer + 0x2a0, 0x80000020); + return; + default: + if ((gRoomControls.unk_18 & 3) == 1) { + for (i = 0; i < 0x16; i++) { + for (j = 0x1d; j >= 0; j--) { + index_hack = i + 1; + bgbuffer[(index_hack - 1) * 0x20 + j + 2] = bgbuffer[(index_hack - 1) * 0x20 + j]; + } + } + + tmp4 = (ydiff >> 4) * 0x100; + tmp5 = ((gRoomControls.width >> 4) - 1); + tmp6 = (u32)(gRoomControls.unk_18 >> 2); + mapspecial = mapspecial + (tmp4 + ((tmp5 - tmp6) << 1)); + + for (i = 0; i < 0x16; bgbuffer += 0x20, mapspecial += 0x80, i++) { + bgbuffer[0] = mapspecial[0]; + bgbuffer[1] = mapspecial[1]; + } + } + return; + } +} // Called when gUpdateVisibleTiles == 3 -ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D46C.inc", void sub_0807D46C(u32 unk_1, u32 unk_2)) +void sub_0807D46C(u16* mapSpecial, u16* bgBuffer) { + s32 index, r0, r1, r2, r5, r8, r12; + u16 *r4, *r6; + + switch (gRoomControls.scroll_direction) { + case 0: + case 2: + r5 = gRoomControls.scroll_x - gRoomControls.origin_x; + if (r5 > 7) { + r5 -= 8; + } + + r8 = (gRoomControls.camera_target)->x.HALF.HI - gRoomControls.origin_x - 4; + if (r8 > 7) { + r8 = r8 - 8; + } + + r12 = gRoomControls.scroll_y - gRoomControls.origin_y; + if (r12 > 7) { + r12 -= 8; + } + + r0 = r8 - (gRoomControls.unk_18 * 8); + if (r0 >= r5) { + r4 = mapSpecial + ((r12 >> 3) * 0x80) + (r0 >> 3); + r6 = bgBuffer + ((r0 >> 3) & 0x1f); + r2 = ((r12 >> 3) & 0x1f) << 5; + + if (gRoomControls.height < 0xb0) { + index = gRoomControls.height >> 0x3; + } else { + index = 0x16; + } + + while (index > 0) { + // TODO r4 index with index + r6[r2] = *r4; + r4 += 0x80; + r2 = (r2 + 0x20) & 0x3ff; + index--; + } + } + + r0 = (gRoomControls.unk_18 + 1) * 8 + r8; + if (r5 + 0xf8 >= gRoomControls.width) { + r1 = r5 + 0xf8; + } else { + r1 = r5 + 0x100; + } + if (r0 < r1) { + r4 = mapSpecial + ((r12 >> 3) * 0x80) + (r0 >> 3); + r6 = bgBuffer + ((r0 >> 3) & 0x1f); + r2 = (r12 >> 3 & 0x1f) << 5; + + if (gRoomControls.height < 0xb0) { + index = gRoomControls.height >> 3; + } else { + index = 0x16; + } + + while (index > 0) { + r6[r2] = *r4; + r4 += 0x80; + r2 = (r2 + 0x20) & 0x3ff; + index--; + } + } + break; + case 1: + case 3: + r5 = gRoomControls.scroll_y - gRoomControls.origin_y; + if (r5 > 7) { + r5 -= 8; + } + + r8 = gRoomControls.scroll_x - gRoomControls.origin_x; + if (r8 > 7) { + r8 -= 8; + } + + r12 = (gRoomControls.camera_target)->y.HALF.HI - gRoomControls.origin_y - 4; + if (r12 > 7) { + r12 = r12 - 8; + } + + r0 = r12 + gRoomControls.unk_18 * -8; + if (r0 >= r5) { + r4 = mapSpecial + ((r0 >> 3) * 0x80) + (r8 >> 3); + r6 = bgBuffer + (((r0 >> 3) & 0x1f) << 5); + r2 = ((r8 >> 3) & 0x1f); + + if (gRoomControls.width < 0x100) { + index = gRoomControls.width >> 3; + } else { + index = 0x20; + } + + while (index > 0) { + r6[r2] = *r4; + r4 += 1; + r2 = (r2 + 1) & 0x1f; + index--; + } + } + + r0 = (gRoomControls.unk_18 + 1) * 8 + r12; + if (r5 + 0xa8 >= gRoomControls.height) { + r2 = r5 + 0xa8; + } else { + r2 = r5 + 0xb0; + } + if (r0 < r2) { + r4 = mapSpecial + ((r0 >> 3) * 0x80) + (r8 >> 3); + r6 = bgBuffer + (((r0 >> 3) & 0x1f) << 5); + r2 = ((r8 >> 3) & 0x1f); + if (gRoomControls.width < 0x100) { + index = gRoomControls.width >> 3; + } else { + index = 0x20; + } + while (index > 0) { + r6[r2] = *r4; + r4 += 0x1; + r2 = (r2 + 0x1) & 0x1f; + index--; + } + } + break; + } +} // Called when gUpdateVisibleTiles == 4 -ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D6D8.inc", void sub_0807D6D8(u32 unk_1, u32 unk_2)) +void sub_0807D6D8(u16* mapSpecial, u16* bgBuffer) { + s32 Unk1a; + s32 SquaredUnk18; + s32 SquaredUnk1a; + s32 RelativeCameraTargetX; + s32 RelativeCameraTargetY; + s32 CameraOffsetFromTargetX; + s32 CameraOffsetFromTargetY; + s32 RelativeScrollX; + s32 RelativeScrollY; + s32 r0, r4, r9, r7, r12; + u16 *r2, *r3; + + if ((gRoomControls.unk_18 == 0) || (gRoomControls.unk_1a == 0)) + return; + + RelativeScrollX = (gRoomControls.scroll_x - gRoomControls.origin_x) & 0xfffffff0; + RelativeCameraTargetX = ((gRoomControls.camera_target)->x.HALF.HI - gRoomControls.origin_x) & 0xfffffff8; + CameraOffsetFromTargetX = RelativeCameraTargetX - RelativeScrollX; + + RelativeScrollY = (gRoomControls.scroll_y - gRoomControls.origin_y) & 0xfffffff0; + RelativeCameraTargetY = (gRoomControls.camera_target->y.HALF.HI - gRoomControls.origin_y) & 0xfffffff8; + CameraOffsetFromTargetY = RelativeCameraTargetY - RelativeScrollY; + + SquaredUnk18 = gRoomControls.unk_18 * gRoomControls.unk_18; + Unk1a = gRoomControls.unk_1a; + SquaredUnk1a = Unk1a * Unk1a; + + r4 = gRoomControls.unk_18; + r9 = 0; + r7 = (-(r4 << 1) + 1) * SquaredUnk1a + (SquaredUnk18 << 1); + r12 = (r4 * SquaredUnk1a) / SquaredUnk18; + + while (r9 <= r12) { + if ((RelativeScrollY + 0xb0) > (RelativeCameraTargetY + r9)) { + r0 = ((CameraOffsetFromTargetY + r9) >> 3) & 0x1f; + if (r0 != 0x1f) { + r2 = bgBuffer + (r0 << 5); + r3 = mapSpecial + (((RelativeCameraTargetY + r9) >> 3) << 7); + + if ((RelativeScrollX + 0x100) > (RelativeCameraTargetX + r4)) { + r2[((CameraOffsetFromTargetX + r4) >> 3 & 0x1f)] = r3[((RelativeCameraTargetX + r4) >> 3)]; + gRoomControls.unk_1c |= 1 << 0; + } + if (RelativeScrollX < (RelativeCameraTargetX - r4)) { + r2[((CameraOffsetFromTargetX - r4) >> 3 & 0x1f)] = r3[((RelativeCameraTargetX - r4) >> 3)]; + gRoomControls.unk_1c |= 1 << 1; + } + } + } + + if ((RelativeScrollY < (RelativeCameraTargetY - r9 + 8))) { + r0 = ((CameraOffsetFromTargetY - r9) >> 3) & 0x1f; + if (r0 != 0x1f) { + r2 = bgBuffer + (r0 << 5); + r3 = mapSpecial + (((RelativeCameraTargetY - r9) >> 3) << 7); + if ((RelativeScrollX + 0x100) > (RelativeCameraTargetX + r4)) { + r2[((CameraOffsetFromTargetX + r4) >> 3 & 0x1f)] = r3[((RelativeCameraTargetX + r4) >> 3)]; + gRoomControls.unk_1c |= 1 << 2; + } + if (RelativeScrollX < (RelativeCameraTargetX - r4)) { + r2[((CameraOffsetFromTargetX - r4) >> 3 & 0x1f)] = r3[((RelativeCameraTargetX - r4) >> 3)]; + gRoomControls.unk_1c |= 1 << 3; + } + } + } + + if (r7 > 0) { + r7 += ((-(r4 << 0x2) + 4) * SquaredUnk1a) + (SquaredUnk18 * (6 + (4 * r9))); + r4--; + r12 = (r4 * SquaredUnk1a) / SquaredUnk18; + } else + r7 += (SquaredUnk18 * (6 + (4 * r9))); + + r9++; + } + + r4 = 0; + r9 = Unk1a; + r7 = (SquaredUnk1a << 1) + SquaredUnk18 * (Unk1a * -2 + 1); + r12 = r9 * SquaredUnk18 / SquaredUnk1a; + + while (r4 <= r12) { + if ((RelativeScrollY + 0xb0) > (RelativeCameraTargetY + r9)) { + r0 = (CameraOffsetFromTargetY + r9) >> 3 & 0x1f; + if (r0 != 0x1f) { + r2 = bgBuffer + (r0 << 5); + r3 = mapSpecial + (((RelativeCameraTargetY + r9) >> 3) << 7); + if ((RelativeScrollX + 0x100) > (RelativeCameraTargetX + r4)) { + r2[(((CameraOffsetFromTargetX + r4) >> 3) & 0x1f)] = r3[((RelativeCameraTargetX + r4) >> 3)]; + gRoomControls.unk_1c |= 0x10; + } + if (RelativeScrollX < (RelativeCameraTargetX - r4)) { + r2[(((CameraOffsetFromTargetX - r4) >> 3) & 0x1f)] = r3[((RelativeCameraTargetX - r4) >> 3)]; + gRoomControls.unk_1c |= 0x20; + } + } + } + + if (RelativeScrollY < ((RelativeCameraTargetY - r9) + 8)) { + r0 = (CameraOffsetFromTargetY - r9) >> 3 & 0x1f; + if (r0 != 0x1f) { + r2 = bgBuffer + (r0 << 5); + r3 = mapSpecial + (((RelativeCameraTargetY - r9) >> 3) << 7); + if ((RelativeScrollX + 0x100) > (RelativeCameraTargetX + r4)) { + r2[(((CameraOffsetFromTargetX + r4) >> 3) & 0x1f)] = r3[((RelativeCameraTargetX + r4) >> 3)]; + gRoomControls.unk_1c |= 0x40; + } + if (RelativeScrollX < (RelativeCameraTargetX - r4)) { + r2[(((CameraOffsetFromTargetX - r4) >> 3) & 0x1f)] = r3[((RelativeCameraTargetX - r4) >> 3)]; + gRoomControls.unk_1c |= 0x80; + } + } + } + + if (r7 > 0) { + r7 += (((SquaredUnk1a * 6)) + (r4 * SquaredUnk1a << 2)) + ((-(r9 << 0x2) + 4) * SquaredUnk18); + r9--; + r12 = (r9 * SquaredUnk18) / SquaredUnk1a; + + } else { + r7 += (((SquaredUnk1a * 6)) + (r4 * SquaredUnk1a << 2)); + } + + r4++; + } +} diff --git a/src/script.c b/src/script.c index 0c6ecd50..637f2181 100644 --- a/src/script.c +++ b/src/script.c @@ -97,7 +97,7 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_AddInteractableWhenBigObject(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_RemoveInteractableObject(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_AddInteractableWhenBigFuser(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_UpdateFusion(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_AddInteractableFuser(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context); @@ -313,9 +313,10 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { } } -void sub_0807DD50(Entity* entity) { +// Init some script related variables, execute the script and do something regarding the animation. +void InitScriptForNPC(Entity* entity) { sub_0807DD64(entity); - sub_0807DD94(entity, 0); + ExecuteScriptAndHandleAnimation(entity, NULL); } void sub_0807DD64(Entity* entity) { @@ -330,8 +331,8 @@ void sub_0807DD80(Entity* entity, Script* script) { sub_0807DD64(entity); } -void sub_0807DD94(Entity* entity, void (*function)(Entity*, ScriptExecutionContext*)) { - ExecuteScriptForEntity(entity, function); +void ExecuteScriptAndHandleAnimation(Entity* entity, void (*postScriptCallback)(Entity*, ScriptExecutionContext*)) { + ExecuteScriptForEntity(entity, postScriptCallback); HandleEntity0x82Actions(entity); sub_0807DE80(entity); } @@ -390,6 +391,7 @@ void HandleEntity0x82Actions(Entity* entity) { } } +// Handles animation for NPCs? Uses u16 0x80 and 0x82 of the entity. void sub_0807DE80(Entity* entity) { u32 local1; u16 local2; @@ -546,7 +548,7 @@ void ExecuteScript(Entity* entity, ScriptExecutionContext* context) { ScriptCommand_AddInteractableWhenBigObject, ScriptCommand_RemoveInteractableObject, ScriptCommand_AddInteractableWhenBigFuser, - ScriptCommand_0807E9F0, + ScriptCommand_UpdateFusion, ScriptCommand_0807EA4C, ScriptCommand_AddInteractableFuser, ScriptCommand_WaitUntilTextboxCloses, @@ -790,7 +792,7 @@ void ScriptCommand_CheckPlayerInRegion2(Entity* entity, ScriptExecutionContext* void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContext* context) { if (entity->interactType) { - entity->interactType = 0; + entity->interactType = INTERACTION_NONE; context->condition = 1; } else { context->condition = 0; @@ -801,13 +803,13 @@ void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContex void ScriptCommand_FacePlayerAndCheckDist(Entity* entity, ScriptExecutionContext* context) { if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags & PL_MINISH) == 0 && EntityInRectRadius(entity, &gPlayerEntity, 40, 40)) { - entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity)); + entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity)); } context->unk_1A++; if (entity->interactType) { - entity->interactType = 0; + entity->interactType = INTERACTION_NONE; context->condition = 1; - entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity)); + entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity)); } else { context->condition = 0; } @@ -1106,7 +1108,7 @@ void ScriptCommand_SetAnimation(Entity* entity, ScriptExecutionContext* context) void ScriptCommand_TriggerInteract(Entity* entity, ScriptExecutionContext* context) { if (entity->interactType) { - entity->interactType = 0; + entity->interactType = INTERACTION_NONE; gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1122,7 +1124,7 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context) { case 0: if (!entity->interactType) break; - entity->interactType = 0; + entity->interactType = INTERACTION_NONE; context->unk_18++; MessageFromTarget(context->scriptInstructionPointer[1]); break; @@ -1148,25 +1150,25 @@ void ScriptCommand_AddInteractableWhenBigFuser(Entity* entity, ScriptExecutionCo AddInteractableWhenBigFuser(entity, context->scriptInstructionPointer[1]); } -void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { - bool32 tmp; - sub_0801E00C(); - tmp = TRUE; - switch (gFuseInfo._0) { +void ScriptCommand_UpdateFusion(Entity* entity, ScriptExecutionContext* context) { + bool32 isFusionSuccessful; + PerformFuseAction(); + isFusionSuccessful = TRUE; + switch (gFuseInfo.fusionState) { default: - tmp = FALSE; + isFusionSuccessful = FALSE; break; - case 2: + case FUSION_STATE_2: gPlayerState.controlMode = CONTROL_DISABLED; - gPauseMenuOptions.disabled = tmp; - context->condition = tmp; + gPauseMenuOptions.disabled = isFusionSuccessful; + context->condition = isFusionSuccessful; break; - case 1: + case FUSION_STATE_1: context->condition = 0; break; } - if (tmp) { + if (isFusionSuccessful) { PlayerResetStateFromFusion(); gPlayerState.controlMode = CONTROL_1; } else { @@ -1175,9 +1177,9 @@ void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context) { - if (entity->interactType == 2) { - sub_0801DFB4(entity, 0, 0, 0); - entity->interactType = 0; + if (entity->interactType == INTERACTION_FUSE) { + InitializeFuseInfo(entity, 0, 0, 0); + entity->interactType = INTERACTION_NONE; gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1234,17 +1236,17 @@ void ScriptCommand_SetAnimationState(Entity* entity, ScriptExecutionContext* con } void ScriptCommand_0807EB4C(Entity* entity, ScriptExecutionContext* context) { - entity->animationState = - sub_0806F5B0(sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x, - context->scriptInstructionPointer[2] + gRoomControls.origin_y)); + entity->animationState = GetAnimationStateForDirection8( + sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x, + context->scriptInstructionPointer[2] + gRoomControls.origin_y)); } void ScriptCommand_FacePlayer(Entity* entity, ScriptExecutionContext* context) { - entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity)); + entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity)); } void ScriptCommand_FaceAwayFromPlayer(Entity* entity, ScriptExecutionContext* context) { - gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, entity)) & ~1; + gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, entity)) & ~1; } void ScriptCommand_SetEntityDirection(Entity* entity, ScriptExecutionContext* context) { @@ -1352,9 +1354,9 @@ void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context) { tmp = context->scriptInstructionPointer[2]; tmp3 = entity->y.HALF.HI - gRoomControls.origin_y; context->y.WORD = ((tmp - tmp3) << 0x10) / context->unk_12; - entity->animationState = - sub_0806F5B0(sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x, - context->scriptInstructionPointer[2] + gRoomControls.origin_y)); + entity->animationState = GetAnimationStateForDirection8( + sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x, + context->scriptInstructionPointer[2] + gRoomControls.origin_y)); context->postScriptActions |= 2; } else { if (!--context->unk_12) { @@ -1368,6 +1370,7 @@ void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context) { gActiveScriptInfo.commandSize = 0; } +// player movement? void ScriptCommand_MoveTo(Entity* entity, ScriptExecutionContext* context) { if (!context->unk_18) { context->unk_18 = 1; @@ -1488,7 +1491,7 @@ void ScriptCommand_IncreaseMaxHealth(Entity* entity, ScriptExecutionContext* con void ScriptCommand_GivePlayerItem(Entity* entity, ScriptExecutionContext* context) { u32 tmp = 0; - if (context->scriptInstructionPointer[1] == 0x3F) { + if (context->scriptInstructionPointer[1] == ITEM_SHELLS) { tmp = context->intVariable; } InitItemGetSequence(context->scriptInstructionPointer[1], tmp, 0); @@ -1548,11 +1551,12 @@ void sub_0807F100(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F128(Entity* entity, ScriptExecutionContext* context) { - static const u8 sAnimations[] = { 6, 2, 6, 2, 4, 6, 4, 2 }; + static const u8 sAnimationStates[] = { IdleWest, IdleEast, IdleWest, IdleEast, + IdleSouth, IdleWest, IdleSouth, IdleEast }; static const u8 sValues[] = { 0xa, 0x14, 0x1e, 0x12, 0x1c, 0x26, 0xc, 0x18 }; u32 rand = Random(); - entity->animationState = sAnimations[rand & 7]; + entity->animationState = sAnimationStates[rand & 7]; context->unk_1A = sValues[(rand >> 8) % 8]; } @@ -1582,25 +1586,25 @@ void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) { void sub_0807F1C4(Entity* entity, ScriptExecutionContext* context) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x459; + gPlayerState.animation = ANIM_DIE1_NOCAP; } else { - gPlayerState.animation = 0x1bc; + gPlayerState.animation = ANIM_DIE1; } } void sub_0807F1E8(Entity* entity, ScriptExecutionContext* context) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x45a; + gPlayerState.animation = ANIM_DIE2_NOCAP; } else { - gPlayerState.animation = 0x2bd; + gPlayerState.animation = ANIM_DIE2; } } void sub_0807F210(Entity* entity, ScriptExecutionContext* context) { if (gPlayerState.flags & PL_NO_CAP) { - gPlayerState.animation = 0x41c; + gPlayerState.animation = ANIM_HOP_NOCAP; } else { - gPlayerState.animation = 0x80c; + gPlayerState.animation = ANIM_HOP; } } @@ -1718,12 +1722,12 @@ void LoadMenu(Entity* entity, ScriptExecutionContext* context) { void CheckInteractType(Entity* entity, ScriptExecutionContext* context) { switch (entity->interactType) { - case 1: - entity->interactType = 0; + case INTERACTION_TALK: + entity->interactType = INTERACTION_NONE; context->intVariable = 1; break; - case 2: - entity->interactType = 0; + case INTERACTION_FUSE: + entity->interactType = INTERACTION_NONE; context->intVariable = 2; break; default: @@ -1819,14 +1823,14 @@ void WaitForCameraTouchRoomBorder(Entity* entity, ScriptExecutionContext* contex } void sub_0807F634(Entity* entity, ScriptExecutionContext* context) { - u16* p = (u16*)context->intVariable; - sub_0801DFB4(entity, p[0], p[1], p[2]); + u16* textIndices = (u16*)context->intVariable; + InitializeFuseInfo(entity, textIndices[0], textIndices[1], textIndices[2]); gPlayerState.controlMode = CONTROL_DISABLED; } void sub_0807F650(Entity* entity, ScriptExecutionContext* context) { - u32 p = GetFuserId(entity); - sub_0801DFB4(entity, gUnk_08001A7C[p][0], gUnk_08001A7C[p][1], gUnk_08001A7C[p][2]); + u32 fuserId = GetFuserId(entity); + InitializeFuseInfo(entity, gUnk_08001A7C[fuserId][0], gUnk_08001A7C[fuserId][1], gUnk_08001A7C[fuserId][2]); gPlayerState.controlMode = CONTROL_DISABLED; } diff --git a/src/scroll.c b/src/scroll.c index 859bca33..97843104 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -502,7 +502,91 @@ void sub_08080368(void) { } } -ASM_FUNC("asm/non_matching/scroll/sub_080803D0.inc", u32 sub_080803D0()) +u32 sub_080803D0(void) { + s32 sp00, sp04, sp08, sp0c, sp10, sp14, sp18, sp1c; + s32 r2, r4, r7, r8, r9, r10; + + sp18 = gRoomControls.scroll_x - gRoomControls.origin_x; + sp10 = gRoomControls.camera_target->x.HALF.HI - gRoomControls.origin_x; + sp1c = gRoomControls.scroll_y - gRoomControls.origin_y; + sp14 = gRoomControls.camera_target->y.HALF.HI - gRoomControls.origin_y; + sp08 = 0x3c; + do { + r7 = 0; + sp08 += 6; + r10 = sp08 * sp08; + sp0c = sp08 * 2 / 3; + r9 = sp0c * sp0c; + + sp00 = sp08; + sp04 = 0; + r4 = (-(sp08 * 2) + 1) * r9 + r10 * 2; + r2 = sp00 * r9 / r10; + while (sp04 <= r2) { + + if ((sp1c + 0xa8) > sp14 + sp04) { + if (sp18 + 0xf8 > sp00 + sp10) { + r7 |= 1; + } + if (sp18 < sp10 - sp00 + 8) { + r7 |= 2; + } + } + if (sp1c < (sp14 - sp04) + 8) { + if (sp18 + 0xf8 > sp00 + sp10) { + r7 |= 4; + } + if (sp18 < sp10 - sp00 + 8) { + r7 |= 8; + } + } + + if (r4 > 0) { + r4 += ((-(sp00 << 0x2) + 4) * r9) + (r10 * (6 + 4 * sp04)); + sp00--; + r2 = sp00 * r9 / r10; + } else { + r4 += (r10 * (6 + 4 * sp04)); + } + + sp04++; + } + + sp00 = 0; + sp04 = sp0c; + r4 = r9 * 2 + (sp04 * -2 + 1) * r10; + r2 = sp04 * r10 / r9; + while (sp00 <= r2) { + if (sp1c + 0xa8 > sp14 + sp04) { + if (sp18 + 0xf8 > sp10 + sp00) { + r7 |= 0x10; + } + if (sp18 < sp10 + 8 - sp00) { + r7 |= 0x20; + } + } + if (sp1c < (sp14 - sp04) + 8) { + if (sp18 + 0xf8 > sp10 + sp00) { + r7 |= 0x40; + } + if (sp18 < sp10 + 8 - sp00) { + r7 |= 0x80; + } + } + + if (r4 > 0) { + r4 += r9 * (6 + (4 * sp00)) + (sp04 * -4 + 4) * r10; + sp04--; + r2 = sp04 * r10 / r9; + } else { + r4 += r9 * (6 + (4 * sp00)); + } + sp00++; + } + } while (r7 != 0); + + return sp08; +} void UpdateIsDiggingCave(void) { switch (gRoomControls.area) { diff --git a/src/sound.c b/src/sound.c index f888af22..a6dc0444 100644 --- a/src/sound.c +++ b/src/sound.c @@ -958,7 +958,7 @@ const Song gSongTable[] = { [SFX_FALL_HOLE] = { &sfxFallHole, MUSIC_PLAYER_04, MUSIC_PLAYER_04 }, [SFX_86] = { &sfx86, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F }, [SFX_PLY_DIE] = { &sfxPlyDie, MUSIC_PLAYER_1D, MUSIC_PLAYER_1D }, - [SFX_88] = { &sfx88, MUSIC_PLAYER_1C, MUSIC_PLAYER_1C }, + [SFX_GRAB] = { &sfx88, MUSIC_PLAYER_1C, MUSIC_PLAYER_1C }, [SFX_BARREL_RELEASE] = { &sfxBarrelRelease, MUSIC_PLAYER_1B, MUSIC_PLAYER_1B }, [SFX_BARREL_ENTER] = { &sfxBarrelEnter, MUSIC_PLAYER_1A, MUSIC_PLAYER_1A }, [SFX_BARREL_ROLL] = { &sfxBarrelRoll, MUSIC_PLAYER_19, MUSIC_PLAYER_19 }, @@ -1089,7 +1089,7 @@ const Song gSongTable[] = { [SFX_PLACE_OBJ] = { &sfx104, MUSIC_PLAYER_0D, MUSIC_PLAYER_0D }, [SFX_105] = { &sfx105, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E }, [SFX_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B }, - [SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A }, + [SFX_ITEM_GLOVES_AIR] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A }, [SFX_108] = { &sfx108, MUSIC_PLAYER_09, MUSIC_PLAYER_09 }, [SFX_ITEM_GET] = { &sfx109, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E }, [SFX_10A] = { &sfx10A, MUSIC_PLAYER_08, MUSIC_PLAYER_08 }, diff --git a/src/staffroll.c b/src/staffroll.c index c75166fc..2cdf3b55 100644 --- a/src/staffroll.c +++ b/src/staffroll.c @@ -269,13 +269,13 @@ void StaffrollTask_State2(void) { } else { choice = gStaffrollMenu.base.field_0x3; switch (gInput.newKeys) { - case 0x40: + case DPAD_UP: choice = 0; break; - case 0x80: + case DPAD_DOWN: choice = 1; break; - case 1: + case A_BUTTON: if (choice != 0) { tmp = 4; } else { @@ -313,7 +313,7 @@ void StaffrollTask_State2(void) { if (gStaffrollMenu.base.transitionTimer != 0) { gStaffrollMenu.base.transitionTimer--; } else { - if ((gInput.newKeys & 0xb) != 0) { + if ((gInput.newKeys & (A_BUTTON | B_BUTTON | START_BUTTON)) != 0) { gStaffrollMenu.base.overlayType = 1; } } diff --git a/src/subtask.c b/src/subtask.c index 67096dc2..ac1c54af 100644 --- a/src/subtask.c +++ b/src/subtask.c @@ -13,6 +13,7 @@ #include "screen.h" #include "subtask.h" #include "ui.h" +#include "windcrest.h" extern Screen gUnk_03001020; extern u8 gPaletteBufferBackup[]; @@ -67,7 +68,7 @@ param_2: 0: visited overworld area name 2: overworld area name 1: dungeon name */ -void ShowAreaName(u32 id, u32 type) { +void ShowAreaName(WindcrestID windcrest, u32 type) { extern u16 gDungeonNames[]; extern Font gUnk_08128FD8; extern Font gUnk_08128FC0; @@ -77,16 +78,18 @@ void ShowAreaName(u32 id, u32 type) { textIndexOrPtr = 0; switch (type) { case 0: - if ((gSave.windcrests & (1 << id)) == 0) + if (!IS_BIT_SET(gSave.windcrests, windcrest)) break; case 2: - textIndexOrPtr = gOverworldLocations[id].textIndex; + textIndexOrPtr = gOverworldLocations[windcrest].textIndex; font = &gUnk_08128FC0; break; case 1: - textIndexOrPtr = gDungeonNames[id]; + textIndexOrPtr = gDungeonNames[windcrest]; font = &gUnk_08128FD8; break; + default: + break; } if (gGenericMenu.unk2e.HWORD != textIndexOrPtr) { @@ -217,7 +220,7 @@ void Subtask_FadeIn(void) { MemCopy(gUnk_03000420, gUI.unk_2a8, sizeof(gUI.unk_2a8)); MemCopy(&gActiveScriptInfo, &gUI.activeScriptInfo, sizeof(ActiveScriptInfo)); sub_0805E958(); - gUI.unk_d = gRoomTransition.field_0x2c[2]; + gUI.unk_d = gRoomTransition.field2f; gUI.controlMode = gPlayerState.controlMode; gUI.currentRoomProperties = gCurrentRoomProperties; gUI.mapBottomBgSettings = gMapBottom.bgSettings; @@ -240,7 +243,7 @@ void Subtask_Init(void) { ResetPaletteTable(0); gGFXSlots.unk0 = 1; gUI.nextToLoad = 2; // Subtask_Update - gRoomTransition.field_0x2c[3] = 1; + gRoomTransition.field30 = 1; } } @@ -269,7 +272,7 @@ void Subtask_FadeOut(void) { SetFadeInverted(gUI.fadeInTime); } gUI.nextToLoad = 4; // Subtask_Die - gRoomTransition.field_0x2c[3] = 0; + gRoomTransition.field30 = 0; } } diff --git a/src/subtask/subtaskFastTravel.c b/src/subtask/subtaskFastTravel.c index 0f657cb7..6e4749e6 100644 --- a/src/subtask/subtaskFastTravel.c +++ b/src/subtask/subtaskFastTravel.c @@ -168,7 +168,7 @@ void sub_080A6E70(void) { DrawDirect(DRAW_DIRECT_SPRITE_INDEX, frameIndex); for (i = 0; i < 8; i++) { - if ((gSave.windcrests & (1 << (i + 0x18))) != 0) { + if (IS_BIT_SET(gSave.windcrests, i + 24)) { sub_080A6EE0(i); DrawDirect(DRAW_DIRECT_SPRITE_INDEX, 0x5c); } diff --git a/src/subtask/subtaskMapHint.c b/src/subtask/subtaskMapHint.c index 3b2ec324..1bbe2670 100644 --- a/src/subtask/subtaskMapHint.c +++ b/src/subtask/subtaskMapHint.c @@ -38,7 +38,7 @@ void Subtask_MapHint_0(void) { gScreen.lcd.displayControl = gScreen.lcd.displayControl & 0xf7ff; SetColor(0, gPaletteBuffer[81]); val = gUnk_08128F4C[gUI.field_0x3]; - gSave.field_0x20 |= val; + gSave.map_hints |= val; gGenericMenu.unk10.h[1] = val & gGenericMenu.unk10.h[0]; gGenericMenu.unk10.h[0] = 0; gMenu.transitionTimer = 60; diff --git a/src/title.c b/src/title.c index 4473b24b..353604e3 100644 --- a/src/title.c +++ b/src/title.c @@ -72,9 +72,9 @@ static const SaveFile gDemoSave = { .msg_speed = 1, .brightness = 1, .global_progress = 1, - .field_0x20 = 0x1F, + .map_hints = 0x1F, .windcrests = 0x00013780, - .unk50 = 7, + .enemies_killed = 7, .areaVisitFlags = { 0x0114C300 }, .name = "\x97\x7f\xdd", .saved_status = { diff --git a/src/ui.c b/src/ui.c index 7cc51015..b5d0bfb0 100644 --- a/src/ui.c +++ b/src/ui.c @@ -3,6 +3,7 @@ #include "functions.h" #include "game.h" #include "global.h" +#include "item.h" #include "message.h" #include "player.h" #include "save.h" @@ -667,7 +668,7 @@ u32 sub_0801CC80(UIElement* element) { u32 buttonId = (type ^ 3) != 0; u32 itemId = gSave.stats.itemButtons[buttonId]; if (ItemIsBottle(itemId)) { - itemId = gSave.saved_status.field_0x24[itemId - 6]; + itemId = gSave.stats.bottles[itemId - ITEM_BOTTLE1]; } return itemId; } diff --git a/src/vram.c b/src/vram.c index 8c43f244..ce1bebbf 100644 --- a/src/vram.c +++ b/src/vram.c @@ -2,6 +2,7 @@ #include "common.h" #include "structures.h" #include "fileselect.h" +#include "new_player.h" extern u32 gFixedTypeGfxData[]; @@ -352,7 +353,54 @@ void CleanUpGFXSlots(void) { } // Swap gfx -ASM_FUNC("asm/non_matching/vram/sub_080AE218.inc", void sub_080AE218(u32 a, u32 b)) +void sub_080AE218(u32 param1, u32 param2) { + struct_gUnk_020000C0_1* psVar6; + u32 r0, r1, r3, r7, r12; + u32 index1, index2; + + r12 = (param2 << 4) + 0x140; + r3 = (param1 << 4) + 0x140; + r7 = r3 + ((u32)gGFXSlots.slots[param1].slotCount << 4); + + for (index1 = 0; index1 < 0x50; index1++) { + Entity* ent = &(&gPlayerEntity)[index1]; + if (ent->next != NULL) { + if (param1 == ent->spriteAnimation[0]) { + ent->spriteAnimation[0] = param2; + } + r0 = ent->spriteVramOffset; + if ((r3 <= r0) && (r7 > r0)) { + r0 = (r0 - r3); + r1 = r0 + r12; + ent->spriteVramOffset = r1; + } + } + } + + for (index2 = 0; index2 < ARRAY_COUNT(gUnk_020000C0); index2++) { + for (index1 = 0; index1 < 4; index1++) { + psVar6 = gUnk_020000C0[index2].unk_00 + index1; + if ((((*(u8*)&psVar6->unk_00) & 1) != 0) && (((*(u8*)&psVar6->unk_00) & 2) == 0)) { + r1 = psVar6->unk_08.HALF_U.HI; + if ((r3 <= r1) && (r7 > r1)) { + r0 = (r1 - r3); + r1 = r0 + r12; + psVar6->unk_08.HALF_U.HI = r1; + } + } + } + } + + for (index1 = 0; index1 < 0x80; index1++) { + r1 = gOAMControls.oam[index1].tileNum; + if ((r3 <= r1) && (r7 > r1)) { + r0 = (r1 - r3); + r1 = r0 + r12; + gOAMControls.oam[index1].tileNum = r1; + gOAMControls.field_0x0 = 1; + } + } +} void MoveGFXSlots(u32 srcIndex, u32 targetIndex) { s32 index; diff --git a/src/worldEvent/worldEvent22.c b/src/worldEvent/worldEvent22.c index 367c47da..3fc0a672 100644 --- a/src/worldEvent/worldEvent22.c +++ b/src/worldEvent/worldEvent22.c @@ -1,5 +1,5 @@ /** - * @file worldEvent.c + * @file worldEvent22.c * @ingroup WorldEvents * * @brief World Event 22 diff --git a/tools/src/tmc_strings/main.cpp b/tools/src/tmc_strings/main.cpp index 7f5bbf22..4faf084e 100644 --- a/tools/src/tmc_strings/main.cpp +++ b/tools/src/tmc_strings/main.cpp @@ -73,7 +73,7 @@ const std::map CharConvertArray = { { 0xC5, "Å" }, { 0xC6, "Æ" }, { 0xC7, "Ç" }, { 0xC8, "È" }, { 0xC9, "É" }, { 0xCA, "Ê" }, { 0xCB, "Ë" }, { 0xCC, "Ì" }, { 0xCD, "Í" }, { 0xCE, "Î" }, { 0xCF, "Ï" }, { 0xD0, "Đ" }, { 0xD1, "Ñ" }, { 0xD2, "Ò" }, { 0xD3, "Ó" }, { 0xD4, "Ô" }, { 0xD5, "Õ" }, { 0xD6, "Ö" }, { 0xD7, "×" }, { 0xD8, "Ø" }, { 0xD9, "Ù" }, - { 0xDA, "Ú" }, { 0xDB, "Û" }, { 0xDC, "Ü" }, { 0xDD, "Ý" }, { 0xDE, "Þ" }, { 0xDF, "β" }, { 0xE0, "à" }, + { 0xDA, "Ú" }, { 0xDB, "Û" }, { 0xDC, "Ü" }, { 0xDD, "Ý" }, { 0xDE, "Þ" }, { 0xDF, "ß" }, { 0xE0, "à" }, { 0xE1, "á" }, { 0xE2, "â" }, { 0xE3, "ã" }, { 0xE4, "ä" }, { 0xE5, "å" }, { 0xE6, "æ" }, { 0xE7, "ç" }, { 0xE8, "è" }, { 0xE9, "é" }, { 0xEA, "ê" }, { 0xEB, "ë" }, { 0xEC, "ì" }, { 0xED, "í" }, { 0xEE, "î" }, { 0xEF, "ï" }, { 0xF0, "ð" }, { 0xF1, "ñ" }, { 0xF2, "ò" }, { 0xF3, "ó" }, { 0xF4, "ô" }, { 0xF5, "õ" }, diff --git a/translations/French.json b/translations/French.json index e813aee1..37127c07 100644 --- a/translations/French.json +++ b/translations/French.json @@ -958,7 +958,7 @@ "" ], [ - "{Symbol:0B}{Symbol:0C}{Symbol:07}{Symbol:08}{Symbol:09}{Symbol:0A}\n !\"{Symbol:10}{Symbol:11}{Symbol:12}{Symbol:0D}'(){Symbol:13}{Symbol:14},-.{Symbol:15}\n0123456789:{Symbol:16}{Symbol:17}{Symbol:18}{Symbol:19}?\n{Symbol:1A}ABCDEFGHIJKLMNO\nPQRSTUVWXYZ{Symbol:1B}{Symbol:1C}{Symbol:1D}{Symbol:1E}{Symbol:1F}\n`abcdefghijklmno\npqrstuvwxyz{Symbol:20}{Symbol:21}{Symbol:22}{Symbol:23}\n\nTMsÿ\n¡♪\rɪ\rÊ\n´¿\nÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ\nĐÑÒÓÔÕÖרÙÚÛÜÝÞβ\nàáâãäåæçèéêëìíîï\nðñòóôõö÷øùúûüýþÿ", + "{Symbol:0B}{Symbol:0C}{Symbol:07}{Symbol:08}{Symbol:09}{Symbol:0A}\n !\"{Symbol:10}{Symbol:11}{Symbol:12}{Symbol:0D}'(){Symbol:13}{Symbol:14},-.{Symbol:15}\n0123456789:{Symbol:16}{Symbol:17}{Symbol:18}{Symbol:19}?\n{Symbol:1A}ABCDEFGHIJKLMNO\nPQRSTUVWXYZ{Symbol:1B}{Symbol:1C}{Symbol:1D}{Symbol:1E}{Symbol:1F}\n`abcdefghijklmno\npqrstuvwxyz{Symbol:20}{Symbol:21}{Symbol:22}{Symbol:23}\n\nTMsÿ\n¡♪\rɪ\rÊ\n´¿\nÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ\nĐÑÒÓÔÕÖרÙÚÛÜÝÞß\nàáâãäåæçèéêëìíîï\nðñòóôõö÷øùúûüýþÿ", "", "", "", @@ -3852,4 +3852,4 @@ "", "" ] -] \ No newline at end of file +] diff --git a/translations/German.json b/translations/German.json index 8b2b4aec..0c380f4e 100644 --- a/translations/German.json +++ b/translations/German.json @@ -215,7 +215,7 @@ "Magnus-Schwertfibel (Band 6)\n\nWillst du sie lesen?\n{Choice:03:1D}Ja. {Choice:FF}Kein Interesse.", "Magnus-Schwertfibel (Band 7)\n\nWillst du sie lesen?\n{Choice:03:21}Ja. {Choice:FF}Kein Interesse.", "Magnus-Schwertfibel (Band 8)\n\nWillst du sie lesen?\n{Choice:03:25}Ja. {Choice:FF}Kein Interesse.", - "Magnus-Schwertfibel (Band 1)\n\"Wände mit Geheimnissen!\"\nNur ein Kämpfer mit geschultem\nAuge wird seine Abenteuer bestehen!\nSo erkennt er, dass sich manche\nWand mit {Color:Red}Bomben {Color:White}einreiβen lässt.\nDoch nicht nur der Sehsinn ist gefragt!\nEin echter Profi weiβ dies zu tun:\nHalte den Knopf, der mit dem Schwert\nbelegt ist, gedrückt und lade es auf!\nWenn du jetzt {Color:Blue}gegen die Wand\nschlägst{Color:White}, hörst du den Unterschied!\n{Choice:03:0A}Weiterlesen. {Choice:FF}Beenden.", + "Magnus-Schwertfibel (Band 1)\n\"Wände mit Geheimnissen!\"\nNur ein Kämpfer mit geschultem\nAuge wird seine Abenteuer bestehen!\nSo erkennt er, dass sich manche\nWand mit {Color:Red}Bomben {Color:White}einreißen lässt.\nDoch nicht nur der Sehsinn ist gefragt!\nEin echter Profi weiß dies zu tun:\nHalte den Knopf, der mit dem Schwert\nbelegt ist, gedrückt und lade es auf!\nWenn du jetzt {Color:Blue}gegen die Wand\nschlägst{Color:White}, hörst du den Unterschied!\n{Choice:03:0A}Weiterlesen. {Choice:FF}Beenden.", "\"Was tun, Meister Magnus!?!\"\nWenn ein Gegner dich fest umklammert,\nbewahre einen kühlen Kopf und bleibe\nlocker! {Color:Blue}Drücke immer wieder {Key:Dpad}{Color:White},\nrauf, runter, hin und her!\nDann bist du schnell wieder frei!\n{Choice:03:0B}Weiterlesen. {Choice:FF}Beenden.", "\"Die acht Wunder von Hyrule - Eins!\"\nDer {Color:Red}Magische Bumerang{Color:White}.\nIrgendwo in Hyrule soll es\neinen Magischen Bumerang geben,\ndessen Flugrichtung man während\ndes Fluges beliebig ändern kann!\n{Choice:03:0C}Weiterlesen. {Choice:FF}Beenden.", "\"Gehab dich wohl, werter Leser!\"\nDies war der erste Band der...\n...Magnus-Schwertfibel.\nEs sind weitere Bände in Vorbereitung.\nAuch sie werden Tipps für\nAbenteurer-Profis enthalten.\nBitte bei der Post abholen! Band 2\nliegt dort demnächst bereit. Wohl auf!", @@ -230,10 +230,10 @@ "Magnus-Schwertfibel (Band 4)\n\"Miss dich mit den Mächtigen!\"\nBist du schon einer Kreatur begegnet,\ndie glänzt wie Gold?\nSie erscheint nur selten, wenn ganz\nbestimmte Fragmente vereinigt wurden.\nSie ist unvergleichlich stark,\ndoch sie {Color:Blue}lässt etwas Wertvolles fallen{Color:White},\nwenn du sie besiegst!\nLass dir diese Chance nicht entgehen!\n{Choice:03:16}Weiterlesen. {Choice:FF}Beenden.", "\"Was tun, Meister Magnus!?!\"\nDie Käfer-Stachis, voller Stacheln.\nDer stachelige Panzer ist gegen\nAngriffe mit dem Schwert immun.\nRammen sie deinen Schild, dann fallen\nsie auf den Rücken und sind hilflos.\nDu kannst sie auch mit dem {Color:Red}Wirbelstab{Color:White}\numkippen oder mit {Color:Red}Bomben{Color:White}!\nOder versuche es mit der {Color:Red}Sturzattacke{Color:White}!\nHöchst informativ, nicht wahr?\n{Choice:03:17}Weiterlesen. {Choice:FF}Beenden.", "\"Die acht Wunder von Hyrule - Vier\"\n{Color:Red}Fernzünder-Bomben{Color:White}.\nEs gibt Bomben, die explodieren\ngenau dann, wenn du es willst!\nSo sagt man jedenfalls. Es ist\nnatürlich nur ein Gerücht...\n{Choice:03:18}Weiterlesen. {Choice:FF}Beenden.", - "\"Gehab dich wohl, werter Leser!\"\nIch machte vor kurzem eine Reise zur...\n...{Color:Green}Lon Lon-Farm{Color:White}. Magnus der Erste\nsoll einst eine Kuh mit bloβen Händen...\n...besiegt haben. Dies erscheint mir\nnicht wirklich erstrebenswert...\nKühe sind schlieβlich\nkeine echten Gegner!\nDer Folgeband wird Band 5 sein.\nWohl auf!", + "\"Gehab dich wohl, werter Leser!\"\nIch machte vor kurzem eine Reise zur...\n...{Color:Green}Lon Lon-Farm{Color:White}. Magnus der Erste\nsoll einst eine Kuh mit bloßen Händen...\n...besiegt haben. Dies erscheint mir\nnicht wirklich erstrebenswert...\nKühe sind schließlich\nkeine echten Gegner!\nDer Folgeband wird Band 5 sein.\nWohl auf!", "Magnus-Schwertfibel (Band 5)\n\"Kampf der Elemente!\"\nDu bist vielleicht schon einem Monster\nbegegnet, das Eis-Flüche verwendet.\nDieser Gegner hat die lästige Eigenart,\nimmer wieder aus dem Nichts...\n...aufzutauchen, zu attackieren\nund dann wieder zu verschwinden.\nRichte doch einmal die {Color:Red}Lampe{Color:White}\nauf ihn! {Color:Blue}Feuer gegen Eis!{Color:White}\n{Choice:03:1A}Weiterlesen. {Choice:FF}Beenden.", - "\"Was tun, Meister Magnus!?!\"\nMolblins - halb Mensch, halb Schwein.\nSie sind groβe Gegner, die sich meist\nnahe dem Tyloria-Wald aufhalten.\nKämpfe mit dem Schwert, edler Recke!\nDeine Mühe wird {Color:Blue}reich belohnt{Color:White} werden!\n{Choice:03:1B}Weiterlesen. {Choice:FF}Beenden.", - "\"Die acht Wunder von Hyrule - Fünf\"\n{Color:Red}Talismane{Color:White}.\nOhne dein Zutun verbessern sie deine\nFähigkeiten! Wie wunderbar!\nSo heiβt es jedenfalls. Es ist\nnatürlich nur ein Gerücht...\n{Choice:03:1C}Weiterlesen. {Choice:FF}Beenden.", + "\"Was tun, Meister Magnus!?!\"\nMolblins - halb Mensch, halb Schwein.\nSie sind große Gegner, die sich meist\nnahe dem Tyloria-Wald aufhalten.\nKämpfe mit dem Schwert, edler Recke!\nDeine Mühe wird {Color:Blue}reich belohnt{Color:White} werden!\n{Choice:03:1B}Weiterlesen. {Choice:FF}Beenden.", + "\"Die acht Wunder von Hyrule - Fünf\"\n{Color:Red}Talismane{Color:White}.\nOhne dein Zutun verbessern sie deine\nFähigkeiten! Wie wunderbar!\nSo heißt es jedenfalls. Es ist\nnatürlich nur ein Gerücht...\n{Choice:03:1C}Weiterlesen. {Choice:FF}Beenden.", "\"Gehab dich wohl, werter Leser!\"\nGestern besuchte ich Alberich!\nIch bin froh, dass er wohlauf ist.\n... ... ...\nDoch da war dieser {Color:Blue}ältere Herr\nmit grünen Hosen{Color:White} auf dem Hügel...\nNun, bis zum nächsten Band:\nBand 6. Wohlauf!", "Magnus-Schwertfibel (Band 6)\n\"Nicht feuerfest!\"\nKennst du jene Kreaturen, die am\nganzen Körper bandagiert sind?\nSie umklammern dich, wenn du in\nihre Nähe kommst!\nAuch diese unangenehmen Gesellen\nhaben eine Schwachstelle!\nIhre Bandagen sind {Color:Blue}leicht entzündbar{Color:White}!\nSo nimm denn jenes Item, das brennt!\n{Choice:03:1E}Weiterlesen. {Choice:FF}Beenden.", "\"Was tun, Meister Magnus!?!\"\nTodesgrapscher und Terrorgrapscher.\nRiesenhände, die nach dir greifen!\nBesiege diese fiesen Gegner mit...\n...Pfeil und Bogen!\n\n{Choice:03:1F}Weiterlesen. {Choice:FF}Beenden.", @@ -241,19 +241,19 @@ "\"Gehab dich wohl, werter Leser!\"\nUnd wieder erhielt ich einen Leserbrief!\n\"Was ist dein Hobby?\":\n{Color:Blue}Training{Color:White}!\nAlso dann, bis zum nächsten Band:\nBand 7. Wohlauf!", "Magnus-Schwertfibel (Band 7)\n\"Schwertkunst für Fortgeschrittene\"\nDer {Color:Red}Wirbelhieb {Color:White}ist dir bekannt:\nim Rollen das Schwert schwingen.\nMaximus hat dich gelehrt, kurz vor dem\nAufrichten das Schwert zu zücken.\nMan kann es aber auch schon {Color:Blue}ziehen,\nwenn man gerade anfängt zu rollen{Color:White}!\nEs ist alles eine Frage des Timings.\nKonzentriere dich! Trainiere!\nAuch eine Reise von 1000 Meilen\nbeginnt mit einem simplen Schritt!\n{Choice:03:22}Weiterlesen. {Choice:FF}Beenden.", "\"Was tun, Meister Magnus!?!\"\nDubios tarnen sich...\nSie tragen Büsche oder Steine auf dem\nRückenpanzer und verstecken sich so.\nEs gibt noch andere Wege, sie zu\nentlarven, als sie hochzuheben.\nMit einem Pling des {Color:Red}Wirbelstabs{Color:White}!\nMit einem Sog des {Color:Red}Magischen Krugs{Color:White}!\nWar das nicht lehrreich?\n\n{Choice:03:23}Weiterlesen. {Choice:FF}Beenden.", - "\"Die acht Wunder von Hyrule - Sieben\"\nDie Bob-ombs.\nIch habe sie bereits in Band 3\nvorgestellt. Wenn du sie besiegst,\nlassen sie mit hoher Wahrscheinlichkeit\n{Color:Red}Bomben {Color:White}liegen.\nSo heiβt es. Es könnte allerdings\nauch ein Märchen sein...\n{Choice:03:24}Weiterlesen. {Choice:FF}Beenden.", - "\"Gehab dich wohl, werter Leser!\"\n{Color:Blue}Der nächste Band ist schon der letzte!{Color:White}\nDann lasse ich das Schreiben sein und\ngebe mich wieder ausschlieβlich...\n...der Schwertkunst hin. Ja!\nIch bin Literat und Schwertmeister!\nAlso dann, bis zum nächsten und\nletzten Band: Band 8. Wohlauf!", - "Magnus-Schwertfibel (Band 8)\n\"So wirst du Junior-Schwertmeister\"\nSicher wünschtest du schon, die\n{Color:Red}Wirbelattacke {Color:White}schneller ausführen...\n...die {Color:Red}Körperteilung {Color:White}schneller\naktivieren...\n...die {Color:Red}Groβe Wirbelattacke{Color:White} über\nlängere Zeit ausführen zu können?\nSolche Gedanken hat jeder\ngute Schwertkämpfer...\nEs soll Menschen geben, die diese\nFähigkeiten gemeistert haben.\nAngeblich {Color:Blue}kannst du sie treffen,\nwenn etwas Glück mit im Spiel ist{Color:White}!\n{Choice:03:26}Weiterlesen. {Choice:FF}Beenden.", - "\"Was tun, Meister Magnus!?!\"\nEyegore, einäugige Steinstatuen...\nSie bewegen sich, wenn dein {Color:Red}Pfeil {Color:White}ihr\nAuge trifft.\nWenn du sie besiegst, {Color:Blue}lassen sie{Color:White} mit\nhoher Wahrscheinlichkeit {Color:Blue}Pfeile fallen{Color:White}!\nAlso, verschieβ deine Pfeile, aber\ntriff dann auch mit dem letzten Pfeil!\n{Choice:03:27}Weiterlesen. {Choice:FF}Beenden.", + "\"Die acht Wunder von Hyrule - Sieben\"\nDie Bob-ombs.\nIch habe sie bereits in Band 3\nvorgestellt. Wenn du sie besiegst,\nlassen sie mit hoher Wahrscheinlichkeit\n{Color:Red}Bomben {Color:White}liegen.\nSo heißt es. Es könnte allerdings\nauch ein Märchen sein...\n{Choice:03:24}Weiterlesen. {Choice:FF}Beenden.", + "\"Gehab dich wohl, werter Leser!\"\n{Color:Blue}Der nächste Band ist schon der letzte!{Color:White}\nDann lasse ich das Schreiben sein und\ngebe mich wieder ausschließlich...\n...der Schwertkunst hin. Ja!\nIch bin Literat und Schwertmeister!\nAlso dann, bis zum nächsten und\nletzten Band: Band 8. Wohlauf!", + "Magnus-Schwertfibel (Band 8)\n\"So wirst du Junior-Schwertmeister\"\nSicher wünschtest du schon, die\n{Color:Red}Wirbelattacke {Color:White}schneller ausführen...\n...die {Color:Red}Körperteilung {Color:White}schneller\naktivieren...\n...die {Color:Red}Große Wirbelattacke{Color:White} über\nlängere Zeit ausführen zu können?\nSolche Gedanken hat jeder\ngute Schwertkämpfer...\nEs soll Menschen geben, die diese\nFähigkeiten gemeistert haben.\nAngeblich {Color:Blue}kannst du sie treffen,\nwenn etwas Glück mit im Spiel ist{Color:White}!\n{Choice:03:26}Weiterlesen. {Choice:FF}Beenden.", + "\"Was tun, Meister Magnus!?!\"\nEyegore, einäugige Steinstatuen...\nSie bewegen sich, wenn dein {Color:Red}Pfeil {Color:White}ihr\nAuge trifft.\nWenn du sie besiegst, {Color:Blue}lassen sie{Color:White} mit\nhoher Wahrscheinlichkeit {Color:Blue}Pfeile fallen{Color:White}!\nAlso, verschieß deine Pfeile, aber\ntriff dann auch mit dem letzten Pfeil!\n{Choice:03:27}Weiterlesen. {Choice:FF}Beenden.", "\"Die acht Wunder von Hyrule - Acht\"\nArmos, von den Minish erschaffen.\nSie {Color:Blue}lassen {Color:White}manchmal {Color:Blue}Glücksfragmente\nfallen{Color:White}, wenn du sie besiegst!\nSo sagt man jedenfalls. Es könnte\nnatürlich auch ein Märchen sein...\n{Choice:03:28}Weiterlesen. {Choice:FF}Beenden.", "\"Gehab dich wohl, oh werter Leser!\"\nDies war {Color:Blue}der letzte Band{Color:White}!\nWenn du mich sehen willst, bist\ndu immer herzlich willkommen...\nVielen Dank für's Lesen!\nUnd jetzt noch zum letzten Male:\nWohlauf und gehab dich wohl!" ], [ "Leer", "Schwert des Alberich", - "Weiβes Schwert", - "Weiβes Schwert der Zwei", - "Weiβes Schwert der Drei", + "Weißes Schwert", + "Weißes Schwert der Zwei", + "Weißes Schwert der Drei", "", "Schwert der Vier", "Bombe(n)", @@ -295,7 +295,7 @@ "Gelber Tyrup", "Grüner Tyrup", "Blauer Tyrup", - "Weiβer Tyrup", + "Weißer Tyrup", "Nayrus Talisman", "Farores Talisman", "Dins Talisman", @@ -326,12 +326,12 @@ "Ausfall", "Steinspalter", "Strahlenattacke", - "Groβe Wirbelattacke", + "Große Wirbelattacke", "Sturzattacke", "Energiestrahl", "Dungeon-Karte", "Kompass", - "Groβer Schlüssel", + "Großer Schlüssel", "Kleiner Schlüssel", "1 Rubin", "5 Rubine", @@ -349,9 +349,9 @@ "", "Herzcontainer", "Herzteil(e)", - "Groβe Geldbörse", - "Groβe Bombentasche", - "Groβer Pfeilköcher", + "Große Geldbörse", + "Große Bombentasche", + "Großer Pfeilköcher", "Glücksbeutel", "Brot", "Tortenstück", @@ -371,18 +371,18 @@ "Ausfall:\nRüste dich aus mit\n{Color:Red}Schwert {Color:White}und {Color:Red}Pegasus-\nStiefeln{Color:White} und lauf los!", "Steinspalter:\nZerschlage den Krug mit\ndem {Color:Red}Schwert{Color:White}! Und es\nsei vollbracht!", "Strahlenattacke:\nDie Energieanzeige muss voll\nsein. Zücke dein {Color:Red}Schwert{Color:White}!", - "Groβe Wirbelattacke:\nStarte eine {Color:Red}Wirbelattacke {Color:White}{Symbol:0D}\ndrücke stetig den Knopf!", + "Große Wirbelattacke:\nStarte eine {Color:Red}Wirbelattacke {Color:White}{Symbol:0D}\ndrücke stetig den Knopf!", "Sturzattacke:\nZieh den {Color:Red}Greifenmantel {Color:White}an,\nspringe hoch und zücke\nim Sprung das {Color:Red}Schwert{Color:White}!", "Energiestrahl:\nBesitze weniger als ein Herz\nund schwinge mit letzter\nKraft das {Color:Red}Schwert{Color:White}!" ], [ "...", - "{04:10:0C}{Color:Red}Schwert des Alberich {Color:White}erhalten!\nDas Wunderwerk deines Groβvaters.", - "{04:10:0E}{Color:Red}Weiβes Schwert {Color:White}erhalten!\nEin schönes Schwert mit weiβem Glanz!\nDas {Color:Red}Schwert des Alberich{Color:White}\nbrauchst du nicht mehr.", + "{04:10:0C}{Color:Red}Schwert des Alberich {Color:White}erhalten!\nDas Wunderwerk deines Großvaters.", + "{04:10:0E}{Color:Red}Weißes Schwert {Color:White}erhalten!\nEin schönes Schwert mit weißem Glanz!\nDas {Color:Red}Schwert des Alberich{Color:White}\nbrauchst du nicht mehr.", "{04:10:00}Das Schwert hat nun die Kraft des\n{Color:Red}Erd-{Color:White} und des {Color:Red}Flammen-Elements{Color:White}.", "{04:10:00}Das {Color:Red}Tropfen-Element{Color:White} wurde übertragen!\n\nDurch die Übertragung des {Color:Red}Elements{Color:White}\nkannst du dich jetzt {Color:Blue}dreiteilen{Color:White}!", "{04:10:00}Das {Color:Red}Wind-Element{Color:White} wurde übertragen!\n\n{07:05:06}", - "{04:10:00}Die Kraft der vier Elemente wurde\nauf das {Color:Red}Weiβe Schwert {Color:White}übertragen.\nNun ist es das {Color:Red}Schwert der Vier{Color:White}!\nDu kannst dich jetzt vierteilen!\nLädst du das Schwert mit Energie auf,\nindem du den Knopf gedrückt hältst,\nund lässt ihn dann los,\nfeuerst du einen {Color:Blue}Strahl {Color:White}ab,\nder versteinerte Menschen von dem\n{Color:Blue}Fluch des Hexenmeisters{Color:White} befreit!", + "{04:10:00}Die Kraft der vier Elemente wurde\nauf das {Color:Red}Weiße Schwert {Color:White}übertragen.\nNun ist es das {Color:Red}Schwert der Vier{Color:White}!\nDu kannst dich jetzt vierteilen!\nLädst du das Schwert mit Energie auf,\nindem du den Knopf gedrückt hältst,\nund lässt ihn dann los,\nfeuerst du einen {Color:Blue}Strahl {Color:White}ab,\nder versteinerte Menschen von dem\n{Color:Blue}Fluch des Hexenmeisters{Color:White} befreit!", "{04:10:0E}{Color:Red}Bombentasche{Color:White} erhalten!\n\nUnd 10 {Color:Red}Bomben{Color:White} gratis dazu!\nRäume damit alles Mögliche aus dem Weg!", "{04:10:0E}{Color:Red}Fernzünder-Bomben{Color:White} erhalten!\nDrücke den Knopf, um eine\nBombe abzulegen! Drückst\ndu den Knopf erneut, explodiert sie.", "{04:10:0E}{Color:Red}Bogen{Color:White} erhalten! Damit kannst\ndu Feinde aus der Entfernung treffen!", @@ -393,7 +393,7 @@ "{04:10:00}{Color:Red}Spiegel-Schild {Color:White}erhalten!\n\nEin strahlender, starker Schild, der\nAngriffe zurückprallen lassen kann!", "{Color:Red}Lampe {Color:White}erhalten!\n\nSehr praktisch! Einfach mit dem\nKnopf an- oder ausschalten!", "\"Lampe (an)\" - Lege sie im Item-Menü\nauf {Key:A} oder {Key:B}!", - "{04:10:0E}{Color:Red}Magischen Krug {Color:White}erhalten!\n\nDrücke den Knopf, um den Sog zu\naktivieren und lass ihn los,\num das Angesaugte wegzuschieβen.\n\nLege das Item im {Color:Blue}Item-Menü\n{Color:White}auf {Key:A} oder {Key:B}.", + "{04:10:0E}{Color:Red}Magischen Krug {Color:White}erhalten!\n\nDrücke den Knopf, um den Sog zu\naktivieren und lass ihn los,\num das Angesaugte wegzuschießen.\n\nLege das Item im {Color:Blue}Item-Menü\n{Color:White}auf {Key:A} oder {Key:B}.", "{04:10:0E}{Color:Red}Wirbelstab {Color:White}erhalten!\n\nEr dreht Dinge um und verwandelt\nLöcher in Sprungbretter!", "{04:10:0E}{Color:Red}Maulwurfshandschuhe {Color:White}erhalten! Damit\nkannst du graben wie ein Maulwurf!", "{04:10:0E}{Color:Red}Greifenmantel {Color:White}erhalten!\n\nMit ihm kannst du fliegen. Je länger\ndu den Knopf gedrückt hältst,\ndesto weiter fliegst du!", @@ -414,7 +414,7 @@ "", "{04:10:0E}{Color:Red}Rotes Elixier {Color:White}erhalten!\nEs füllt deine Energie komplett auf!", "{04:10:0E}{Color:Red}Blaues Elixier {Color:White}erhalten!\nEs füllt deine Energie wieder auf!", - "Du hast {Color:Red}Wasser {Color:White}in die Flasche gefüllt!\nGieβe es auf verschiedene Sachen!", + "Du hast {Color:Red}Wasser {Color:White}in die Flasche gefüllt!\nGieße es auf verschiedene Sachen!", "{04:10:0E}{Color:Red}Gongol-Wasser {Color:White}erhalten! Das gibt\nes nur auf dem Gongol-Berg!", "Du hast eine {Color:Red}Fee {Color:White}eingefangen!\nSie hilft dir, wenn du am Ende bist.", "{04:10:0E}{Color:Red}Roten Tyrup{Color:White} erhalten!\nTrink, und du findest viele Herzen!", @@ -422,10 +422,10 @@ "{04:10:0E}{Color:Red}Gelben Tyrup {Color:White}erhalten!\nTrink, und du findest viele Rubine!", "{04:10:0E}{Color:Red}Grünen Tyrup {Color:White}erhalten! Trink, und\ndu findest viele {Color:Red}Mysteriöse Muscheln{Color:White}!", "{04:10:0E}{Color:Red}Blauen Tyrup {Color:White}erhalten!\nTrink, und du findest viele Items!", - "{04:10:0E}{Color:Red}Weiβen Tyrup {Color:White}erhalten! Trink,\nund du findest viele {Color:Red}Glücksfragmente{Color:White}!", + "{04:10:0E}{Color:Red}Weißen Tyrup {Color:White}erhalten! Trink,\nund du findest viele {Color:Red}Glücksfragmente{Color:White}!", "{04:10:0E}{Color:Red}Nayrus Talisman {Color:White}erhalten!\nDeine Abwehr ist für kurze Zeit stärker!", - "{04:10:0E}{Color:Red}Farores Talisman{Color:White} erhalten! Kraft\nund Abwehr sind für kurze Zeit gröβer!", - "{04:10:0E}{Color:Red}Dins Talisman {Color:White}erhalten!\nDeine Kraft ist für kurze Zeit gröβer!", + "{04:10:0E}{Color:Red}Farores Talisman{Color:White} erhalten! Kraft\nund Abwehr sind für kurze Zeit größer!", + "{04:10:0E}{Color:Red}Dins Talisman {Color:White}erhalten!\nDeine Kraft ist für kurze Zeit größer!", "", "", "{04:10:0E}{Color:Red}Schwert des Alberich {Color:White}erhalten!\n\nLiefere es unbeschadet ab!\nUnd verliere es nicht!", @@ -445,27 +445,27 @@ "{04:10:0E}{Color:Red}Tropfen-Element{Color:White} erhalten!\n\nDas {Color:Red}Tropfen-Element{Color:White} enthält die Kraft,\nFeuchtigkeit zu spenden.", "{04:10:0E}{Color:Red}Wind-Element {Color:White}erhalten!\n\nDas {Color:Red}Wind-Element{Color:White} enthält die Kraft,\ndie Samen trägt und Früchte bringt.", "{04:10:0E}{Color:Red}Kletter-Ring {Color:White}erhalten!\n\nJetzt kannst du dort hochklettern,\nwo du bisher nicht hingelangt bist.", - "{04:10:0E}{Color:Red}Kraftarmband {Color:White}erhalten!\nKleiner Mann - groβe Kraft!", + "{04:10:0E}{Color:Red}Kraftarmband {Color:White}erhalten!\nKleiner Mann - große Kraft!", "{Color:Red}Flossen {Color:White}erhalten! Drücke {Color:Red}{Key:A} {Color:White}zum{Color:Red}\n{Color:White}Schwimmen! Drücke {Color:Red}{Key:B}{Color:White} zum Tauchen!", "{04:10:0E}{Color:Red}Karte von Hyrule {Color:White}erhalten!\nDamit verläufst du dich nicht!", "{04:10:0E}Du hast die {Color:Red}Wirbelattacke {Color:White}erlernt!\nEine Technik von Meister Magnus!", "{04:10:0E}Du hast den {Color:Red}Wirbelhieb {Color:White}erlernt!\nJeder Hieb ist von enormer Kraft!", "{04:10:0E}Du hast den {Color:Red}Ausfall {Color:White}erlernt! Attackiere\nmit der Schnelligkeit des Windes!", "{04:10:0E}Du hast den {Color:Red}Steinspalter {Color:White}erlernt!\nZerschlage spielend Steine und Krüge!", - "{04:10:0E}Du hast die {Color:Red}Strahlenattacke {Color:White}erlernt!\nAus der Schwertspitze schieβen...\n...Strahlen hervor!\nFunktioniert nur bei voller Energie!", - "{04:10:0E}Du hast die {Color:Red}Groβe Wirbelattacke\n{Color:White}erlernt! Die höchste Schwerttechnik!", + "{04:10:0E}Du hast die {Color:Red}Strahlenattacke {Color:White}erlernt!\nAus der Schwertspitze schießen...\n...Strahlen hervor!\nFunktioniert nur bei voller Energie!", + "{04:10:0E}Du hast die {Color:Red}Große Wirbelattacke\n{Color:White}erlernt! Die höchste Schwerttechnik!", "{04:10:0E}Du hast die {Color:Red}Sturzattacke{Color:White} erlernt!\nMit voller Kraft vom Himmel herab!", - "{04:10:0E}Du hast den {Color:Red}Energiestrahl {Color:White}erlernt!\nAus der Schwertspitze schieβen...\n...Strahlen hervor!\nSehr praktisch in Notlagen!", + "{04:10:0E}Du hast den {Color:Red}Energiestrahl {Color:White}erlernt!\nAus der Schwertspitze schießen...\n...Strahlen hervor!\nSehr praktisch in Notlagen!", "{04:10:0E}{Color:Red}Dungeon-Karte {Color:White}erhalten!\nBetrachte die {Color:Blue}Karte{Color:White}!\nBlaue Räume hast du bereits betreten.\nEin Raum, der blinkt, zeigt an,\nwo du dich gerade befindest.\nWähle ein Stockwerk aus mit {Key:Dpad}.", "{Color:Red}Kompass {Color:White}erhalten! Du siehst,\nwo sich interessante Dinge befinden!\nDrücke START und betrachte die Karte\ndurch Drücken von {Color:Red}{Key:Left} {Color:White}oder {Color:Red}{Key:Right}{Color:White}!", - "{Color:Red}Groβen Schlüssel {Color:White}erhalten!\nEr öffnet groβe Schlösser!", + "{Color:Red}Großen Schlüssel {Color:White}erhalten!\nEr öffnet große Schlösser!", "{Color:Red}Kleinen Schlüssel {Color:White}erhalten!\n\nEr öffnet verschlossene Türen und\nBarrikaden in diesem Dungeon.", "{Color:Red}Grünen Rubin {Color:White}erhalten!{Color:Red}\n{Color:White}Klein aber fein!", "{Color:Red}Blauen Rubin {Color:White}({Symbol:18} 5 Grüne Rubine)\nerhalten! Toll!", "{Color:Red}Roten Rubin {Color:White}({Symbol:18} 20 Grüne Rubine)\nerhalten! Was für ein Glück!", - "{Color:Red}Groβen Grünen Rubin {Color:White}({Symbol:18}50 Grüne{Color:Red}\n{Color:White}Rubine) erhalten! Wahnsinn!", - "{Color:Red}Groβen Blauen Rubin {Color:White}({Symbol:18}100 Grüne{Color:Red}\n{Color:White}Rubine) erhalten! Juhuuu!", - "{Color:Red}Groβen Roten Rubin {Color:White}({Symbol:18} 200 Grüne\nRubine) erhalten! Grins!!!", + "{Color:Red}Großen Grünen Rubin {Color:White}({Symbol:18}50 Grüne{Color:Red}\n{Color:White}Rubine) erhalten! Wahnsinn!", + "{Color:Red}Großen Blauen Rubin {Color:White}({Symbol:18}100 Grüne{Color:Red}\n{Color:White}Rubine) erhalten! Juhuuu!", + "{Color:Red}Großen Roten Rubin {Color:White}({Symbol:18} 200 Grüne\nRubine) erhalten! Grins!!!", "", "{04:10:0E}Iss die {Color:Red}Quatschbirne{Color:White}!\nDann kannst du mit den {Color:Green}Minish {Color:White}reden!", "{Color:Red}Glücksfragment {Color:White}erhalten!\nDie Fragmente sollen Glück bringen.", @@ -475,10 +475,10 @@ "Du hast eine {Color:Red}Fee {Color:White}gefunden!\nSie gibt dir neue Energie!", "", "{Color:Red}Herzcontainer {Color:White}erhalten! Ein\nHerz mehr und wieder volle Energie!", - "{Color:Red}Groβe Bombentasche {Color:White}erhalten!\nJetzt kannst du mehr Bomben tragen!", - "{Color:Red}Groβe Geldbörse{Color:White} erhalten!\nJetzt kannst du mehr Rubine tragen!", - "{04:10:00}{Color:Red}Gröβere Bombentasche {Color:White}erhalten!\n\nJetzt kannst du mehr Bomben tragen!{Color:Red}\n{Color:White}Räume damit alles Mögliche aus dem Weg!", - "{Color:Red}Groβen Pfeilköcher {Color:White}erhalten!\nJetzt kannst du mehr Pfeile tragen!", + "{Color:Red}Große Bombentasche {Color:White}erhalten!\nJetzt kannst du mehr Bomben tragen!", + "{Color:Red}Große Geldbörse{Color:White} erhalten!\nJetzt kannst du mehr Rubine tragen!", + "{04:10:00}{Color:Red}Größere Bombentasche {Color:White}erhalten!\n\nJetzt kannst du mehr Bomben tragen!{Color:Red}\n{Color:White}Räume damit alles Mögliche aus dem Weg!", + "{Color:Red}Großen Pfeilköcher {Color:White}erhalten!\nJetzt kannst du mehr Pfeile tragen!", "{04:10:0E}{Color:Red}Glücksbeutel {Color:White}erhalten!\n\nIn ihm kannst du {Color:Red}Glücksfragmente{Color:White}\ntransportieren.\nDrücke START und schau dir den\nInhalt im Status-Menü an!", "Du hast ein {Color:Red}Brot {Color:White}gekauft!\nDas sieht aber lecker aus!", "Du hast ein {Color:Red}Croissant {Color:White}gekauft!\nEs zergeht förmlich auf der Zunge!", @@ -488,19 +488,19 @@ "30 {Color:Red}Bomben {Color:White}erhalten!\nSie sind jetzt in der Bombentasche!", "10 {Color:Red}Pfeile {Color:White}erhalten!\nSie sind jetzt im Pfeilköcher!", "30 {Color:Red}Pfeile {Color:White}erhalten!\nSie sind jetzt im Pfeilköcher!", - "Ein {Color:Red}Glücksschmetterling{Color:White}! Jetzt kannst\ndu Pfeile schneller abschieβen!", + "Ein {Color:Red}Glücksschmetterling{Color:White}! Jetzt kannst\ndu Pfeile schneller abschießen!", "Ein {Color:Red}Glücksschmetterling{Color:White}! Jetzt kannst\ndu schneller graben als vorher!", "Ein {Color:Red}Glücksschmetterling{Color:White}! Jetzt kannst\ndu schneller schwimmen als vorher!", "{Color:Red}Schnellere Wirbelattacke{Color:White}! Schon nach\nkurzem Drücken beginnt die Attacke!", "{Color:Red}Schnelleres Aufladen des Schwertes{Color:White}!\nDu multiplizierst dich auf einen Schlag!", - "{Color:Red}Verlängerung der groβen\nWirbelattacke{Color:White}! Wirbel!!!", + "{Color:Red}Verlängerung der großen\nWirbelattacke{Color:White}! Wirbel!!!", "{Var:1} {Color:Red}Mysteriöse Muscheln {Color:White}erhalten!", "{Color:Red}Mysteriöse Muschel {Color:White}erhalten!", "Du hast deinen {Color:Red}Schild {Color:White}verloren!", "Du hast deinen {Color:Red}Schild {Color:White}zurück!", "", "{04:10:0E}Willkommen am Brunnen der Abenteurer!\n\nIch brauche Rubine! Viele, viele\nRubine! Wirf bitte all deine Rubine...\n...in diesen Brunnen!\n{Choice:05:7C}Okay. {Choice:05:7D}Spinnst du!?!", - "{04:10:0E}{04:10:0E}Echt?!?\n\nDu weiβt schon, dass du dann\nüberhaupt keine Rubine mehr hast!\nWirfst du all deine Rubine hinein?\n{Choice:05:7E}Ja. {Choice:05:7D}Quatsch!", + "{04:10:0E}{04:10:0E}Echt?!?\n\nDu weißt schon, dass du dann\nüberhaupt keine Rubine mehr hast!\nWirfst du all deine Rubine hinein?\n{Choice:05:7E}Ja. {Choice:05:7D}Quatsch!", "{04:10:0E}Schon klar.\nIch hab Zeit... Dann warte ich weiter.", "{04:10:0E}Du bist aber lieb!\nIch brauche gar keine Rubine!\nWeil du so freundlich bist, möchte ich\ndir bei deinen Abenteuern helfen.", "{04:10:0E}Mögest du erfolgreich sein...", @@ -509,10 +509,10 @@ "{04:10:0E}Du bist sehr ehrlich!\nDeshalb werde ich dir helfen.", "{04:10:0E}Willkommen am Brunnen der Abenteurer!\n\nDarf ich dir einige Fragen über deine\nAbenteuer stellen?\n{Choice:FF}Natürlich. {Choice:FF}Nein.", "{04:10:0E}Das Flammen-Element war das erste,\ndas du errungen hast, nicht wahr?\n{Choice:05:8A}Ja. {Choice:05:8C}Nein.", - "{04:10:0E}Dein Groβvater heiβt Albrecht, nicht?\n{Choice:05:8A}Ja. {Choice:05:8D}Nein.", + "{04:10:0E}Dein Großvater heißt Albrecht, nicht?\n{Choice:05:8A}Ja. {Choice:05:8D}Nein.", "{04:10:0E}Melta vom Gongol-Berg hat sieben\nSchüler, stimmt's?\n{Choice:05:8E}Ja. {Choice:05:8A}Nein.", - "{04:10:0E}Heiβt die Frucht, die man isst, um die\nMinish zu verstehen, Laberbirne?\n{Choice:05:8A}Ja. {Choice:05:8F}Nein.", - "{04:10:0E}Hat der jetzige König von Hyrule,\nDartus, einen weiβen Mantel?\n{Choice:05:8A}Ja. {Choice:05:8B}Nein.", + "{04:10:0E}Heißt die Frucht, die man isst, um die\nMinish zu verstehen, Laberbirne?\n{Choice:05:8A}Ja. {Choice:05:8F}Nein.", + "{04:10:0E}Hat der jetzige König von Hyrule,\nDartus, einen weißen Mantel?\n{Choice:05:8A}Ja. {Choice:05:8B}Nein.", "{04:10:0E}Sehr gut. Dann beantworte bitte\nmeine Fragen!\n{07:05:84}", "{04:10:0E}Du sagst nicht die Wahrheit!\nZur Strafe verlierst du alle Pfeile!", "{04:10:0E}Du hast all meine Fragen zu deinen\nAbenteuern richtig beantwortet!\nDeshalb werde ich dir helfen.", @@ -545,8 +545,8 @@ "{Symbol:07} Gongol-Mine\n{Symbol:09} Gongol-Wand", "{Symbol:07} Schloss Hyrule - Stadt Hyrule {Symbol:08}\n{Symbol:09} Gongol-Berg - Hylia-See {Symbol:0A}", "Lon Lon-Farm", - "{Symbol:07} Gongol-Mine\n{Symbol:0A} Abkürzung zum Fuβ des Berges", - "{Symbol:08} Abkürzung zum Fuβ des Berges", + "{Symbol:07} Gongol-Mine\n{Symbol:0A} Abkürzung zum Fuß des Berges", + "{Symbol:08} Abkürzung zum Fuß des Berges", "{Symbol:09} Gongol-Berg", "{Symbol:0A} Hylia-See\n{Symbol:08} Laden der Hexe Syrup", "Poemuns Haus", @@ -558,7 +558,7 @@ "", "Liebe Mutter,\nich bin im Haus nebenan.", "Bestseller der Saison:\n\nAuf Platz 3:\nDie unendliche Geschichte von Hyrule\nAuf Platz 2:\nPrinzessin Zeldas Tagebuch\nAuf Platz 1:\nVaati, der Schreckliche", - "Notiz von Hagar\n\nMeistens hilft es, nach drauβen zu\ngehen und etwas zu rammen!", + "Notiz von Hagar\n\nMeistens hilft es, nach draußen zu\ngehen und etwas zu rammen!", "", "", "", @@ -633,7 +633,7 @@ ], [ "", - "Du hast alle Glücksfragmente! Das\nmusst du {Color:Green}Groβvater Alberich{Color:White} erzählen!", + "Du hast alle Glücksfragmente! Das\nmusst du {Color:Green}Großvater Alberich{Color:White} erzählen!", "Die beiden {Color:Red}Fragmente {Color:White}passen perfekt!\nJetzt geschieht etwas Wunderbares!", "", "{04:13}Zu diesem Windmal reisen?\n{04:13}{Choice:FF} Ja. {Choice:FF} Nein.{08:FF}", @@ -644,7 +644,7 @@ "", "", "Gongol-Berg", - "Fuβ des Gongol-Berges", + "Fuß des Gongol-Berges", "Geheime Welt von Tabanta", "Ruine des Windes", "Tal der Königsfamilie", @@ -750,7 +750,7 @@ "Eyegore Steinstatue", "Händler-Deku", "Armos", - "Flederbeiβer", + "Flederbeißer", "Keaton", "Ghini", "Gibdo", @@ -799,7 +799,7 @@ "Sandkiller", "Imos", "Dornen-Schleim", - "Groβer Oktorok", + "Großer Oktorok", "Gyorg (M{Symbol:15}W)", "Biggoron", "Grüner Riesenschleim", @@ -822,31 +822,31 @@ "Rätselhaftes Wesen, das wie eine Mütze\naussieht. Sucht nach einem Weg,\nden Fluch des Hexenmeisters\nunwirksam zu machen.\nBehandelt {Player} wie ein Kleinkind,\nmag {Player} aber eigentlich sehr.", "Vaati nach der Verwandlung, die er\nmit Hilfe von Ezelos Mütze vollzog.\nEr sucht nach dem Force, um das\nmächtigste Wesen der Welt zu werden.", "König von Hyrule. Er war früher\nhervorragender Schwertkämpfer.\nAls junger Mann trat er im Schwert-\nkampf-Turnier gegen Alberich an...\n...und erkämpfte ein Unentschieden.", - "Die groβe Stütze für das Land Hyrule.\nKümmert sich auch um Zeldas Erziehung.\nEin schwieriger Job, weil Zelda immer\nwieder einfach wegläuft.", + "Die große Stütze für das Land Hyrule.\nKümmert sich auch um Zeldas Erziehung.\nEin schwieriger Job, weil Zelda immer\nwieder einfach wegläuft.", "Bester Schmied von ganz Hyrule. Als\njunger Mann war er Schwertkämpfer.\nGuter Freund von König Dartus.\nIn ihrer Jugend...\n...traten die beiden oft und gerne\ngegeneinander im Schwertkampf an.", "Bürgermeister von Stadt Hyrule.\nSammelt leidenschaftlich Masken.\nIm Garten hat er einen Zufluchtsort\nim Falle eines Angriffs durch Monster.", "Der zweite Postangestellte. Soll Eilfried\nhelfen, weil der so viel zu tun hat.\nEr arbeitet so schnell, wie er gerade\nLust hat. Ganz anders als Eilfried.", - "Eifrig und gewissenhaft verrichtet er\nalle Arbeiten, die in der Post anfallen.\nSeinen Stempel darf keiner auβer ihm\nbenutzen. Er trägt ihn am Handgelenk.", + "Eifrig und gewissenhaft verrichtet er\nalle Arbeiten, die in der Post anfallen.\nSeinen Stempel darf keiner außer ihm\nbenutzen. Er trägt ihn am Handgelenk.", "Besitzer von {Color:Blue}Schlumms Schuhladen{Color:White}.\nEr kann im Schlaf Schuhe herstellen!\nSeine Schuhe sind von höchster\nQualität. Auch Zelda trägt sie gern.", "Unfreundlicher Professor, der sich nur\nfür die Minish-Forschung interessiert.\nEr ahnt nicht, dass er sein\nHaus mit einem Minish teilt.", "Besitzer des {Color:Blue}Minitendo-Ladens{Color:White}.\nHervorragender Figurenmacher.\nDas Sammeln von {Color:Blue}Mysteriösen\nMuscheln{Color:White} ist sein Hobby.", "Besitzer des {Color:Blue}Glücksspiel-Ladens{Color:White}.\nJüngerer Bruder von Meister Minitendo.\nTräumt von einem ehrlichen Leben, hat\naber trotzdem diesen Laden eröffnet.", "Besitzer von {Color:Blue}Aiyas Item-Laden{Color:White} in\nder Stadt. Er hat so viel zu tun,\ndass er sich kaum um seinen Hund\nSchnappzu kümmern kann.", "Besitzer von {Color:Blue}Shimaros Laden{Color:White}.\nIn seinem Marionettenspiel...\n...kann man gegen Dungeon-Monster\nkämpfen, als wären sie echt.", - "Er möchte sein Haus in der Stadt\nvermieten, ist aber so arrogant,\ndass sich kein Mieter findet.\nEr selbst weiβ nicht, woran es liegt.", + "Er möchte sein Haus in der Stadt\nvermieten, ist aber so arrogant,\ndass sich kein Mieter findet.\nEr selbst weiß nicht, woran es liegt.", "Junge Frau, die in Stadt Hyrule\nviele Hühner aufzieht.\nSie ist dankbar, wenn man ihre\nausgebüchsten Hühner zurückbringt.", "Gemüsehändler von Stadt Hyrule.\nVerkauft nur frisches Gemüse.\nStreitet sich mit Bruna darüber, was\ngesünder ist: Gemüse oder Obst.", "Obsthändler von Stadt Hyrule.\nPreist mit lauter Stimme seine Ware an.\nEr hasst Gemüse und hat keine Melonen,\nweil Melonen angeblich Gemüse sind.", "Obwohl er ein Erwachsener ist,\nfindet er leicht Tyrup,\nder von den Minish hergestellt wird.\nEin geschickter Verkäufer.", - "Sehr fleiβiger Briefträger.\nBringt jeden Tag pünktlich die Post.", + "Sehr fleißiger Briefträger.\nBringt jeden Tag pünktlich die Post.", "Eremit, der auf dem Gongol-Berg lebt.\nBesitzt viele Glücksfragmente.\nIst stolz darauf, dass er einmal im\nSchwertkampf-Turnier gewonnen hat.", "Sie lebt ohne Poemuns Erlaubnis in\nseinem Haus auf der Beele-Hochebene.\nSie mag es nicht, wenn es hell ist.\nWer ist sie wirklich?", "Kümmert sich um den Friedhof\nim Tal der Königsfamilie.\nEr hat eine Gabe. Er kann\nmit Gespenstern reden.\nEr vereint Fragmente, die er beim\nGraben findet, mit Gespenstern.", "Der König von Hyrule aus\nferner Vergangenheit.\nBeschützt als Geist Hyrule und ist\nmit dem Volk des Windes befreundet.", "Hexe, die im Tyloria-Wald lebt.\nVerkauft magisches Zubehör.\nSucht einen Schüler, den sie in der\nKunst der Magie unterweisen kann.", - "Die Hohe Feenkönigin vom Tyloria-Wald.\nVon ihr erhält man die Groβe Geldbörse.", - "Hohe Schimmer-Fee vom\nGongol-Berg. Von ihr erhält man...\n...die Groβe Bombentasche.", - "Hohe Libellen-Fee vom Tal der\nKönigsfamilie. Sie verschenkt...\n...den Groβen Pfeilköcher.", + "Die Hohe Feenkönigin vom Tyloria-Wald.\nVon ihr erhält man die Große Geldbörse.", + "Hohe Schimmer-Fee vom\nGongol-Berg. Von ihr erhält man...\n...die Große Bombentasche.", + "Hohe Libellen-Fee vom Tal der\nKönigsfamilie. Sie verschenkt...\n...den Großen Pfeilköcher.", "Dichter, der auf der Beele-Hochebene\nlebt. Als er von einer langen Reise...\n...nach Hause kommt, hat eine\nFremde einfach sein Haus besetzt.", "Sie will nach Stadt Hyrule umziehen.\nEs besteht eine Verwandtschaft...\n...mit dem Priester von Labrynna.", "Sie will nach Stadt Hyrule umziehen.\nIst immer freundlich und hilfsbereit.\nSie leidet innerlich darunter, dass sie\noft ausgenutzt wird.", @@ -854,7 +854,7 @@ "Er bringt demjenigen Glück, der ihn\neinfängt. Ein seltener Schmetterling.\nSollte unbedingt eingefangen\nwerden, wenn man ihm begegnet!", "Ein Monster, das trotzdem Fragmente\nvereinen möchte. Komischer Ghini.\nHat sehr viele Fragmente. Man kann\nmehrmals Fragmente mit ihm vereinen.", "Priester, der im Dorf der Minish im\nTyloria-Wald lebt.\nEr versteht die Sprache der Menschen.\nEr erkennt sofort, dass {Player}...\n...ein Mensch ist, weil er sich sehr\nfür Menschen interessiert.", - "Der Älteste der Wald-Minish. Wohnt\nschon lange in der Welt der Menschen.\nWeiβ, wo die vier Elemente sind. Er und\nder alte Stadt-Minish sind Zwillinge.", + "Der Älteste der Wald-Minish. Wohnt\nschon lange in der Welt der Menschen.\nWeiß, wo die vier Elemente sind. Er und\nder alte Stadt-Minish sind Zwillinge.", "Erwachsene können sie nicht sehen. Sie\nmöchten Menschen Freude machen.\nSie stellen praktische Werkzeuge her,\ndie sie heimlich, still und leise...\n...in der Umgebung der Stadt ablegen.", "Ältester der Stadt-Minish, der in\neinem Buch haust.\nZwillingsbruder von Wald-Minish Ginsta.\nDie Feder in seiner Hand errang er...\n...in seiner Jugend beim Kampf\ngegen ein Huhn.", "Minish, die Menschen sehr mögen, und\ndeshalb in die Stadt gezogen sind.\nSie wollen den Menschen helfen.\nManchmal werden sie auch zur Last...", @@ -862,24 +862,24 @@ "Die sieben Schüler von Melta sind aus\ndem Wald zum Gongol-Berg umgezogen.\nDas Eisenerz-Lied ist das\nMarkenzeichen der echten Berg-Minish.", "Sie lebten ursprünglich am Gongol-Berg\nim Westen von Hyrule.\nSie ernähren sich von Felsen\nund Eisen.\nEs gibt nur noch wenige von ihnen\nund sie leben unbemerkt in Höhlen.", "Vaati als Minish, bevor er zum\nHexenmeister wird.\nWar schon immer von der bösen\nSeite der Menschen fasziniert.", - "Treue, fleiβige Diener des\nKönigshauses von Hyrule.\nSie sind aufrichtig und freundlich,\nso wie die Mitglieder der Königsfamilie.", + "Treue, fleißige Diener des\nKönigshauses von Hyrule.\nSie sind aufrichtig und freundlich,\nso wie die Mitglieder der Königsfamilie.", "Die königliche Bücherei. Beliebter\nTreffpunkt für die Bürger der Stadt.\nNicht nur die Angestellten\nempfinden es als sehr ärgerlich,\ndass viele Bücher nicht\nzurückgebracht werden.", "Sie haben alle schon einmal das\nSchwertkampf-Turnier gewonnen.\nWenn die Zeit reif ist, lehren sie\n{Player} diverse Schwert-Techniken.", "Das Bäcker-Ehepaar von Hyrule.\nAm beliebtesten ist ihr Glücks-Brot.\nWenn man Glück hat, kommen aus dem\nBrot tolle Items hervor.", - "Schule für die kleinen Kinder in Hyrule.\n{Player} und Zelda waren auch hier.\nDie Lehrerinnen sind Zwillinge und\nheiβen Edna und Edwina.", + "Schule für die kleinen Kinder in Hyrule.\n{Player} und Zelda waren auch hier.\nDie Lehrerinnen sind Zwillinge und\nheißen Edna und Edwina.", "Ort, an dem sich alle entspannen.\nHier erhält man viele Informationen.\nManches von dem, was die Leute\nerzählen, kann später nützlich sein.", "Jeder Gast erhält ein Geschenk.\nGemütliche Lobby im 2. Stock.", - "Der in der Mitte heiβt Til.\nSie gehen immer in der Stadt spazieren.\nSie kennen die Stadt gut und haben\neinige interessante Informationen.", + "Der in der Mitte heißt Til.\nSie gehen immer in der Stadt spazieren.\nSie kennen die Stadt gut und haben\neinige interessante Informationen.", "Der Handwerksmeister und seine Leute.\nEr ist etwas unhöflich, aber geschickt.\nSeine Leute sehen aus wie Männer,\nbenehmen sich aber wie Mädchen.", - "Die beiden sind Nachbarn in Hyrule und\nheiβen Gernhund und Magmiez.\nSie wollen heiraten, aber ihre Haustiere\nverstehen sich nicht.", + "Die beiden sind Nachbarn in Hyrule und\nheißen Gernhund und Magmiez.\nSie wollen heiraten, aber ihre Haustiere\nverstehen sich nicht.", "Szenen des friedlichen Hyrule, Nr. 1,\nvon Meister Minitendo", "Szenen des friedlichen Hyrule, Nr. 2,\nvon Meister Minitendo", "Szenen des friedlichen Hyrule, Nr. 3,\nvon Meister Minitendo", - "Fröhliche Stimme und ein süβer\nKamm.\nZurzeit das beliebteste Haustier\nin Stadt Hyrule.\nSie sind lieb, aber wenn man sie zu sehr\närgert...\nDie Küken lieben kleine Insekten.", + "Fröhliche Stimme und ein süßer\nKamm.\nZurzeit das beliebteste Haustier\nin Stadt Hyrule.\nSie sind lieb, aber wenn man sie zu sehr\närgert...\nDie Küken lieben kleine Insekten.", "Kleine Farm am Rande von Stadt Hyrule.\n\nTalon und Malon, Vater und Tochter,\nbewirtschaften sie zusammen.\nDie Milch, die die hübsche Malon in der\nStadt verkauft, gilt als sehr lecker.", "Volk, das die Ruine des Windes gebaut\nhat. Jetzt leben sie über den Wolken.", "Man kann ihn treffen, indem man\nFragmente vereint.\nBeim ersten Treffen ist er gerade\nvon einem bösen Geist befallen.\nWird er vom Geist befreit, passiert\netwas Gutes! Also ist Hilfe angesagt!", - "Jüngere Zwillingsbrüder von Tingle\n(grün): Jingle (lila) und Swingle (blau).\nSie glauben, dass man Feen treffen\nkann, wenn man Fragmente vereint.\nSie tragen Informationen über\nFragmente auf der Karte ein.\nDer weiβ gekleidete David Jr. ähnelt\nihnen, ist aber nicht ihr Bruder.", + "Jüngere Zwillingsbrüder von Tingle\n(grün): Jingle (lila) und Swingle (blau).\nSie glauben, dass man Feen treffen\nkann, wenn man Fragmente vereint.\nSie tragen Informationen über\nFragmente auf der Karte ein.\nDer weiß gekleidete David Jr. ähnelt\nihnen, ist aber nicht ihr Bruder.", "Sie bauen Hyrule-Gemüse an.\nRokkoli ist ihr bester Kunde.", "Gorone, der erscheint, sobald man\ngewisse Fragmente vereint hat.\nEr verkauft Glücksfragmente.\nSie sind zwar teuer,\naber er verkauft oft auch\nsehr seltene Stücke.", "Gespenster im Tal der Königsfamilie.\nSchaber trägt eine blaue Mütze,\nNack eine rote. Schaber ist in der\nStadt, um Menschen zu erschrecken.\nLeider hat niemand Angst vor ihm.\nDas macht ihn ganz traurig.", @@ -898,7 +898,7 @@ "Treten in Dungeons auf. Können sich\nschnell an Wänden entlang bewegen.\nSie sind nur mit dem {Color:Red}Bumerang{Color:White}\nzu besiegen.", "Treten unter anderem in der Welt von\nTabanta auf. Sie tragen eine Rüstung.\nDer {Color:Red}Schild {Color:White}bietet Schutz und aus\nder {Color:Blue}Rolle {Color:White}lassen sie sich angreifen.", "Treten unter anderem im Palast des\nWindes auf. Gardisten-Kommandanten.\nSie sind stark, aber mit den richtigen\nTechniken sind sie zu besiegen.", - "Treten in Dungeons auf. Verfolgen\n{Player} bei Sichtkontakt.\nBleiben stehen, wenn sie auf eine Wand\nstoβen. So kann man sie abschütteln.", + "Treten in Dungeons auf. Verfolgen\n{Player} bei Sichtkontakt.\nBleiben stehen, wenn sie auf eine Wand\nstoßen. So kann man sie abschütteln.", "Treten an verschiedenen Orten auf.\nSchleime mit Steinhelmen.\nMan muss erst den Helm zerschlagen,\nbevor man sie besiegen kann.", "Treten an verschiedenen Orten auf.\nSind schnell und unberechenbar.\nMan sollte sie in die Enge treiben\nund dann mit einem Schlag besiegen!", "Treten im Tal der Königsfamilie\nund im Dunklen Schloss Hyrule auf.\nFallen, die als Tür getarnt sind und\nzuschlagen, wenn man zu nah ist.", @@ -908,11 +908,11 @@ "Treten in Dungeons auf. Wird man\nerwischt, landet man am Eingang.\nNicht einkesseln lassen, wenn\ngleichzeitig andere Monster angreifen!", "Treten unter anderem\nam östlichen Hügel auf.\nSie kommen zu fünft aus der Erde\nhervor.\nAm besten mit dem Schwert attackieren,\nsobald sie aus dem Boden kommen.", "Treten in Dungeons auf.\nSie sammeln sich in engen Räumen.\nSie sind sehr schnell, sobald sie\ngezündet sind.\nBeste Art sie zu besiegen, ist\naus der Distanz mit dem {Color:Red}Bogen{Color:White}!", - "Treten in den Dungeons auf.\nSie schweben in der Luft.\nExplodieren bei bloβer Berührung!\nMan muss auf ihre Bewegungen achten!\nSie sind am besten aus\nder Distanz zu besiegen.", - "Treten unter anderem in\nHöhlen und Dungeons auf.\nWenn man erwischt wird,\nkann man sich nicht bewegen.\nBleibt man zu lange umschlossen,\nverliert man den Schild!\nDie Devise heiβt:\nSchwert schwingen!", + "Treten in den Dungeons auf.\nSie schweben in der Luft.\nExplodieren bei bloßer Berührung!\nMan muss auf ihre Bewegungen achten!\nSie sind am besten aus\nder Distanz zu besiegen.", + "Treten unter anderem in\nHöhlen und Dungeons auf.\nWenn man erwischt wird,\nkann man sich nicht bewegen.\nBleibt man zu lange umschlossen,\nverliert man den Schild!\nDie Devise heißt:\nSchwert schwingen!", "Treten unter anderem in\nHöhlen und Dungeons auf.\nRaubschleime mit einem Rubin auf dem\nKopf. Furchterregende Monster.\nSie locken gierige Abenteurer an,\num sie dann zu verspeisen.", "Treten an verschiedenen Orten auf.\nStürmen auf {Player} zu.\nAm besten heranlocken und\ndann mit dem Schwert attackieren!", - "Treten unter anderem\nam Gongol-Berg auf.\nGroβe Steine, die die Steilwand\nheruntergerollt kommen.\nAugen auf und einfach\ngeschickt ausweichen!", + "Treten unter anderem\nam Gongol-Berg auf.\nGroße Steine, die die Steilwand\nheruntergerollt kommen.\nAugen auf und einfach\ngeschickt ausweichen!", "Treten im Palast des Windes und\nim Dunklen Schloss Hyrule auf.\nSie bewegen sich langsam, aber\nihre Eisenkugeln sind gewaltig.\nAngriff empfiehlt sich, wenn sie\ndie Kugel gerade nicht schwingen.", "Treten fast überall auf! Verstecken\nsich im Gras oder unter Steinen.\nSie fallen einen grundsätzlich\nhinterrücks an, also aufgepasst!", "Treten unter anderem im\nTyloria-Wald auf.\nStürzen bei Sichtkontakt auf {Player}\nlos! Wenn man sie frontal angreift,\nwird man vom Speer getroffen.\nBesser von der Seite angreifen!", @@ -927,28 +927,28 @@ "Treten in Dungeons auf.\nSie schweben in der Luft.\nTrifft man sie mit dem Schwert, ist\nman für kurze Zeit paralysiert!", "Es gibt rote und blaue Oktoroks.\nZiemlich lästige Gesellen!\nSie treten in allen Zelda-Spielen auf\nund spucken mit Steinen nach dir!", "Goldene Oktoroks - Märchengestalten?\nIhr Lebensraum ist unbekannt.\nDie Steine, die sie spucken, sollen aus\nGold sein, doch das ist unbestätigt.", - "Goldene Arachnos - Märchengestalten?\nIhr Lebensraum ist unbekannt.\nMan weiβ lediglich, dass sie stark\nund nur schwer verwundbar sind.", + "Goldene Arachnos - Märchengestalten?\nIhr Lebensraum ist unbekannt.\nMan weiß lediglich, dass sie stark\nund nur schwer verwundbar sind.", "Goldene Giftwurm - Märchengestalten?\nIhr Lebensraum ist unbekannt.\nSie sollen stärker sein als gewöhnlich\nund {Player} direkt angreifen.", - "Treten an verschiedenen Orten auf.\nDer schwarze Rabenvogel heiβt Peckra.\nWird man vom roten Rabenvogel, Pickra,\nattackiert, verliert man Rubine.", + "Treten an verschiedenen Orten auf.\nDer schwarze Rabenvogel heißt Peckra.\nWird man vom roten Rabenvogel, Pickra,\nattackiert, verliert man Rubine.", "Treten über den Wolken auf.\nSie schweben auf Wolken in der Luft.\nSie bewegen sich nicht, feuern aber\nKugelblitze ab.\nMan saugt am besten die Wolke mit dem\n{Color:Red}Magischen Krug{Color:White} an, um sie zu besiegen!", "Treten in Dungeons auf. Blaue Stalfos\nspringen, rote werfen Knochen!\nNimmt man ihnen mit Hilfe des\n{Color:Red}Magischen Kruges{Color:White} den Schädel ab,\nerscheint an dessen Stelle\netwas anderes...", "Treten an verschiedenen\nOrten auf.\nSie kommen hervorgekrochen, wenn\nman Gras oder Steine aufhebt.\nWird man angegriffen, ist man\nparalysiert.\nAm besten mit dem Schwert abwehren!", "Treten an verschiedenen Orten auf.\nEs gibt sie in mehreren Farben.\nJe nach Farbe haben sie andere\nEigenschaften.\nEin Angriff aus der Entfernung\nist immer ratsam.", "Treten unter anderem am\nGongol-Berg auf.\nSpringen in hohen Sätzen vollkommen\nunberechenbar durch die Gegend.\nDeshalb sind sie am besten zu treffen,\nwenn sie gerade still dasitzen.", "Treten an verschiedenen Orten auf.\nFallen mit einer scharfen Klinge.\nSie gehen auf Eindringlinge los.\nEinige bewegen sich ständig.", - "Treten unter anderem am Gongol-\nBerg und in der Tabanta-Welt auf.\nSie können unter die Erde tauchen\nund sich dort frei bewegen.\nMan weiβ nie, wo sie auftauchen, also\nvorsichtig mit dem {Color:Red}Schild {Color:White}voran nähern!", - "Treten unter anderem im Wald-\nSchrein auf. Raupenähnliche Wesen.\nSie bewegen sich unregelmäβig\nund rasen wild herum, wenn...\n...sie an der Schnauze getroffen sind.\nHinten am Schwanz sind sie verwundbar.", + "Treten unter anderem am Gongol-\nBerg und in der Tabanta-Welt auf.\nSie können unter die Erde tauchen\nund sich dort frei bewegen.\nMan weiß nie, wo sie auftauchen, also\nvorsichtig mit dem {Color:Red}Schild {Color:White}voran nähern!", + "Treten unter anderem im Wald-\nSchrein auf. Raupenähnliche Wesen.\nSie bewegen sich unregelmäßig\nund rasen wild herum, wenn...\n...sie an der Schnauze getroffen sind.\nHinten am Schwanz sind sie verwundbar.", "Treten an verschiedenen Orten auf.\nSchleimähnliche Wesen.\nBei Gefahr fahren sie ihre Stacheln\naus.\nSie erscheinen meist in Gruppen, also\nam besten mit einer {Color:Red}Bombe {Color:White}angreifen.", - "Tritt im Tempel des Tropfens\nauf.\nDie Kraft des Tropfen-Elements\nlieβ ihn zu Eis werden.\nEr hat groβen Hunger, weil er\nso lange eingefroren war.\nDeshalb saugt er alles auf,\ndessen er habhaft wird.", - "Treten im Palast des Windes auf. Das\nWeibchen ist gröβer als das Männchen.\nSie fliegen um den Palast des Windes\nund warten auf ihre Opfer:\nAbenteurer, die das Element suchen.", - "Legendärer Gorone, der gröβer ist als\nein Berg.\nSo groβ, dass bisher niemand seinen\nganzen Körper gesehen hat.", + "Tritt im Tempel des Tropfens\nauf.\nDie Kraft des Tropfen-Elements\nließ ihn zu Eis werden.\nEr hat großen Hunger, weil er\nso lange eingefroren war.\nDeshalb saugt er alles auf,\ndessen er habhaft wird.", + "Treten im Palast des Windes auf. Das\nWeibchen ist größer als das Männchen.\nSie fliegen um den Palast des Windes\nund warten auf ihre Opfer:\nAbenteurer, die das Element suchen.", + "Legendärer Gorone, der größer ist als\nein Berg.\nSo groß, dass bisher niemand seinen\nganzen Körper gesehen hat.", "Tritt im Wald-Schrein auf.\nSchleimähnliches Wesen.\nDiese Kreatur ist eigentlich recht\nharmlos, doch aus Sicht eines Minish...\n...wird aus harmlosen Gegnern ein\nfurchterregendes Riesenmonster!", "Tritt in der Flammen-Höhle auf.\nDrache, der im Gongol-Berg haust.\nVersteckt sich in der Lava und spuckt\nFlammen, die alles verbrennen.", - "Tritt im Palast des Windes auf.\nVom Volk des Windes erschaffen,\num Eindringlinge zu bekämpfen.\nSchutzgott des Palastes.\nDa sein Panzer sehr hart ist, kann\nman ihn von auβen nicht zerstören.", + "Tritt im Palast des Windes auf.\nVom Volk des Windes erschaffen,\num Eindringlinge zu bekämpfen.\nSchutzgott des Palastes.\nDa sein Panzer sehr hart ist, kann\nman ihn von außen nicht zerstören.", "Tritt im Tempel des Tropfens auf.\nEin gewöhnlicher blauer Schleim.\nWeil man in Minish-Format gegen\nihn kämpft, ist er ein starker Feind.\nAber er ist zu besiegen, wenn man\nsich vor den Blitzen in Acht nimmt.", - "Der König von Hyrule und Groβvater\nAlberich sind seit langem befreundet.\nSo kennt Zelda {Player}\nschon seit frühester Kindheit.\nSie möchte, dass {Player}\nmutig, stark und berühmt wird.", + "Der König von Hyrule und Großvater\nAlberich sind seit langem befreundet.\nSo kennt Zelda {Player}\nschon seit frühester Kindheit.\nSie möchte, dass {Player}\nmutig, stark und berühmt wird.", "Der Minish Ezelo, bevor er vom Fluch\ndes Hexenmeisters getroffen wurde.\nEin berühmter, weiser Zauberer\nin der Welt der Minish.\nUnter den vielen Werkzeugen,\ndie von Minish hergestellt werden,\nsind seine ganz besondere\nWunderwerke.", - "Treten im Dunklen Schloss Hyrule auf.\nStärkste Variante der Schattengarden.\nGleichermaβen geschickt im Angriff und \nin der Verteidigung.\nBehindern {Player} bei dem\nVersuch Vaatis Zeremonie zu stoppen!", + "Treten im Dunklen Schloss Hyrule auf.\nStärkste Variante der Schattengarden.\nGleichermaßen geschickt im Angriff und \nin der Verteidigung.\nBehindern {Player} bei dem\nVersuch Vaatis Zeremonie zu stoppen!", "Nachdem Hexenmeister Vaati das Force\nerlangt, wird er zum Dämonen.\nSeine besonderen Flüche und die\nStrahlen-Attacken aus seinen...\n...kreisenden Pupillen sind gefährlich.", "Dämon Vaati nach\neiner weiteren Verwandlung.\nHat keine Ähnlichkeit mehr\nmit dem ursprünglichen Vaati.\nKann nur mit dem heiligen \nSchwert der Vier besiegt werden.", "Erzdämon Vaati nach seiner letzten\nVerwandlung. Er ist nun...\n...durch und durch böse und kennt nur\nein Ziel: {Player} zu vernichten!\nMan muss seine Schwächen ausnutzen\nund das Schwert der Vier einsetzen.", @@ -981,12 +981,12 @@ "{Sound:00:91}Wa-Was will denn diese Raupe\nvon uns?! Wie eklig!\nKind! Den überlasse ich dir!!!", "{Sound:00:8D}Mu-Muss das denn jetzt sein?!", "{Sound:00:8E}Mal hat er Stacheln, mal hüpft er\nherum... ein widerlicher Kerl!!!", - "{Sound:00:8D}He! Pass auf deine Füβe auf!\nEigentlich ein einfacher Gegner...", + "{Sound:00:8D}He! Pass auf deine Füße auf!\nEigentlich ein einfacher Gegner...", "{Sound:00:8D}Das ist auch ein Wächter!\n\nObwohl wir ihn einmal geschlagen\nhaben, kommt er gleich wieder an!!!\nHe! {Player}!\nMach ihm den Garaus!\n", "{Sound:00:8D}{Player}! Ruf mich jederzeit,\nwenn du meine Hilfe brauchst!\nAlso dann, bis später!", "{Sound:00:92}{Player}, den schaffst du doch mit\nlinks, so stark wie du jetzt bist!\nZeig ihm, was du von mir gelernt hast!", "{Sound:00:91}I-Irgendwie hat mir die Kälte\nzugesetzt. Jetzt b-bin ich erkältet...\nHa-Haa-Hatschi!\n\nMach dir keine Sorgen, {Player}! Ein\nbisschen Ruhe, dann wird das schon...", - "{Sound:00:92}Aus diesem fliegenden Fisch machen wir\nSushi mit unserem {Color:Red}Weiβen Schwert{Color:White}!\nLos! {Player}!!!", + "{Sound:00:92}Aus diesem fliegenden Fisch machen wir\nSushi mit unserem {Color:Red}Weißen Schwert{Color:White}!\nLos! {Player}!!!", "{Sound:00:91}Hatte ich das nicht erwähnt?\nIch habe ein wenig Höhenangst...\nIm Wasser wäre so ein Fisch kein\nProblem, aber so... Tja, tut mir Leid!", "{Sound:00:92}Diese Garde bewacht {Color:Green}Vaati{Color:White}!\n{Player}! Pass gut auf!", "{Sound:00:8D}Wenn wir {Color:Green}Vaati {Color:White}nicht aufhalten, wird\nalles ausgelöscht: {Color:Green}Zelda{Color:White}, {Color:Green}Hyrule{Color:White}, alles!\n{Player}! Wir müssen gewinnen!!!", @@ -997,20 +997,20 @@ "{Sound:00:92}Welch grässlicher Anblick!\nIch fürchte, {Player},\nuns bleibt keine Wahl! Wir hätten das\nfriedlich lösen können, aber nein...", "{Sound:00:8D}{Player}! Wir reden später darüber!\nJetzt müssen wir diese Kerle besiegen!", "{Sound:00:91}Hi-Hier ist also der {Color:Green}Wald-Schrein{Color:White}...\nHi-Hier sollen Mo-Monster leben...\nW-Was ist?! Z-Z-Zögere nicht...\nIch - äh - bin ja bei dir...\nNa gut... Dann gehe ich eben vor...\nNein, warte! Wir gehen zusammen!", - "{Sound:00:91}Uh... Hier drin ist es noch heiβer...\nLass uns schnell das {Color:Red}Element {Color:White}finden...\n...und diesen höllischen Ort verlassen.\nLos, Kind! Zackizacki!", + "{Sound:00:91}Uh... Hier drin ist es noch heißer...\nLass uns schnell das {Color:Red}Element {Color:White}finden...\n...und diesen höllischen Ort verlassen.\nLos, Kind! Zackizacki!", "{Sound:00:8E}Hmm... Die Ruine war offenbar\nin diesem Steilhang verborgen...\n{Player}! Gib Acht auf die Fallen,\ndie hier aufgestellt sind!", "{Sound:00:8D}Wer hätte gedacht, dass hinter dem\nStadtbrunnen ein solcher Ort existiert?\nDann wollen wir beide uns doch gleich\nmal diesen Schatz der Minish holen!", - "{Sound:00:91}Aah! ... Aua!\nIch habe mir die Hüfte gestoβen...\nOder das Knie? ... Es tut jedenfalls\nweh! Dieser {Color:Green}Lexta {Color:White}ist mir ein Rätsel!\nWie ist der denn in den {Color:Green}Tempel des\nTropfens{Color:White} hereingekommen?\nDie Lösung des Rätsels liegt vor uns.\nLass uns hineingehen!", + "{Sound:00:91}Aah! ... Aua!\nIch habe mir die Hüfte gestoßen...\nOder das Knie? ... Es tut jedenfalls\nweh! Dieser {Color:Green}Lexta {Color:White}ist mir ein Rätsel!\nWie ist der denn in den {Color:Green}Tempel des\nTropfens{Color:White} hereingekommen?\nDie Lösung des Rätsels liegt vor uns.\nLass uns hineingehen!", "{Sound:00:91}Brrr... Klapper!...\nEine eisige Kälte ist das...!\nWenn wir das {Color:Red}Element {Color:White}nicht schnell\nfinden, werden wir auch zu Eis!\nBeeil dich, {Player}!\n", "{Sound:00:91}Es ist zwar das Grab des Königs von\nHyrule, aber unheimlich ist es trotzdem.\nWo müssen wir wohl hingehen, um\n{Color:Green}König Gustaf{Color:White} zu treffen?\nIch bin gar nicht mehr so sicher, ob\nich ihn wirklich treffen möchte...", - "{Sound:00:8D}Ei, so etwas... Wer hätte gedacht,\ndass hier oben ein groβer Palast ist?!\nDiese Höhe! Da zittern mir ja\ndie Knie... wenn ich welche hätte!\n{Player}! Gib Acht, wo du hintrittst!\nHier fällt man ziemlich tief!", - "{Sound:00:91}Ja, was ist das denn?!? Dieser\nPalast ist innen ja noch gröβer!\nNein, jetzt nicht abschrecken lassen!\nNur noch ein kleines Stück, {Player}!", + "{Sound:00:8D}Ei, so etwas... Wer hätte gedacht,\ndass hier oben ein großer Palast ist?!\nDiese Höhe! Da zittern mir ja\ndie Knie... wenn ich welche hätte!\n{Player}! Gib Acht, wo du hintrittst!\nHier fällt man ziemlich tief!", + "{Sound:00:91}Ja, was ist das denn?!? Dieser\nPalast ist innen ja noch größer!\nNein, jetzt nicht abschrecken lassen!\nNur noch ein kleines Stück, {Player}!", "{Sound:00:8D}Wa-Was ist denn das?!\n...\nIst das hier wirklich das schöne\n{Color:Green}Schloss Hyrule{Color:White}?! Unglaublich!\nIch hätte nicht gedacht, dass {Color:Green}Vaatis{Color:White}\nKräfte so viel Unheil anrichten können!\n{Sound:00:92}Der {Color:Green}König {Color:White}und {Color:Green}Zelda {Color:White}sind in Gefahr!\nBeeil dich, {Player}!!!", - "{Sound:00:92}Das ist, als regnete es Bomben!\nPass gut auf, mein Kindchen!\nBei unserer jetzigen Gröβe wäre es\nfatal, wenn uns ein Tropfen träfe!", + "{Sound:00:92}Das ist, als regnete es Bomben!\nPass gut auf, mein Kindchen!\nBei unserer jetzigen Größe wäre es\nfatal, wenn uns ein Tropfen träfe!", "{Sound:00:91}Hihihihi! Na, {Player}?\nZiemlich finster, nicht?\n{01:0A}... ... ...\nZiemlich gruselig, oder?\n{01:01}Was?!? Du hast keine Angst!?!\nÄh... Ich natürlich auch nicht!\n{Sound:00:91}Gut, äh... G-Gehen wir!", "{Sound:00:92}Oh!!! Was für ein riesiger Wasserfall!\nEin wahrhaft überwältigender Anblick!", "{Sound:00:92}Die steinerne Tür!!!\n\nAch so!\nDie so genannte {Color:Green}Quelle {Color:White}ist hier.\nDieser Wasserfall ist bestimmt die\nWasserquelle von Hyrule.\n{Color:Green}Gustaf {Color:White}sagte, dass dahinter etwas\nliegt, das zum letzten {Color:Red}Element {Color:White}führt...\nLass es uns anschauen, {Player}!!!", - "{Sound:00:8D}W-Was ist das?! Ein groβer\nWirbelwind!\nHier kommen wir wohl nicht weiter.\nWas sollen wir nur machen...?", + "{Sound:00:8D}W-Was ist das?! Ein großer\nWirbelwind!\nHier kommen wir wohl nicht weiter.\nWas sollen wir nur machen...?", "{01:0A}... ... ...\n\n{01:01}I-Ich lebe noch?\n\n{01:0A}... ... ...\n... ... ...\n{01:01}{Sound:00:8D}{Player}!!!\nDu! Wagemut hat auch seine Grenzen!\nStürzt sich einfach in den Wirbelsturm!!!\nDas hätte unser Ende sein können!!!\n{01:0A}... ... ...\n... ... ...\n...{01:01}So etwas! Deine Waghalsigkeit\nhat sich offenbar doch gelohnt!{Sound:00:8E}\nIst hier am Ende...\ndie Welt über den Wolken?!\nHier muss es {Color:Blue}etwas geben{Color:White}, das zum\n{Color:Red}Element{Color:White} führt. Suchen wir danach!", "{Sound:00:8E}Wer hat nur hier oben\ndieses Gebäude errichtet...?\n{Player}, vielleicht kann uns hier\njemand etwas über das {Color:Red}Element {Color:White}sagen!", "{Sound:00:8E}Dieser unscheinbare Stein ist in\nWirklichkeit ein {Color:Blue}Portal{Color:White}!\nEs ist bestimmt nicht das einzige\n{Color:Blue}Stein-Portal {Color:White}dieser Art...", @@ -1027,16 +1027,16 @@ "{Sound:00:8E}Das ist also die {Color:Green}Welt von Tabanta{Color:White}...\nWas für ein feuchter, sumpfiger Ort!\nAber dahinter finden wir das {Color:Red}Element{Color:White}.\nSteh hier nicht rum! Los! {Player}!\nVorwärts! Weiter geht's!", "{Sound:00:92}Eine höchst merkwürdige Steinstatue...\nDieses {Color:Blue}Auge {Color:White}ist irgendwie unheimlich.", "{Sound:00:92}Diese lästigen Krüge kannst du einfach\nkaputt machen.\nDrücke {Key:Right}, um einen {Color:Blue}hochzuheben{Color:White},\nund dann erneut, um ihn {Color:Blue}wegzuwerfen{Color:White}.", - "{Sound:00:92}Mit diesem {Color:Red}kleinen Schlüssel{Color:White} kannst\ndu verschlossene Türen öffnen!\nAllerdings {Color:Blue}kannst du ihn nur ein\neinziges Mal einsetzen{Color:White}.\nDrücke {Key:Right}, wenn du vor einer\nTür stehst, um sie aufzuschlieβen.", + "{Sound:00:92}Mit diesem {Color:Red}kleinen Schlüssel{Color:White} kannst\ndu verschlossene Türen öffnen!\nAllerdings {Color:Blue}kannst du ihn nur ein\neinziges Mal einsetzen{Color:White}.\nDrücke {Key:Right}, wenn du vor einer\nTür stehst, um sie aufzuschließen.", "{Sound:00:92}Kann man diesen Hebel vielleicht\n{Color:Blue}herausziehen{Color:White}?\nDrücke {Key:Right}, um den Hebel zu greifen.\nDrücke zusätzlich {Key:DDown}, um zu ziehen.", "{Sound:00:92}Drücke und halte {Key:Right},\num Dinge zu greifen.\nDrücke zusätzlich {Key:Dpad}, um etwas\nzu {Color:Blue}ziehen {Color:White}oder zu {Color:Blue}schieben{Color:White}.", - "{Sound:00:92}Das ist ja ein riesiges Fass!\n\nAch so!\nBeinahe hätte ich es vergessen!\nNicht das Fass ist groβ!\n{Color:Blue}Wir sind so klein{Color:White}!", + "{Sound:00:92}Das ist ja ein riesiges Fass!\n\nAch so!\nBeinahe hätte ich es vergessen!\nNicht das Fass ist groß!\n{Color:Blue}Wir sind so klein{Color:White}!", "{Sound:00:92}Huch!!! Kindchen!\n{Color:Blue}Das Fass hat sich bewegt{Color:White}!", "{Sound:00:8E}Wenn wir doch nur etwas hätten, was\nwir {Color:Blue}auf den Schalter stellen können{Color:White}...", "{Sound:00:90}So ein Pech... \n\nOhne passendes Transportmittel\nkommen wir hier nicht weiter!", "{Sound:00:92}Damit haben sich die Menschen\nin der Mine fortbewegt.\nVielleicht sollten wir einfach mal\neinsteigen.\nWie? Was ist denn?\nHast du etwa Angst?\nAch nein, das glaube ich nicht...\nDa gibt es doch nichts zu fürchten!\nHopp! Los jetzt!!!", "{Sound:00:93}W-Was war das denn?\nDa-Das da eben?!\nKind, was guckst du so zufrieden?\n\nMenschenfahrzeuge sind einfach nichts\nfür mich! Da laufe ich lieber selbst!", - "{Sound:00:91}Oha!!! Das sieht heiβ aus...\nWenn wir da reinfallen, ist es vorbei!", + "{Sound:00:91}Oha!!! Das sieht heiß aus...\nWenn wir da reinfallen, ist es vorbei!", "{Sound:00:8E}Na so was!!!\nHier ist ja ein {Color:Blue}Portal {Color:White}verborgen!\nWenn ich dich schrumpfen lassen soll,\nstell dich drauf und drücke {Key:Right}!", "{Sound:00:90}Puh!!! Das war knapp! Ich hatte Angst,\ndass wir da nicht heil durchkommen.", "{Sound:00:92}Nanu? Ist da nicht gerade etwas\nheruntergefallen? Oder irre ich mich?", @@ -1044,12 +1044,12 @@ "{Sound:00:92}Sieh mal genau hin. Da ist doch\n{Color:Blue}etwas im Eis eingeschlossen{Color:White}!\nHe, {Player}! Sieh doch!", "{Sound:00:92}Ooh! Das ist ja {Color:Blue}Tageslicht{Color:White}!!!\n\nWie schön warm das Licht ist!\nDa geht es einem gleich viel besser!", "{Sound:00:92}{04:10:00}Ja so etwas!\n\n{Player}! Wir haben\ndas {Color:Red}Element {Color:White}gefunden!!!\nAber leider...\nist es von dickem Eis umschlossen.\nSo kommen wir nicht ran! Vielleicht kann\nman das {Color:Blue}Eis {Color:White}irgendwie {Color:Blue}schmelzen{Color:White}?", - "{Sound:00:92}Oh!!! Tageslicht!!!\n\nWenn wir die andere Seite auch öffnen,\nkönnen wir das Eis,\ndas das {Color:Red}Element {Color:White}umschlieβt,\nwegschmelzen!", + "{Sound:00:92}Oh!!! Tageslicht!!!\n\nWenn wir die andere Seite auch öffnen,\nkönnen wir das Eis,\ndas das {Color:Red}Element {Color:White}umschließt,\nwegschmelzen!", "{Sound:00:92}Du hast es geschafft, {Player}!\nNun können wir uns das {Color:Red}Element {Color:White}nehmen.\nPuh! Das war harte Arbeit...\n\n...Nanu?!\n\nIrgendetwas stimmt hier nicht!!!", "{Sound:00:8D}Wa-Was soll das denn?!\n\nDieses Kraken-Gespenst hat uns\ndas {Color:Red}Element {Color:White}weggeschnappt!!!\nHe! Steh nicht dumm rum,\n{Player}! Schnell, verfolge es!", "{Sound:00:91}{Player}! Wo bist du?\nBist du noch da?\nBei dieser Finsternis sieht man\ndie Hand vor Augen nicht mehr...\nSei vorsichtig!", "{Sound:00:92}Ooh!\nHier ist ja ein Eingang verborgen!", - "{Sound:00:92}Da sind ganz weiche Wolken! Es macht\nbestimmt Spaβ, wenn man da oben ist...", + "{Sound:00:92}Da sind ganz weiche Wolken! Es macht\nbestimmt Spaß, wenn man da oben ist...", "{Sound:00:8E}Dieses Gitter... Es dreht sich bestimmt,\nwenn man kräftig draufspringt.", "{Sound:00:92}Es weht ein heftiger Wind!\nLass dich nicht wegpusten!", "{Sound:00:92}Die Kugeln, die die Statue spuckt,\nkannst du mit dem Schwert abwehren.", @@ -1062,25 +1062,25 @@ "{Sound:00:8E}Das ist also dein Haus...\nEin prächtiges Zuhause hast du.\n...Und {Color:Blue}wo ist mein Zimmer{Color:White}?", "{Sound:00:90}Aha! Das ist dein Zimmer, ja?\n{Color:Blue}Ab jetzt {Color:White}also {Color:Blue}mein Zimmer{Color:White}!", "{Sound:00:92}Du hast hier doch irgendwo etwas\nversteckt, oder? Rück es schon raus!\nIch verrate es auch niemandem.", - "{Sound:00:90}Das ist also das Haus von Aiya, dem\nBesitzer des Werkzeug-Ladens...\nEs liegt etwas auβerhalb, aber dafür\nhat es ein Schwimmbad.", + "{Sound:00:90}Das ist also das Haus von Aiya, dem\nBesitzer des Werkzeug-Ladens...\nEs liegt etwas außerhalb, aber dafür\nhat es ein Schwimmbad.", "{Sound:00:92}Was für ein nutzloser Kauz! In diesem\nZimmer stimmt etwas nicht...", "{Sound:00:90}Schnupper! Mmmmh!\nDas riecht aber lecker!\nKann man hier mal etwas probieren?\nFrag doch mal nach!!!", "{Sound:00:8E}Hier gibt es viele interessante Bücher.\nWelches nehmen wir denn mal?\n\"{Color:Blue}100 Rubine in 10 Tagen sparen{Color:White}\",\n\"{Color:Blue}Du bist eben ein Junge{Color:White}\" von Mama,\n\"{Color:Blue}Mal Herz, mal Schmerz{Color:White}\"{Color:Blue}\n{Color:White}von Poemun,\n\"{Color:Blue}Schlumms Anleitung\nfür schlaflose Nächte{Color:White}\".\nHm, klingt alles sehr interessant.\nIch kann mich nicht entscheiden.", "{Sound:00:92}Ob wir hier in diesem Aufzug\nunangenehm auffallen?", "{Sound:00:92}Wie ruhig es hier ist! Und die\nKühe sehen wohlgenährt aus...", "{Sound:00:92}Oh! Die Katze dort starrt uns an!\nDie hat sicher nichts Gutes im Sinn!", - "{Sound:00:91}Puh, das war ein Schreck! Wenn man\nklein ist, sind die Gefahren groβ!", + "{Sound:00:91}Puh, das war ein Schreck! Wenn man\nklein ist, sind die Gefahren groß!", "{Sound:00:92}Was war das denn?!?\nEs ist explodiert!\nHm?\nKindchen! Guck mal da!\nAuf dem Boden ist dieses\nmerkwürdige {Color:Blue}Mal{Color:White}.\nWas könnte es bedeuten{01:0A}...?\n\nHm... {01:01}Ich habe leider selbst\nkeine Ahnung! Sehr rätselhaft!", "{Sound:00:92}Oh!!!\nSchon wieder so ein {Color:Blue}Mal{Color:White}!\nIch erschrecke mich jedes Mal wieder,\nwenn so eine Tafel explodiert.", "{Sound:00:92}Oh! Wieder ein {Color:Blue}Windmal{Color:White}! Ein weiterer\nOrt, den du mit der {Color:Red}Okarina {Color:White}erreichst!", - "{Sound:00:8E}Aha!!!\nDiese rätselhaften {Color:Blue}Male {Color:White}überall...\nDas sind Wegweiser für die Vögel,\ndie den Besitzer der {Color:Red}Okarina {Color:White}tragen.\nDas heiβt, der Vogel trägt uns zu den\n{Color:Blue}Windmalen{Color:White}, die wir kennen.\nHast du das verstanden, {Player}?\n\nNa, wenn du es ausprobierst, wirst\ndu schon sehen, wie es funktioniert.", + "{Sound:00:8E}Aha!!!\nDiese rätselhaften {Color:Blue}Male {Color:White}überall...\nDas sind Wegweiser für die Vögel,\ndie den Besitzer der {Color:Red}Okarina {Color:White}tragen.\nDas heißt, der Vogel trägt uns zu den\n{Color:Blue}Windmalen{Color:White}, die wir kennen.\nHast du das verstanden, {Player}?\n\nNa, wenn du es ausprobierst, wirst\ndu schon sehen, wie es funktioniert.", "{Sound:00:92}Nanu?!\nOh!!! Sieh doch, {Player}!\nDas {Color:Red}Buch {Color:White}liegt auf dem Bücherregal!\n\nAber wie kommen wir da nur ran?\n\nVon hier aus ist es unerreichbar\nund eine Leiter gibt es auch nicht.\nEs liegt auch so weit hinten, dass es\nnichts nützt, am Regal zu rütteln...\nWas sollen wir nur tun?", "{Sound:00:8D}Die Tür ist offenbar verschlossen!\nLass es uns später erneut versuchen!", "{Sound:00:92}Hm? Es scheint niemand hier zu sein...\nVielleicht sollten wir nicht reingehen.", "{Sound:00:92}Ach so!\nIch fürchte, hier ist noch geschlossen.\nDa kann man nichts machen...\nVersuchen wir es später noch einmal.", "{Sound:00:8E}Die Tür ist verschlossen.\nVon hier aus kommt man nicht rein{01:0A}...", "{Sound:00:8D}Du besitzt doch gar keine {Color:Red}Fragmente{Color:White}!\nWie willst du dann Fragmente vereinen?!", - "{Sound:00:90}Puh... Zu Fuβ kann man den Sumpf\noffenbar nicht durchqueren.\nWir müssen uns etwas\neinfallen lassen...", + "{Sound:00:90}Puh... Zu Fuß kann man den Sumpf\noffenbar nicht durchqueren.\nWir müssen uns etwas\neinfallen lassen...", "", "{Sound:00:92}He! Knirps!\nMit deinem {Color:Red}Wirbelstab {Color:White}können wir uns...\n...vielleicht in die Höhe katapultieren.\nMan müsste nur die Energie,\ndie aus der Spitze kommt,\nirgendwo einfangen können...", "", @@ -1094,19 +1094,19 @@ "{Sound:00:92}{Color:Blue}\"Achte auf Ungewöhnliches!{Color:White}\" Das ist\ndas Einmaleins des Abenteurers!\n{01:07}Merk dir das gut, Knirps!", "{Sound:00:92}{Color:Blue}Es kommt vor, dass sich ein neuer Weg\nöffnet, wenn man klein geworden ist{Color:White}.\nEs ist alles eine Sache der Erfahrung!", "{Sound:00:92}Die {Color:Green}Minish {Color:White}sind winzig klein!\n\nSie können {Color:Blue}an kleine Orte gelangen{Color:White},\ndie für Menschen unerreichbar sind.\nNa? Ist das kein guter Tipp?", - "{Sound:00:8D}He, Knirps!\n\nIch kann dich auf {Color:Green}Minish-{Color:White}\n{Color:Green}Gröβe{Color:White} schrumpfen lassen.\nDas sollte dich\neinigermaβen beeindrucken!\nAllerdings nur über ein {Color:Blue}Portal{Color:White}.\nEs sieht aus wie ein Baumstumpf.", + "{Sound:00:8D}He, Knirps!\n\nIch kann dich auf {Color:Green}Minish-{Color:White}\n{Color:Green}Größe{Color:White} schrumpfen lassen.\nDas sollte dich\neinigermaßen beeindrucken!\nAllerdings nur über ein {Color:Blue}Portal{Color:White}.\nEs sieht aus wie ein Baumstumpf.", "{Sound:00:8E}Wenn du die Sprache der {Color:Green}Minish {Color:White}nicht\nverstehst, kommen wir hier nicht weiter.", "{Sound:00:90}Dieser {Color:Green}Wald-Minish {Color:White}scheint sich sehr\nfür Menschen zu interessieren.", "{Sound:00:92}\"Nicht denken, sondern handeln!\"\nLass uns das {Color:Green}Dorf der Minish{Color:White} erkunden!\nLos geht's! Zackizacki!", - "{Sound:00:8E}Der Verzehr dieser merkwürdigen Frucht\nlässt dich also die {Color:Green}Minish {Color:White}verstehen!\n{Color:Red}Schwatzbirne{Color:White} heiβt sie, nicht wahr?\nNein! Falsch!!!\nEs war die {Color:Red}Faselbirne{Color:White}!!!\nJa, das war's! Such die {Color:Red}Faselbirne{Color:White}!", - "{Sound:00:8E}Die {Color:Red}Faselbirne {Color:White}war doch...\nDieser {Color:Green}Minish mit Brille{Color:White}...\nheiβt doch Fe... Feista, oder?\n\nEs hieβ, dass die Birne {Color:Blue}in einem\nFass{Color:White} südlich von seinem Haus ist.", + "{Sound:00:8E}Der Verzehr dieser merkwürdigen Frucht\nlässt dich also die {Color:Green}Minish {Color:White}verstehen!\n{Color:Red}Schwatzbirne{Color:White} heißt sie, nicht wahr?\nNein! Falsch!!!\nEs war die {Color:Red}Faselbirne{Color:White}!!!\nJa, das war's! Such die {Color:Red}Faselbirne{Color:White}!", + "{Sound:00:8E}Die {Color:Red}Faselbirne {Color:White}war doch...\nDieser {Color:Green}Minish mit Brille{Color:White}...\nheißt doch Fe... Feista, oder?\n\nEs hieß, dass die Birne {Color:Blue}in einem\nFass{Color:White} südlich von seinem Haus ist.", "Wenn du die Sprache der {Color:Green}Minish{Color:White}\nverstehst,\nlernst du bestimmt einiges über das\n{Color:Red}Heilige Schwert{Color:White}.\n{Sound:00:8D}Zackizacki! Los geht's!", "{Sound:00:8E}Jetzt, wo du die Sprache der {Color:Green}Minish{Color:White}\nverstehst,\nsollten wir gleich mal die Leute im\nDorf befragen. Was meinst du?", "{Sound:00:8E}Nur die {Color:Green}Minish {Color:White}können das\n{Color:Red}Heilige Schwert{Color:White} reparieren...\nWir sollten mit den {Color:Green}Minish{Color:White} dieses\nDorfs reden, um mehr zu erfahren.", "{Sound:00:8D}Was!?! Kann es sein, dass du\nnoch nie einen {Color:Green}Minish {Color:White}gesehen hast?\nHm... Na ja, man sagt ja, dass nur\ngute Menschen die {Color:Green}Minish {Color:White}sehen können.\nDa kann man wohl nichts machen...", "{Sound:00:8E}Wenn wir das {Color:Red}Heilige Schwert\n{Color:White}wiederherstellen wollen,\nsollten wir das {Color:Red}Erd-Element{Color:White} suchen,\nwie es der {Color:Green}Minish-Älteste {Color:White}gesagt hat.", "{Sound:00:8E}Der {Color:Green}Wald-Schrein {Color:White}ist voller Monster!\nSei vorsichtig, Knirps!\n{Sound:00:8D}Die Gefahren lauern überall!\nHalte immer schön die Augen offen!\nUnd hör auf, ständig an mir\nherumzuziehen, wenn's brenzlig wird!", - "{Sound:00:92}Was ist? Weiβt du nicht weiter?!\n\nWenn du mal nicht weiterweiβt, dann\n{Color:Blue}suche in der Umgebung nach Hinweisen{Color:White}!", + "{Sound:00:92}Was ist? Weißt du nicht weiter?!\n\nWenn du mal nicht weiterweißt, dann\n{Color:Blue}suche in der Umgebung nach Hinweisen{Color:White}!", "{Sound:00:8E}Wer hätte gedacht, dass du das\n{Color:Red}Erd-Element{Color:White} holen würdest!\nBei all diesen Monstermassen,\ndie sich im Schrein tummeln!\n{Sound:00:92}Das war beachtlich, Knirps!\nDank meiner Hilfe!", "{Sound:00:8E}Da fällt mir ein... Der {Color:Green}Minish-Älteste{Color:White}\nsagte, wir sollten ihn aufsuchen,\nwenn wir das {Color:Red}Erd-Element{Color:White} gefunden\nhaben...", "{Sound:00:8E}Die Methode, das {Color:Red}Heilige Schwert{Color:White}\nwieder zu erschaffen...\nWir sollten den {Color:Green}Minish-Ältesten{Color:White} bitten,\nuns das genauer zu erklären.\n{Sound:00:8D}\"Zögere nicht, Gutes zu tun!\"\nZackizacki! Auf, auf!", @@ -1119,26 +1119,26 @@ "{Sound:00:92}Wie? Hast du etwa vergessen, was\nder {Color:Green}Älteste im Wald{Color:White} gesagt hat!?!\nEin Minish namens {Color:Green}Melta {Color:White}soll\nauf dem {Color:Green}Gongol-Berg{Color:White} leben!\n{Sound:00:90}Aber wie sollen wir nur diesen\nsteilen Berg erklimmen?", "{Sound:00:8E}Hmm...\n\nWahrscheinlich gibt es am\n{Color:Green}Gongol-Berg {Color:White}auch Monster,\ngenau wie im Wald.\n\n{Sound:00:90}Wir werden uns bei der Suche nach{Color:Green}\nMelta {Color:White}bestimmt alle Knochen brechen...\nIch meine, du wirst dir was brechen\nund ich bekomme Laufmaschen...", "{Sound:00:8D}Ach, ja!\nFast hätte ich es vergessen!\nBei einem gewissen {Color:Green}Magnus {Color:White}kann\nman die {Color:Red}Wirbelattacke {Color:White}erlernen.\n{Sound:00:92}Diese {Color:Red}Technik {Color:White}ist beeindruckend!\nLehrst du sie mich dann auch?\nHm?! Warum guckst du so?!\n{Sound:00:8D}Was du kannst, kann ich schon lange!\nDu wirst schon sehen!!!", - "{Sound:00:8E}Eine {Color:Blue}Bohne, die wächst, wenn\nman sie mit Wasser begieβt{Color:White}.\nGut, dass wir dem {Color:Green}Händler-Deku{Color:White}\ndie {Color:Red}Flasche {Color:White}abgekauft haben.\n{Sound:00:92}Ich hatte mal wieder Recht.", + "{Sound:00:8E}Eine {Color:Blue}Bohne, die wächst, wenn\nman sie mit Wasser begießt{Color:White}.\nGut, dass wir dem {Color:Green}Händler-Deku{Color:White}\ndie {Color:Red}Flasche {Color:White}abgekauft haben.\n{Sound:00:92}Ich hatte mal wieder Recht.", "{Sound:00:90}Oje... Was machen wir nur?\nWo genau auf dem {Color:Green}Gongol-Berg{Color:White}...\n...ist denn dieser {Color:Green}Melta{Color:White},\nder das Schwert reparieren kann?\n{Sound:00:92}Er ist bestimmt sehr klein.\nHoffentlich übersehen wir ihn nicht!", - "{Sound:00:92}Was ist?\nWeiβt du nicht weiter?\nDann probiere an Orten, {Color:Blue}an denen du{Color:White}\n{Color:Blue}nicht weiterkommst{Color:White}, Verschiedenes aus.\nEs gibt viele verborgene Wege!\nMeistens jedenfalls...", + "{Sound:00:92}Was ist?\nWeißt du nicht weiter?\nDann probiere an Orten, {Color:Blue}an denen du{Color:White}\n{Color:Blue}nicht weiterkommst{Color:White}, Verschiedenes aus.\nEs gibt viele verborgene Wege!\nMeistens jedenfalls...", "{Sound:00:8E}Hmm...\nEs gibt offenbar...\n...{Color:Blue}zwei Sorten von Bohnen{Color:White} am\n{Color:Green}Gongol-Berg{Color:White}: blaue und grüne.\nDa ihre Farbe verschieden ist, muss\nman sie auch unterschiedlich pflegen.", "{Sound:00:92}Du hast hoffentlich nicht vergessen,\nwas wir auf dem {Color:Green}Gongol-Berg{Color:White} suchen!\nWir suchen einen Minish\nnamens {Color:Green}Melta{Color:White}!", "{Sound:00:8D}Ich frage mich schon die ganze Zeit,\nwas du treibst.\nLass uns schnell den {Color:Green}Gongol-Berg{Color:White}\nbesteigen, um {Color:Green}Melta {Color:White}zu finden!", "{Sound:00:92}Irgendwo auf dem {Color:Green}Gongol-Berg{Color:White} soll\nein Minish namens {Color:Green}Melta {Color:White}leben.\nWir müssen ihn unbedingt finden!", "{Sound:00:8E}Auf dem {Color:Green}Gongol-Berg{Color:White} gibt es viele\nMonster, die du noch nie gesehen hast.\nEinige von ihnen kannst du mit dem\n{Color:Red}Schwert {Color:White}allein nicht besiegen.\nIn solchen Fällen solltest du ein\npaar andere {Color:Red}Items {Color:White}ausprobieren!\nGut...\nDie Monster überlasse ich dir.\nIch mache ein kleine Pause.", - "{Sound:00:91}Was ist?\nWeiβt du wieder mal nicht weiter?\nHast du denn auch die {Color:Blue}Schilder{Color:White}, die\ngelegentlich herumstehen, gelesen?\nWas dort steht, könnte nützlich sein!\nIch habe sie leider auch nicht gelesen.", + "{Sound:00:91}Was ist?\nWeißt du wieder mal nicht weiter?\nHast du denn auch die {Color:Blue}Schilder{Color:White}, die\ngelegentlich herumstehen, gelesen?\nWas dort steht, könnte nützlich sein!\nIch habe sie leider auch nicht gelesen.", "{Sound:00:92}Also dann!\nLass uns schnell zu {Color:Green}Melta {Color:White}gehen,\num das {Color:Red}Schwert {Color:White}reparieren zu lassen!", "{Sound:00:8E}Die {Color:Green}Berg-Minish{Color:White} sehen etwas anders\naus als die Wald-Minish.\nEs gibt verschiedene Minish, so wie es\nverschiedene Menschen gibt.\nVerschiedene Mützen gibt es natürlich\nauch...", "{Sound:00:92}Die {Color:Green}Berg-Minish {Color:White}sind hart arbeitende\nLeute!\nLass uns auch \"Eisenerz, Eisenerz {Symbol:0B}\"\nsingen und nicht aufgeben! Okay?", "{Sound:00:8D}Was ist, Knirps?\nWir haben keine Zeit zu vertrödeln!\nLass uns das {Color:Red}Element {Color:White}suchen, während\n{Color:Green}Melta {Color:White}das {Color:Red}Schwert {Color:White}überarbeitet!", "{Sound:00:8E}Das ist also die {Color:Green}Mine{Color:White}, die von\nMenschen geschaffen wurde...\nKind! Gib Acht auf die Monster!!!", "{Sound:00:8E}Wenn Menschen diese Mine erschaffen\nhaben, liegt vielleicht noch...\n...das ein oder andere Werkzeug\nherum, das sie benutzt haben.\nWenn du etwas findest, solltest du\nes auch verwenden.", - "{Sound:00:90}Du hast das Flammen-Monster besiegt\nund das zweite {Color:Red}Element {Color:White}gefunden...\nDu hast viel Talent für einen Knirps!\nUnd einen sehr fähigen Schutzengel!\n{Sound:00:8D}Ich hoffe, du weiβt das zu schätzen!", + "{Sound:00:90}Du hast das Flammen-Monster besiegt\nund das zweite {Color:Red}Element {Color:White}gefunden...\nDu hast viel Talent für einen Knirps!\nUnd einen sehr fähigen Schutzengel!\n{Sound:00:8D}Ich hoffe, du weißt das zu schätzen!", "{Sound:00:92}So! {Color:Green}Melta {Color:White}müsste inzwischen mit dem\n{Color:Red}Schwert {Color:White}fertig sein.\nLass uns gleich zu ihm gehen!", "{Sound:00:92}Wie mag das {Color:Red}Schwert {Color:White}wohl aussehen,\njetzt wo {Color:Green}Melta {Color:White}es repariert hat?\nOh, welche Vorfreude!", "{Sound:00:8E}Um die Kraft der {Color:Red}Elemente {Color:White}auf das\n{Color:Red}Schwert {Color:White}zu übertragen,\nmusst du zur {Color:Green}Heiligen Stätte{Color:White} gehen.\nDer Eingang liegt im {Color:Green}Schloss Hyrule{Color:White}.\nDen Weg zum Schloss kennst du ja.\nAlso, los, auf zum {Color:Green}Schloss Hyrule{Color:White}!!!", - "{Sound:00:92}Wir haben zwei von vier {Color:Red}Elementen {Color:White}-\nErde und Flamme - und das Schwert.\nDas {Color:Red}Weiβe Schwert{Color:White}, das die Kraft der\nElemente aufnehmen kann.\nBald kann das {Color:Red}Heilige Schwert\n{Color:White}erschaffen werden!", + "{Sound:00:92}Wir haben zwei von vier {Color:Red}Elementen {Color:White}-\nErde und Flamme - und das Schwert.\nDas {Color:Red}Weiße Schwert{Color:White}, das die Kraft der\nElemente aufnehmen kann.\nBald kann das {Color:Red}Heilige Schwert\n{Color:White}erschaffen werden!", "{Sound:00:91}Du guckst, als hättest du es noch\nnicht richtig verstanden...\nDie {Color:Green}Heilige Stätte{Color:White} ist ein Ort, der\nzwischen der Welt der Menschen\nund der Welt der Minish liegt.\nWie die Wurstscheibe beim Sandwich.\n...Was ist?\nIst das kein guter Vergleich!?!", "{Sound:00:8D}Lass uns nun zur {Color:Green}Heiligen Stätte\n{Color:White}gehen und dort die {Color:Red}Elemente{Color:White}...\n...auf das {Color:Red}Schwert {Color:White}übertragen!\nWas wir genau tun müssen?\nNa, das werden wir schon\nherausfinden, wenn es so weit ist!", "{Sound:00:92}Der Eingang zur {Color:Green}Heiligen Stätte{Color:White}\nist offenbar nur für uns sichtbar.\nLogisch erscheint mir das nicht...\nKomm, Knirps! Gehen wir hinein!", @@ -1147,34 +1147,34 @@ "{Sound:00:92}Das {Color:Red}Heilige Schwert{Color:White} zeigt\nbereits seine Macht!\nSetze die Körperteilung geschickt\nein, um an Orte zu gelangen,\ndie bisher unerreichbar waren.", "{Sound:00:92}Der Minish-Älteste im Wald hat auf der{Color:Red}\nKarte {Color:White}markiert, wo das {Color:Red}Element {Color:White}ist.\nWie wäre es, wenn du START drückst\nund selbst nachschaust?", "{Sound:00:8E}Hm. Der {Color:Red}Karte {Color:White}zufolge befindet sich\ndas {Color:Red}Element{Color:White} hinter der...\n...{Color:Green}geheimen Welt von Tabanta{Color:White}.\nSie liegt im Südwesten von Hyrule.", - "{Sound:00:90}Den Sumpf in der {Color:Green}Welt von Tabanta\n{Color:Blue}kann man nicht zu Fuβ überqueren{Color:White}.\nWas machen wir nur...?", - "{Sound:00:92}{Player}, wie lange bist du\nschon von zu Hause weg?\nDein Groβvater macht sich bestimmt\nSorgen. Du solltest ihn mal besuchen!", + "{Sound:00:90}Den Sumpf in der {Color:Green}Welt von Tabanta\n{Color:Blue}kann man nicht zu Fuß überqueren{Color:White}.\nWas machen wir nur...?", + "{Sound:00:92}{Player}, wie lange bist du\nschon von zu Hause weg?\nDein Großvater macht sich bestimmt\nSorgen. Du solltest ihn mal besuchen!", "{Sound:00:90}Uaah...!\n\nGähn! Irgendwie bin ich auch\nschon ganz müde...\nJetzt einen {Color:Red}Weckpilz{Color:White}! Dann wären\nwir wieder hellwach.", - "{Sound:00:92}Hüstel! Ähm...\n\n{Sound:00:8E}Der See östlich von Hyrule heiβt\n{Color:Green}Hylia-See{Color:White}.\nEr fasst eine groβe Menge Wasser,\ndas nach Süden weiter flieβt.\nDort entstand im Laufe der Zeit\nder {Color:Green}Tyloria-Wald{Color:White}.\nUnd, {Player}? War das lehrreich\nfür dich?", + "{Sound:00:92}Hüstel! Ähm...\n\n{Sound:00:8E}Der See östlich von Hyrule heißt\n{Color:Green}Hylia-See{Color:White}.\nEr fasst eine große Menge Wasser,\ndas nach Süden weiter fließt.\nDort entstand im Laufe der Zeit\nder {Color:Green}Tyloria-Wald{Color:White}.\nUnd, {Player}? War das lehrreich\nfür dich?", "{Sound:00:8E}Auch in der Stadt lebt eine Vielzahl\nvon {Color:Green}Minish{Color:White}...\nDie Menschen sehen sie nicht, aber\nmanche ahnen, dass es sie gibt.", - "{Sound:00:92}Dieser {Color:Red}Weckpilz{Color:White}, den du gekauft\nhast... Der stinkt ja fürchterlich.\nHust, hust!\n\n{Sound:00:91}Bei dem Geruch schreckt\njeder aus dem Schlaf auf!\nEgal wie süβ er geträumt hat...", + "{Sound:00:92}Dieser {Color:Red}Weckpilz{Color:White}, den du gekauft\nhast... Der stinkt ja fürchterlich.\nHust, hust!\n\n{Sound:00:91}Bei dem Geruch schreckt\njeder aus dem Schlaf auf!\nEgal wie süß er geträumt hat...", "{Sound:00:90}Also, dieser Schuhmacher...\n\nWie lange hätte der noch geschlafen,\nwenn wir ihn nicht geweckt hätten?\nPuh...!\nMit den Menschen hat man seine Mühe!!!\nSo ist das! {Player}!!!", - "{Sound:00:8E}Diese Dame im Wald, {Color:Green}Syrup{Color:White}...\nIch fand sie ja etwas befremdlich...\nAber ihre {Color:Red}Elixiere {Color:White}sind äuβerst\nwirksam, glaube ich.\nVielleicht habe ich zu viele Vorurteile...", + "{Sound:00:8E}Diese Dame im Wald, {Color:Green}Syrup{Color:White}...\nIch fand sie ja etwas befremdlich...\nAber ihre {Color:Red}Elixiere {Color:White}sind äußerst\nwirksam, glaube ich.\nVielleicht habe ich zu viele Vorurteile...", "{Sound:00:92}Überquert man den Sumpf in der {Color:Green}Welt von\nTabanta{Color:White}, erreicht man den Ort,\nan dem sich das {Color:Red}Element{Color:White} befindet.\nSieh auf der {Color:Red}Karte {Color:White}nach!", "{Sound:00:8D}Wenn du den Sumpf überqueren willst,\nmusst du schnell sein wie der Wind.\nWenn du trödelst, gehen wir beide unter\nund werden ganz dreckig!", "{Sound:00:92}Die {Color:Blue}einäugige Steinstatue{Color:White} in der {Color:Green}Welt\nvon Tabanta{Color:White} hat uns angestarrt.\nDas war mir nicht ganz geheuer.", "{Sound:00:8E}Wer hätte gedacht, dass hinter der{Color:Green}\nWelt von Tabanta{Color:White} diese {Color:Green}Ruine {Color:White}ist!\nWahrscheinlich lebte hier einst\nein Volk, das das {Color:Red}Element {Color:White}verehrte.", "{Sound:00:92}Das {Color:Red}Element {Color:White}ist sicher verwahrt.\nIn der Ruine sind überall Fallen.\n{Player}, sei vorsichtig!", "{Sound:00:8D}Wir sollten auf jeden Schritt\nachten, den wir hier tun.\nSonst verirren wir uns. Falls das\npassiert, sieh auf die {Color:Red}Karte{Color:White}.\nAuf ihr ist zu sehen, wo du dich gerade\nbefindest und wo dein Zielort ist.", - "{Sound:00:92}Das nächste {Color:Red}Element {Color:White}muss irgendwo\nin der Nähe des {Color:Green}Hylia-Sees{Color:White} sein.\nWie gelangen wir dorthin? Wer könnte\ndas bloβ wissen? ...", + "{Sound:00:92}Das nächste {Color:Red}Element {Color:White}muss irgendwo\nin der Nähe des {Color:Green}Hylia-Sees{Color:White} sein.\nWie gelangen wir dorthin? Wer könnte\ndas bloß wissen? ...", "{Sound:00:8D}Wenn du mit der {Color:Red}Okarina des Windes{Color:White} den\nVogel rufst, gelangst du überall hin!\nEr bringt dich überall hin, wo so ein\n{Color:Blue}Windmal{Color:White} am Boden ist.", "{Sound:00:8D}Jetzt, da wir die {Color:Red}Okarina des Windes\n{Color:White}haben, sollten wir sie ausprobieren!\nVielleicht entdecken wir auch an Orten,\ndie wir schon kennen, neue Dinge.", "{Sound:00:8E}Wer hätte gedacht, dass ausgerechnet\nder {Color:Green}Minish-Älteste{Color:White} in der {Color:Green}Bücherei{Color:White}...\n...ein Abenteurer war, der in den\n{Color:Green}Tempel des Tropfens{Color:White} vorgedrungen ist!\nLass uns diesen {Color:Green}Lexta {Color:White}suchen und\nmit ihm sprechen!", "{Sound:00:92}Aber wie ist dieser {Color:Green}Lexta {Color:White}nur in den\n{Color:Green}Tempel des Tropfens{Color:White} gelangt?\nHm... Am besten gehen wir zur\n{Color:Green}Bücherei {Color:White}und fragen ihn selbst!", - "{Sound:00:92}Wo die Minish in der {Color:Green}Bücherei{Color:White} leben?\nNa, wahrscheinlich {Color:Blue}in einem Buch{Color:White}!\nHm? Du glaubst mir nicht, stimmt's\n{Player}? Glaube mir ruhig!\nSchlieβlich bin ich selbst ein Minish,\nauch wenn ich nicht so aussehe.", - "{Sound:00:91}Jetzt müssen wir herumlaufen, damit\ndie Leute die Bücher zurückgeben...\nWir tun das zwar, um den Weg zum\n{Color:Green}Tempel des Tropfens{Color:White} herauszufinden,\n{Sound:00:8D}aber es ist doch unwürdig für einen\ngroβen Weisen wie mich!!!", + "{Sound:00:92}Wo die Minish in der {Color:Green}Bücherei{Color:White} leben?\nNa, wahrscheinlich {Color:Blue}in einem Buch{Color:White}!\nHm? Du glaubst mir nicht, stimmt's\n{Player}? Glaube mir ruhig!\nSchließlich bin ich selbst ein Minish,\nauch wenn ich nicht so aussehe.", + "{Sound:00:91}Jetzt müssen wir herumlaufen, damit\ndie Leute die Bücher zurückgeben...\nWir tun das zwar, um den Weg zum\n{Color:Green}Tempel des Tropfens{Color:White} herauszufinden,\n{Sound:00:8D}aber es ist doch unwürdig für einen\ngroßen Weisen wie mich!!!", "{Sound:00:8E}Die Minish interessieren sich sehr für\nMenschen. Sie beobachten sie,\nohne dass die Menschen es bemerken.\nAlso, {Player}, pass gut auf!", "{Sound:00:8D}Drei Bücher müssen zurückgegeben\nwerden. {Player}, du bist dran!\nIch würde dir ja gerne helfen, aber ich\nbin nun mal ein Minish-Weiser.\nIch verstehe nicht so recht, was die\nMenschen so treiben...\n{Sound:00:8D}...Also, los!", "{Sound:00:91}Wir haben zwar das {Color:Red}Element {Color:White}erhalten,\naber das war ganz schön schwierig!\n{Sound:00:92}He! Einmal tief durchatmen und weiter!\n{Player}!!!", "{Sound:00:92}Wie ist der alte {Color:Green}Lexta {Color:White}nur in\nden {Color:Green}Tropfen-Tempel{Color:White} gelangt?\nIch kann mir das nicht erklären...", "{Sound:00:8E}Wenn man es bedenkt...\nDie Minish, die in der Stadt leben,\nhaben es auch nicht einfach.\nDa habe ich auch etwas dazugelernt.", "{Sound:00:92}Im {Color:Green}Tempel des Tropfens{Color:White} ist\ndas letzte {Color:Red}Element {Color:White}zu finden.\nDas erzählte der Älteste aus\ndem Dorf der Wald-Minish.\n{Sound:00:8D}Also, Augen zu und durch!\nVerstanden? {Player}!?!\n... ... ...{01:0A}\nMeine Güte!\nDas war doch nicht\nwörtlich gemeint!", - "{Sound:00:92}Mit den {Color:Red}Flossen{Color:White}, die du vom\nalten Lexta erhalten hast,\nkannst du nicht nur {Color:Blue}schwimmen{Color:White},\nsondern auch {Color:Blue}tauchen{Color:White}!\nDas ist praktisch, wenn du\njemandem ausweichen willst.\nWenn wir beim Schwimmen gegen etwas\nstoβen, bin ich der Leidtragende...\nAlso pass auf, {Player}!", + "{Sound:00:92}Mit den {Color:Red}Flossen{Color:White}, die du vom\nalten Lexta erhalten hast,\nkannst du nicht nur {Color:Blue}schwimmen{Color:White},\nsondern auch {Color:Blue}tauchen{Color:White}!\nDas ist praktisch, wenn du\njemandem ausweichen willst.\nWenn wir beim Schwimmen gegen etwas\nstoßen, bin ich der Leidtragende...\nAlso pass auf, {Player}!", "{Sound:00:92}Wir sollten auf jeden Schritt\nachten, den wir hier tun.\nSonst verirren wir uns. Falls das\npassiert, sieh auf die {Color:Red}Karte{Color:White}.\nAuf ihr ist zu sehen, wo du dich gerade\nbefindest und wo dein Zielort ist.", "{Sound:00:92}... Das war also der {Color:Green}König von Hyrule\naus ferner Vergangenheit{Color:White}...\nEs gibt wohl keinen anderen Weg, das\nverlorene {Color:Red}Element {Color:White}wiederzuerlangen.\nDann lass uns zu dem Ort gehen,\nder auf der {Color:Red}Karte {Color:White}eingezeichnet ist...\nDoch vorher sollten wir zur {Color:Green}Heiligen\nStätte{Color:White} gehen, um das {Color:Red}Element{Color:White}\nauf das {Color:Red}Schwert {Color:White}zu übertragen!", "{Sound:00:92}Der König und die Soldaten können ihn\nnicht sehen,\naber der Eingang zur {Color:Green}Heiligen Stätte\n{Color:White}liegt im Innenhof des {Color:Green}Schlosses{Color:White}.", @@ -1183,20 +1183,20 @@ "{Sound:00:92}{Player}!!! Wir müssen nur noch\nein {Color:Red}Element {Color:White}finden!!!\nWenn du Zelda mit dem {Color:Red}Heiligen Schwert\n{Color:White}von dem Fluch befreit hast,\nkannst du sie doch einmal zu\neinem Picknick einladen.\n{Sound:00:8D}Dabei darf ich natürlich nicht fehlen!\nAls Berater in Sachen Liebe!", "{Sound:00:8E}Hast du das auch gesehen?\n{Color:Green}König Gustaf{Color:White} hat uns gerufen...\nJetzt sollten wir zu dem Ort gehen, den\ner auf der {Color:Red}Karte {Color:White}eingezeichnet hat.\nOder war das ganze nur ein Traum?\nNa, das wissen wir, wenn wir da sind.", "{Sound:00:91}Puh!\nWir wurden zum {Color:Green}Grab {Color:White}geführt...\nAlso war dieser {Color:Green}Gustaf{Color:White}, den wir\nsahen, doch nicht... Huch!\n{Sound:00:90}...Brrrr. Oh, nein!\nEs ist so kalt hier...", - "{Sound:00:90}Bisher habe ich nichts gesagt,\naber ich finde... Ein Grab, weiβt du...\n{Sound:00:91}Also... Ich würde das Grab\nlieber nicht betreten.\nAber dir, {Player}, scheint\ndas wenig auszumachen.\nDu bist wohl nicht leicht\naus der Ruhe zu bringen...", + "{Sound:00:90}Bisher habe ich nichts gesagt,\naber ich finde... Ein Grab, weißt du...\n{Sound:00:91}Also... Ich würde das Grab\nlieber nicht betreten.\nAber dir, {Player}, scheint\ndas wenig auszumachen.\nDu bist wohl nicht leicht\naus der Ruhe zu bringen...", "{Sound:00:92}Nun gut! {Color:Green}Gustaf {Color:White}erwartet uns\nim Inneren des Grabes!\nEs ist das Grab der Königsfamilie von\nHyrule, also sei vorsichtig, {Player}!", "{Sound:00:91}Oje...\nDen verstorbenen König zu treffen...\nEs war bestimmt keine böse Absicht,\naber er wirkte so... wenig lebendig.\nKönig Gustaf erwähnte so etwas wie\neine {Color:Green}Wasserquelle{Color:White}.\nHmm... Welchen Ort kann er\ndamit nur gemeint haben?", - "{Sound:00:92}Steht {Color:Green}Quelle {Color:White}für den Ort, {Color:Blue}an dem\nder Wasserfluss beginnt{Color:White}?\n{Color:Blue}Wo entspringt bloβ{Color:White} das Wasser, das\nHyrule mit dem kühlen Nass versorgt?", + "{Sound:00:92}Steht {Color:Green}Quelle {Color:White}für den Ort, {Color:Blue}an dem\nder Wasserfluss beginnt{Color:White}?\n{Color:Blue}Wo entspringt bloß{Color:White} das Wasser, das\nHyrule mit dem kühlen Nass versorgt?", "{Sound:00:92}Es bleibt noch ein {Color:Red}Element{Color:White}.\n\nDen Ort, an dem sich das letzte {Color:Red}Element{Color:White}\nbefindet, kennen wir nicht genau.\nAber wir haben einen Hinweis erhalten,\nalso lass dich nicht entmutigen!\nWenn wir die {Color:Green}Quelle {Color:White}finden, von der der\nKönig sprach, kommen wir weiter.\n{Sound:00:8D}Los geht's, {Player}!", - "{Sound:00:90}Ach so! Mit der {Color:Green}Quelle {Color:White}ist der\n{Color:Green}Sela-Wasserfall{Color:White} gemeint.\nIch weiβ auch nicht, was sich\ndahinter verbirgt.\nAber es hängt irgendwie mit dem\nletzten {Color:Red}Element {Color:White}zusammen.\n{Sound:00:8D}Dann wollen wir mal, {Player}!\n", + "{Sound:00:90}Ach so! Mit der {Color:Green}Quelle {Color:White}ist der\n{Color:Green}Sela-Wasserfall{Color:White} gemeint.\nIch weiß auch nicht, was sich\ndahinter verbirgt.\nAber es hängt irgendwie mit dem\nletzten {Color:Red}Element {Color:White}zusammen.\n{Sound:00:8D}Dann wollen wir mal, {Player}!\n", "{Sound:00:92}Was verbirgt sich nur hinter der{Color:Green}\nQuelle{Color:White}?\nEigentlich kann es da nicht viel mehr\nals den Himmel geben...\nAber Grübeln hilft da nicht weiter!!!\n\n... ... ...{01:0A}\n\nMir ist gerade ein Gedanke gekommen.\n\nIch bin dir in dem, was ich denke\nund sage, ähnlicher geworden...\n{Sound:00:8D}Nein! Nein!!!\nIch muss mich wieder beruhigen!!!", "{Sound:00:92}Hinter dem {Color:Green}Sela-Wasserfall{Color:White} verbirgt\nsich auf jeden Fall {Color:Blue}etwas{Color:White},\ndas uns zum {Color:Red}Element {Color:White}führt. Lass uns\nweitermachen, um {Color:Green}Zelda {Color:White}zu retten!", - "{Sound:00:8E}Die Welt der Wolken...\nWir sind dort angekommen...\n{Player}, schau bloβ nicht nach\nunten!\n{Sound:00:90}Genau, da wird einem gleich schwindelig!", + "{Sound:00:8E}Die Welt der Wolken...\nWir sind dort angekommen...\n{Player}, schau bloß nicht nach\nunten!\n{Sound:00:90}Genau, da wird einem gleich schwindelig!", "{Sound:00:92}Nichts als Wolken, wo man auch\nhinsieht... Es gibt keine Wegweiser!\nAber es muss {Color:Blue}etwas{Color:White} geben,\ndas uns zum {Color:Red}Element {Color:White}führt.\nÜbersieh es nicht, {Player}!", "{Sound:00:92}Der Wirbelwind an der {Color:Green}Sela-Quelle{Color:White}\nbrachte uns hierher.\nIch habe nicht die geringste\nAhnung, was uns erwartet.\nWir müssen das Element finden,\naber andererseits...{01:0A}\nHm? He! {Player}! Jetzt\nwerde du nicht auch wankelmütig!\n{Sound:00:8D}Auf, auf! Zackizacki!\nDas wird lustig...", "{Sound:00:8E}Menschen, die über den Wolken leben...\n\nWissen die etwas über das\nletzte {Color:Red}Element{Color:White}?\nWir sollten mit ihnen sprechen.", "{Sound:00:92}Was ist, {Player}?\n\nWollten wir nicht das Volk des\nWindes nach dem {Color:Red}Element {Color:White}fragen?", - "{Sound:00:8E}Warum haben die hier oben über den\nWolken so ein groβes Haus gebaut?\nEs würde mich nicht wundern, wenn\nwir hier irgendwo abstürzen!\n{Sound:00:92}{Player}, sei vorsichtig, wo du\nhintrittst, schööön vorsichtig!", + "{Sound:00:8E}Warum haben die hier oben über den\nWolken so ein großes Haus gebaut?\nEs würde mich nicht wundern, wenn\nwir hier irgendwo abstürzen!\n{Sound:00:92}{Player}, sei vorsichtig, wo du\nhintrittst, schööön vorsichtig!", "{Sound:00:90}Der {Color:Green}Palast des Windes{Color:White}, wie er in der\nLuft schwebt - ein prächtiger Anblick!\nWar das jetzt der falsche Zeitpunkt,\num so etwas zu sagen?\nDie Monster sind zwar stark, aber gib\ntrotzdem Acht, dass du nicht abstürzt!", "{Sound:00:92}Im Innern des {Color:Green}Palastes des Windes\n{Color:White}ist das letzte {Color:Red}Element {Color:White}verborgen.\n{Player}, das ist das letzte\nElement, dann sind wir fertig!\n{Sound:00:8D}Los geht's!", "{Sound:00:92}Nanu!!! Gegen den Strom\nkommen wir nicht an!\nVielleicht müssen wir uns\nmit dem Strom bewegen?\nKommst du nicht vorwärts,\ndann gehe rückwärts!", @@ -1221,7 +1221,7 @@ "{Sound:00:8E}Es ist schön, von hier oben\nherunterzuschauen, aber...\nEin bisschen höher wäre noch besser...\nHast du auch deine Milch getrunken?", "{Sound:00:8D}He, du Knirps!\nGeh doch etwas langsamer!\nHast du vergessen, dass ich\nauf deinem Kopf bin?\nDas kann ja heiter werden...", "{Sound:00:90}Schnarch...\nOh! W-Was ist denn?!\n{Sound:00:8D}Was sagst du da?\nIch habe nicht geschlafen!\n{Sound:00:90}Gähn...", - "{Sound:00:92}Oh! Was ist denn?\n\nWas? Du hast nach mir gerufen?\nNun. Ich bin äuβerst beschäftigt!\n{Sound:00:8D}Ts, ts, ts! Kein Respekt...", + "{Sound:00:92}Oh! Was ist denn?\n\nWas? Du hast nach mir gerufen?\nNun. Ich bin äußerst beschäftigt!\n{Sound:00:8D}Ts, ts, ts! Kein Respekt...", "{Sound:00:8D}Äh, lieber Mützenträger! Eine Bitte!\nMein Rücken juckt so sehr!\n{Sound:00:8D}Mit dem Schnabel komme ich da nicht\nran! Kratzt du mich ein wenig?\n... ... ...{01:0A}\n{Sound:00:90}{01:02}{Color:Blue}Oh, jaaa! {Symbol:0B}{Color:White}{01:03}{01:04}{01:05}{01:04}{01:03}{01:02} Genau da, genau da!\n{Sound:00:92}{01:01}Mmmmh, das war gut!\nVielen Dank auch!", "{Sound:00:8D}Hoppla! Jetzt roll doch nicht so viel!\nIch werde ja ganz dreckig dabei!", "{Sound:00:8E}Ich würde so gerne bald ein schönes\nBad nehmen, um mich zu waschen...\n{Sound:00:92}Hm? Was sagst du?\n{Color:Blue}In die Reinigung{Color:White}?!\n{Sound:00:8D}Ich bin doch keine dreckige Wäsche!", @@ -1232,7 +1232,7 @@ "{Sound:00:90}Mampf, mampf...\n\nIch bin satt...\n{Sound:00:8E}Den Rest {Color:Blue}nehme ich mit nach Hause{Color:White}...\nOje! Wovon habe ich da nur\ngerade geträumt?\nIch schlafe noch ein wenig,\n{Sound:00:90}um darüber nachzudenken...", "{Sound:00:92}Hüstel! Ich nehme eigentlich keine\nSchüler mehr an...\nBei dir überlege ich es mir noch einmal.", "{Sound:00:90}Hab ich einen Hunger!\n... ... ...\nGroarr!\n\nHuch!!!\n{Sound:00:8D}War ich das etwa?!?\nNein, das war... der Wind!", - "{Sound:00:8E}Du bist immer frisch und munter...\nNein, ich mache mich nicht lustig!\nIm Gegenteil - das war ein Lob!\nDu bist ein groβes Talent!", + "{Sound:00:8E}Du bist immer frisch und munter...\nNein, ich mache mich nicht lustig!\nIm Gegenteil - das war ein Lob!\nDu bist ein großes Talent!", "{Sound:00:92}Hm? Hm???\nIch dachte, eine Frau ruft nach mir...\nOder habe ich das nur geträumt?", "{Sound:00:8E}Hast du es gelesen, {Player}?\nWas nützt das schon?\n{Sound:01:E4}Auaaa! Ich habe mir {Color:Blue}auf die Chunge\ngebichen{Color:White}. Cho ein Micht!\n{Sound:00:91}Cho, mach einfach weiter...", "Puh...\n\n{Sound:00:8E}Ich bin so lange nicht mehr selbst\ngelaufen, dass ich eingerostet bin.\n{Sound:00:92}Ja! {Player}, willst du nicht\nmal von mir getragen werden?", @@ -1260,7 +1260,7 @@ "{Sound:01:F6}Du willst nicht...?\nNa dann, vielleicht beim nächsten Mal!", "{Sound:02:05}Juhu!\nJetzt passiert vielleicht etwas Gutes.", "{Sound:01:FC}Die {Color:Green}Dame {Color:White}mit den Pilzen\nhat frisches {Color:Red}Elixier {Color:White}gebraut.\nKnallrotes {Color:Red}Elixier{Color:White}.\nWer das wohl trinken wird?", - "{Sound:01:FB}Das {Color:Green}Gewässer {Color:White}südlich von hier...\nIch glaube, da stimmt was nicht...\nIch weiβ zwar nicht was, aber...", + "{Sound:01:FB}Das {Color:Green}Gewässer {Color:White}südlich von hier...\nIch glaube, da stimmt was nicht...\nIch weiß zwar nicht was, aber...", "{Sound:01:FD}{Color:Blue}Fragmente vereinen{Color:White}?\n...Wollen wir?", "{Sound:01:FE}Keine Lust...?\nNa gut...", "{Sound:01:FF}Sie passen!\nVielleicht passiert jetzt was Gutes...", @@ -1269,22 +1269,22 @@ "{Sound:01:FA}{Color:Blue}Fragmente vereinen{Color:White}?\nAber gerne doch!", "{Sound:01:F8}Wie, keine Lust?\nDann mach doch was du willst!", "{Sound:01:F8}Sie passen!\nHihi! Hoffentlich passiert was Gutes.", - "{Sound:01:F8}Bist du gekommen,\num meine {Color:Blue}Bohnen {Color:White}zu stehlen?!\nDas schaffst du nicht.\nSie sind zu groβ! Hihi!\n{Sound:01:F9}Ich rede genau wie der {Color:Green}Älteste{Color:White}, oder?\nWas? Er redet ganz anders? Pff...", - "{Sound:01:F9}Ich habe da hinten eine {Color:Blue}Bohne{Color:White}\ngepflanzt, aber sie sprieβt nicht.", + "{Sound:01:F8}Bist du gekommen,\num meine {Color:Blue}Bohnen {Color:White}zu stehlen?!\nDas schaffst du nicht.\nSie sind zu groß! Hihi!\n{Sound:01:F9}Ich rede genau wie der {Color:Green}Älteste{Color:White}, oder?\nWas? Er redet ganz anders? Pff...", + "{Sound:01:F9}Ich habe da hinten eine {Color:Blue}Bohne{Color:White}\ngepflanzt, aber sie sprießt nicht.", "{Sound:02:03}Willst du {Color:Blue}Fragmente vereinen{Color:White}?\nGut, probieren wir es aus!", "{Sound:01:FA}Du willst nicht?\nNa ja, dann beim nächsten Mal!", "{Sound:01:FA}Juhu!\nHoffentlich passiert jetzt was Gutes.", - "{Sound:01:F8}Die {Color:Blue}Bohne {Color:White}ist gewachsen,\naber jetzt ist sie ein wenig zu groβ...", + "{Sound:01:F8}Die {Color:Blue}Bohne {Color:White}ist gewachsen,\naber jetzt ist sie ein wenig zu groß...", "{Sound:02:0C}Auf dem {Color:Green}Gipfel des linken Berges\n{Color:White}habe ich eine {Color:Blue}Bohne {Color:White}gepflanzt,\naber sie wächst überhaupt nicht.\nIch bin nun mal ein Mann, der...\n...mit Eisen arbeitet.\nMit Bohnen habe ich kein Glück.", "{Sound:02:0C}Du willst {Color:Blue}Fragmente vereinen{Color:White}?\nNa, dann wollen wir es mal probieren!", "{Sound:02:0C}Was denn, du willst nicht?\nNa dann beim nächsten Mal!", "{Sound:02:0C}Na, das passt doch wunderbar!\nVielleicht passiert ja etwas Gutes!", "{Sound:02:0C}Oh!\nDie {Color:Blue}Bohne {Color:White}ist ja gewachsen!\nEs geht also doch!\nHahahaha!", - "{Sound:02:04}Hör mal zu!\nIch habe eine groβe {Color:Blue}Bohne {Color:White}gepflanzt!\nSie sprieβt zwar noch nicht,\naber sie wird bestimmt sehr groβ!", + "{Sound:02:04}Hör mal zu!\nIch habe eine große {Color:Blue}Bohne {Color:White}gepflanzt!\nSie sprießt zwar noch nicht,\naber sie wird bestimmt sehr groß!", "{Sound:02:00}{Color:Blue}Fragmente vereinen{Color:White}?\nIch bin dabei!", "{Sound:02:01}Was? Du willst nicht?\nNa, dann bis zum nächsten Mal!", "{Sound:02:02}Ey super, das passt ja!\nJetzt passiert bestimmt etwas Gutes!", - "{Sound:02:04}Hör mal zu! Aus der Bohne\nist ein groβer {Color:Blue}Baum {Color:White}gewachsen!\nWo er wohl hinführt?", + "{Sound:02:04}Hör mal zu! Aus der Bohne\nist ein großer {Color:Blue}Baum {Color:White}gewachsen!\nWo er wohl hinführt?", "{Color:Blue}Fragmente vereinen{Color:White}, ja?\nGut, mal sehen, ob sie passen!", "Was denn, keine Lust?\nDann beim nächsten Mal!", "Sie passen perfekt.\nHoffentlich passiert etwas Gutes!", @@ -1342,9 +1342,9 @@ "Wollen wir {Color:Blue}Fragmente vereinen{Color:White}?", "Du willst nicht?\nKomm bald wieder!", "Die passen perfekt!\nDa passiert bestimmt was Gutes!", - "Ich verteile fleiβig die Post...\nAh! Das ist doch ein {Color:Red}Glücksfragment{Color:White}!", + "Ich verteile fleißig die Post...\nAh! Das ist doch ein {Color:Red}Glücksfragment{Color:White}!", "Ich muss die Post zustellen,\ndeshalb entschuldige mich, bitte!", - "Das passt! Jetzt macht mir die Arbeit\nnoch mehr Spaβ! Ich habe viel zu tun!", + "Das passt! Jetzt macht mir die Arbeit\nnoch mehr Spaß! Ich habe viel zu tun!", "{Color:Blue}Fragmente vereinen{Color:White}?\nGut, probieren wir es aus!", "Du machst nicht mit?\nNa dann, ich hab viel zu tun!", "Ja, perfekt!\nViel zu tun habe ich wohl trotzdem.", @@ -1426,19 +1426,19 @@ "{Sound:02:0D}Oh! Dass ein junger Mensch den Weg\nhierher findet! Ich habe es geahnt!\nWeil du hier bist, möchte ich dir meinen\n{Color:Red}wertvollsten Schatz{Color:White} schenken!\nMach weiter so!", "{Sound:02:0D}Ah, du bist wieder da! Es ist so einsam\nhier, deshalb freue ich mich sehr!\nAber ich habe leider nichts,\nwas ich dir schenken könnte.", "{Sound:02:0D}Hast du die {Color:Green}Feenkönigin {Color:White}vom {Color:Green}Tyloria-\nWald{Color:White} getroffen? Sie lebt in einer Höhle.", - "{Sound:02:0D}Hast du die {Color:Green}Feenkönigin {Color:White}vom {Color:Green}Gongol-\nBerg{Color:White} getroffen?\nSie lebt hinter einer Wand, die du\nmit einer {Color:Red}Bombe {Color:White}einreiβen kannst.", - "{Sound:02:0D}Hast du die {Color:Green}Feenkönigin {Color:White}vom {Color:Green}Grab\nder Königsfamilie{Color:White} getroffen?\nSie lebt hinter einer Wand, die du\nmit einer {Color:Red}Bombe {Color:White}einreiβen kannst.", + "{Sound:02:0D}Hast du die {Color:Green}Feenkönigin {Color:White}vom {Color:Green}Gongol-\nBerg{Color:White} getroffen?\nSie lebt hinter einer Wand, die du\nmit einer {Color:Red}Bombe {Color:White}einreißen kannst.", + "{Sound:02:0D}Hast du die {Color:Green}Feenkönigin {Color:White}vom {Color:Green}Grab\nder Königsfamilie{Color:White} getroffen?\nSie lebt hinter einer Wand, die du\nmit einer {Color:Red}Bombe {Color:White}einreißen kannst.", "{Sound:00:D4}Im Gras lag ein {Color:Red}Glücksfragment{Color:White}. Muh!\nWillst du {Color:Blue}Fragmente vereinen{Color:White}? Muh!\nIch habe das Fragment gründlich\nabgeleckt. Es ist schön sauber.", "{Sound:00:D4}Das Gras ist so lecker! Muh!\nWillst du auch mal probieren?", "{Sound:00:D5}Du hast hierher gefunden! Gacker!\n\nIch verwahre heimlich {Color:Green}Anjus{Color:White}\n{Color:Red}Glücksfragment{Color:White}. Gacker!\nWas? Nein, ich habe es nicht\ngestohlen! Ich verwahre es. Heimlich.", "{Sound:00:D5}Nanu?\nDas {Color:Red}Glücksfragment {Color:White}ist weg! Gacker!\nIch kann es {Color:Green}Anju {Color:White}nicht zurückgeben.\nAber ich bin froh, dass es weg ist...", - "{Sound:00:D6}Ah! Ein Minish! Gaaack!\nKeine Angst, Würmchen! Gaack!\nIch picke nicht auf dir herum!\n\nIch erzähle dir was! Gaaack!\n\nIrgendwo in Hyrule gibt es eine groβe\n{Color:Green}Fee{Color:White}, die dir bei deinen Abenteuern hilft.\nSie hilft aber nur den Aufrichtigen.\nAlso beantworte ihre Fragen ehrlich!" + "{Sound:00:D6}Ah! Ein Minish! Gaaack!\nKeine Angst, Würmchen! Gaack!\nIch picke nicht auf dir herum!\n\nIch erzähle dir was! Gaaack!\n\nIrgendwo in Hyrule gibt es eine große\n{Color:Green}Fee{Color:White}, die dir bei deinen Abenteuern hilft.\nSie hilft aber nur den Aufrichtigen.\nAlso beantworte ihre Fragen ehrlich!" ], [ "Genial! Jetzt kann ich Geld\nverdienen, ohne das Haus zu vermieten!", "Oh! Jetzt bin ich so motiviert,\ndass ich ein Haus in fünf Minuten baue!", "Mein hausgemachtes {Color:Red}Rotes Elixier{Color:White}\nist gleich fertig!\nHahahahaha!", - "Jetzt weiβ ich es!\nSo wird das Spiel noch spannender!\nHahaha! Ich bin schon so gespannt!\nIch will gleich damit anfangen!", + "Jetzt weiß ich es!\nSo wird das Spiel noch spannender!\nHahaha! Ich bin schon so gespannt!\nIch will gleich damit anfangen!", "Ich möchte den Menschen noch\nnützlicher sein...\nJa! Ich werde {Color:Green}Magnus {Color:White}bitten,\nein Buch zu schreiben,\ndamit wir stärker werden und die\nUngeheuer besiegen können!\nIch werde noch mehr arbeiten müssen!\n{Color:Green}Weilfried {Color:White}wird mir helfen müssen!", "Es wäre doch toll, wenn man die {Color:Red}Bomben{Color:White}\nfernzünden könnte...\nHm? Genau!\nMan muss sie nur ein wenig umbauen!", "Ich war schon lange nicht mehr hier.\nIch will viele Fragmente verkaufen.", @@ -1447,10 +1447,10 @@ "{Sound:01:BA}Endlich ist sie offen!\nIch gehe gleich hinein.", "{Sound:01:B9}Hm. Das hat nicht geklappt.\nAlleine schafft man es nicht.", "{Sound:01:B8}Ich habe das Gefühl,\njemand ruft nach mir...\nHm? Ein Freund ist in Not.\nHe! Ich helfe dir!", - "{Sound:01:B7}Du bist eine groβe Hilfe! Lass uns\ndie Mauer gemeinsam einreiβen!", + "{Sound:01:B7}Du bist eine große Hilfe! Lass uns\ndie Mauer gemeinsam einreißen!", "{Sound:01:B7}Die nächste Mauer ist noch schwieriger.\nAber wir versuchen es trotzdem!", "{Sound:01:B8}Ich habe dich gerochen, mein Freund.\nWas machst du hier?", - "{Sound:01:BA}Du bist eine groβe Hilfe! Lass uns\ndie Mauer gemeinsam einreiβen!", + "{Sound:01:BA}Du bist eine große Hilfe! Lass uns\ndie Mauer gemeinsam einreißen!", "{Sound:01:B9}Auch zu dritt haben wir\nes nicht geschafft...", "{Sound:01:B8}Es riecht nach leckeren Steinen...\nvon der anderen Seite der Mauer her.", "{Sound:01:B7}Hilfst du uns?", @@ -1509,7 +1509,7 @@ "Hauptgewinn!!!", "Unglaublich! Du hast bei der Lotterie\nden Hauptgewinn gezogen, {Color:Green}Zelda{Color:White}!\nAlso dann,\nsuch dir etwas aus!", "Da hätten wir...\neinen {Color:Red}herzförmigen Stein{Color:White}!\nOder...", - "...ein {Color:Red}schönes, groβes Juwel{Color:White}!\nOder aber...", + "...ein {Color:Red}schönes, großes Juwel{Color:White}!\nOder aber...", "...einen {Color:Red}kleinen Schild{Color:White}.", "Nun, wofür entscheidest du dich?\n\nDas Juwel? Der herzförmige Stein ist\nauch sehr hübsch!\nSuch dir aus, was dir gefällt!", "Ich nehme\nden {Color:Red}kleinen Schild{Color:White}.", @@ -1546,7 +1546,7 @@ "Die Prinzessin mit der {Color:Blue}Kraft\ndes Lichts{Color:White}...\nWenn ich mich nicht um sie kümmere,\nwird sie mir später nur im Weg sein...", "Durch meinen {Color:Blue}Fluch{Color:White}, werde zu Stein!", "{Player}! Pass auf!\n{09:00}", - "...?!\n\nWas ist denn das?!?\n\nDa waren nur Monster in der Kiste!?!\n\n...\nNa, auch gut...\nIch weiβ, dass sich das {Color:Red}Force\n{Color:White}in dieser Welt befindet.\nIch werde in Ruhe danach suchen.\n\n{Sound:00:9B}Hehehehe...", + "...?!\n\nWas ist denn das?!?\n\nDa waren nur Monster in der Kiste!?!\n\n...\nNa, auch gut...\nIch weiß, dass sich das {Color:Red}Force\n{Color:White}in dieser Welt befindet.\nIch werde in Ruhe danach suchen.\n\n{Sound:00:9B}Hehehehe...", "Hehehe... Das passiert allen,\ndie sich mir in den Weg stellen.\nDann will ich mal den Inhalt der\nSchatzkiste an mich nehmen...", "Aaahhh!", "", @@ -1557,9 +1557,9 @@ "{Color:Green}Minish{Color:White}?\n\nDieses Zwergenvolk aus der{Color:Green}\n{Color:White}Legende? Das {Color:Green}Minish-Volk{Color:White}?", "So ist es. Dieses meine ich.\n\nDoch {Color:Green}Minish {Color:White}existieren nicht nur in der\nLegende. Es gibt sie wirklich!\nEs ist ein Geheimnis, das unsere\nFamilie seit vielen Generationen hütet.\nDie Minish leben im {Color:Green}Tyloria-Wald{Color:White}.\nSie schufen das Schwert der Minish.\nUnd nur sie können das {Color:Red}zerbrochene\nSchwert{Color:White} wieder zusammenfügen!", "Wa-wa-was?!\nSenden wir gleich Soldaten aus!", - "Nein... keine Soldaten!\n\nEs heiβt, Erwachsene können \ndie Minish nicht sehen!\nEgal, wie sehr sie es auch\nversuchen!", + "Nein... keine Soldaten!\n\nEs heißt, Erwachsene können \ndie Minish nicht sehen!\nEgal, wie sehr sie es auch\nversuchen!", "Aha...\n\nWenn das so ist... {Player}!\nDu könntest doch gehen!", - "{Sound:01:EB}{Player}, wenn du bereit bist, möchte\nauch ich dich darum bitten.\nBitte befreie Zelda vom {Color:Blue}Fluch des\nHexenmeisters{Color:White}!\nDie {Color:Green}Minish {Color:White}wissen, wie man das\n{Color:Red}Heilige Schwert{Color:White} wiederherstellt.\nDoch ich möchte nicht, dass dir auch\nnoch etwas Schlimmes zustöβt.\nDeshalb gebe ich dir das {Color:Red}zerbrochene\nSchwert {Color:White}und dies.", + "{Sound:01:EB}{Player}, wenn du bereit bist, möchte\nauch ich dich darum bitten.\nBitte befreie Zelda vom {Color:Blue}Fluch des\nHexenmeisters{Color:White}!\nDie {Color:Green}Minish {Color:White}wissen, wie man das\n{Color:Red}Heilige Schwert{Color:White} wiederherstellt.\nDoch ich möchte nicht, dass dir auch\nnoch etwas Schlimmes zustößt.\nDeshalb gebe ich dir das {Color:Red}zerbrochene\nSchwert {Color:White}und dies.", "Gut. Soldaten, beschützt die Stadt vor\nden Monstern! Der Rest sucht {Color:Green}Vaati{Color:White}!", "Tief im {Color:Green}Tyloria-Wald\n{Color:White}ist der {Color:Green}Wald-Schrein{Color:White}.\nEr wurde früher von Menschen und\nMinish genutzt.\nGehe also zuerst zum {Color:Green}Wald-Schrein{Color:White}!", "Nimm diese {Color:Red}Karte {Color:White}mit!\n\n{07:10:5E}", @@ -1569,15 +1569,15 @@ "", "Falls du dich auf dem Weg zum Wald\nverläufst, drücke erst START...\n...und dann {Key:Left} oder {Key:Right},\num die Karte aufzurufen.\nDer Wald ist auf der Karte\neingezeichnet. Pass gut auf dich auf!", "Da bin ich aber froh!\nDu bist wieder bei Bewusstsein!\n{07:10:60}", - "Dein Groβvater {Color:Green}Alberich {Color:White}ist beim König.", + "Dein Großvater {Color:Green}Alberich {Color:White}ist beim König.", "Bitte befreie {Color:Green}Prinzessin Zelda {Color:White}vom\n{Color:Blue}Fluch des Hexenmeisters{Color:White}!", "Bitte sei vorsichtig!", "Drücke beim Laufen {Key:Right}, um zu rollen.\nDann kommst du schneller vorwärts.\nWenn du während des Abenteuers\n{Color:Blue}speichern {Color:White}willst, drücke {Color:Blue}START{Color:White}...\n...und wähle im {Color:Blue}Item-Menü{Color:White} oder im\n{Color:Blue}Status-Menü{Color:White} \"SPEICHERN\"!", - "Drauβen sind viele Ungeheuer.\n\nWenn du einem begegnest,\nschütze dich mit dem Schild...\n...und greife es aus der Nähe\nmit dem Schwert an!", + "Draußen sind viele Ungeheuer.\n\nWenn du einem begegnest,\nschütze dich mit dem Schild...\n...und greife es aus der Nähe\nmit dem Schwert an!", "", "{Sound:01:E0}Auaaa!\n\nDas sind die {Color:Green}Händler-Dekus{Color:White}, von denen\ndie Soldaten erzählt haben.\nSie belästigen Passanten.\nEine echte Plage, diese Laubkerle!\n{Player}, tu doch etwas!\nSo kommen wir nicht zum Schloss!\nWenn du {Color:Blue}diese Nüsse{Color:White} abwehrst,\nkommen wir bestimmt irgendwie weiter.", "Wenn du {Color:Blue}diese Nüsse{Color:White} abwehrst,\nkommen wir bestimmt irgendwie weiter.", - "Der Händler-Deku sah süβ aus,\naber er spuckt mit Nüssen!\nNa ja... Gehen wir schnell zum\nSchloss und liefern das Schwert ab!", + "Der Händler-Deku sah süß aus,\naber er spuckt mit Nüssen!\nNa ja... Gehen wir schnell zum\nSchloss und liefern das Schwert ab!", "Wo gehst du hin, {Player}?\nUnternimm doch etwas! Schnell!", "Tut mir Leid wegen der Nuss.\n\nIch kam doch in die {Color:Green}Stadt{Color:White}, um auf dem\n{Color:Blue}Fest {Color:White}Geschäfte zu machen.\nAber ich bekomme keine Worte,\nsondern nur Nüsse aus dem Mund.\nAlle haben Angst vor mir und kommen\nnicht in meine Nähe!\nSo wird das nichts mit den Geschäften.\nAlso, zurück ins heimelige Dunkel!", "", @@ -1586,7 +1586,7 @@ "", "", "", - "Der {Color:Blue}Fluch des Hexenmeisters{Color:White} lieβ\nsie mit offenen Augen versteinern!\nWir müssen ihr schnell helfen...", + "Der {Color:Blue}Fluch des Hexenmeisters{Color:White} ließ\nsie mit offenen Augen versteinern!\nWir müssen ihr schnell helfen...", "" ], [ @@ -1604,11 +1604,11 @@ "Ach so... Ich verstehe.", "{Color:Green}Minish{Color:White}?! {Color:Green}Vaati{Color:White}?!", "{Color:Blue}Fluch{Color:White}?! {Color:Red}Heiliges Schwert{Color:White}?!", - "So ist das also!\nJa, gewiss, ich habe dich verstanden.\nEs ist nämlich so, dass ich selbst auf\nReisen bin, um einen Weg zu finden,\nwie man den Fluch des Hexenmeisters\nbrechen kann. Man braucht also das...\n...{Color:Red}Heilige Schwert{Color:White}? Gut, dann werde ich\nmich dir anschlieβen.\nMein Name ist {Color:Green}Ezelo{Color:White}. Es freut mich,\ndeine Bekanntschaft zu machen.", + "So ist das also!\nJa, gewiss, ich habe dich verstanden.\nEs ist nämlich so, dass ich selbst auf\nReisen bin, um einen Weg zu finden,\nwie man den Fluch des Hexenmeisters\nbrechen kann. Man braucht also das...\n...{Color:Red}Heilige Schwert{Color:White}? Gut, dann werde ich\nmich dir anschließen.\nMein Name ist {Color:Green}Ezelo{Color:White}. Es freut mich,\ndeine Bekanntschaft zu machen.", "{Sound:00:92}Warte! Warte doch mal!\n\nRenn doch nicht so, mein Kind!\n\nKannst du nicht langsamer gehen?", "{Sound:00:92}Sieh mal, Kindchen. Wie soll ein kleiner\nWicht wie ich je mit dir Schritt halten?", "{Sound:01:E4}Also wirklich!\n\nWas für eine absolut\nunmögliche Göre du doch bist!", - "{Sound:00:5F}Viel besser! Wenn ich hier oben bin,\nkannst du mir nicht mehr davonlaufen.\nAh! Sehr hübsche Aussicht hier!\n\nUnd auβerdem äuβerst bequem für mich!\n\nHm? Was grummelst du da?\nLos, auf geht's, zackizacki!\nAch, ehe ich es vergesse!\n\nFür kleine Kinder wie dich gibt es\nallerlei Dinge, die sie nicht verstehen.\nDrücke in solchen Momenten einfach\n{Color:Blue}SELECT{Color:White}! Ich helfe dir dann.\nHerrje! Das wird anstrengend!", + "{Sound:00:5F}Viel besser! Wenn ich hier oben bin,\nkannst du mir nicht mehr davonlaufen.\nAh! Sehr hübsche Aussicht hier!\n\nUnd außerdem äußerst bequem für mich!\n\nHm? Was grummelst du da?\nLos, auf geht's, zackizacki!\nAch, ehe ich es vergesse!\n\nFür kleine Kinder wie dich gibt es\nallerlei Dinge, die sie nicht verstehen.\nDrücke in solchen Momenten einfach\n{Color:Blue}SELECT{Color:White}! Ich helfe dir dann.\nHerrje! Das wird anstrengend!", "Halt, halt! Wo gehst du hin?!\nHast du denn gar kein Mitgefühl?!", "Was soll das?!? Befreie mich\ndoch von diesen Plagegeistern!", "... ... ...Was guckst du so?\nSehe ich irgendwie komisch aus?", @@ -1645,7 +1645,7 @@ "", "{Sound:02:0D}Ah, ihr habt das {Color:Red}Erd-Element{Color:White} gefunden!\n\nDu bist noch jung, aber deine Kraft\nund dein Mut sind beachtlich!\nMacht weiter so und sucht das\nnächste {Color:Red}Element {Color:White}beim {Color:Green}Gongol-Berg{Color:White}!\nIm {Color:Green}Gongol-Berg{Color:White} lebt ein Mann\nnamens {Color:Green}Melta{Color:White}.\nUnter den Minish ist nur er in der Lage,\ndas Schwert neu zu schmieden.\nEr wird das zerbrochene {Color:Red}Schwert der\nMinish{Color:White} für euch reparieren.\nIch werde ihn benachrichtigen.\nPasst auf euch auf!", "Geht dort entlang! Das ist eine\nAbkürzung durch den Wald.", - "Der Älteste ist eine groβe\nHilfe.\nNun, dann bring uns doch gleich\nzum {Color:Green}Gongol-Berg{Color:White}!", + "Der Älteste ist eine große\nHilfe.\nNun, dann bring uns doch gleich\nzum {Color:Green}Gongol-Berg{Color:White}!", "", "", "", @@ -1658,9 +1658,9 @@ "", "{Sound:00:B0}Hallo, mein Freund! Komm ruhig näher!\nSammle Glück, so viel du kannst!\n{Color:Red}Glücksfragmente {Color:White}zum Beispiel! Passen\ndie {Color:Red}Fragmente{Color:White}, geschieht etwas Tolles!\nUnser kostenloses Angebot:\n{Color:Red}Glücksbeutel {Color:White}zum Sammeln von...\n...{Color:Red}Fragmenten{Color:White}! Einmalige Gelegenheit!", "Ja, ja, ein {Color:Red}Glücksbeutel {Color:White}für dich.\nKinder bekommen heute einen umsonst!\nDu bekommst auch einen!", - "Fügt man zwei {Color:Red}Glücksfragmente{Color:White}\nzu einem Glückssiegel zusammen,\nnennt man das {Color:Blue}Fragmente vereinen{Color:White}.\nEs heiβt:\nSind zwei Fragmente vereint,\nkommt das Glück herbeigeeilt.\nIch habe ein {Color:Red}Fragment {Color:White}in deinen\n{Color:Red}Glücksbeutel {Color:White}gelegt.\nLass es uns gleich ausprobieren!\n{07:12:04}", + "Fügt man zwei {Color:Red}Glücksfragmente{Color:White}\nzu einem Glückssiegel zusammen,\nnennt man das {Color:Blue}Fragmente vereinen{Color:White}.\nEs heißt:\nSind zwei Fragmente vereint,\nkommt das Glück herbeigeeilt.\nIch habe ein {Color:Red}Fragment {Color:White}in deinen\n{Color:Red}Glücksbeutel {Color:White}gelegt.\nLass es uns gleich ausprobieren!\n{07:12:04}", "Siehst du jemanden wie mich,\nkannst du mit ihm {Color:Blue}Fragmente vereinen{Color:White}!\nDrücke dafür {Key:Left}.\n\nDrücke {Key:Dpad}, um ein {Color:Red}Fragment{Color:White} zu{Color:Red} {Color:White}wählen\nund dann {Key:A} zum {Color:Blue}Fragmente vereinen{Color:White}.\nHast du das verstanden?\n{Choice:12:05}Klar. {Choice:12:03}Kein bisschen.", - "Drücke {Key:Left}, wenn du vor mir stehst\nund dann heiβt es: {Color:Blue}Fragmente vereinen{Color:White}!", + "Drücke {Key:Left}, wenn du vor mir stehst\nund dann heißt es: {Color:Blue}Fragmente vereinen{Color:White}!", "Wo gehst du hin? Stell dich vor\nmich hin und drücke {Key:Left}!", "Genau! Drückst du {Key:Left}, erscheint\ndas Menü {Color:Blue}Fragmente vereinen{Color:White}.", "Nanu? Was ist passiert? Drücke {Key:Left}\nzum {Color:Blue}Fragmente vereinen{Color:White}!", @@ -1700,7 +1700,7 @@ "", "Manchmal finden wir hier nicht nur Erz,\nsondern auch {Color:Red}Glücksfragmente{Color:White}.", "Wollen wir {Color:Blue}Fragmente vereinen{Color:White}?\n", - "Komm wieder, wenn du was findest.\nIch werde auch fleiβig sammeln.", + "Komm wieder, wenn du was findest.\nIch werde auch fleißig sammeln.", "Na bitte! Das passt ja perfekt! Jetzt\nwiderfährt mir bald was Wunderbares!", "", "", @@ -1712,11 +1712,11 @@ "", "Wollen wir {Color:Blue}Fragmente vereinen{Color:White}?", "Ja! {Color:Blue}Fragmente vereinen{Color:White}!", - "Was für ein Spaβ - {Color:Blue}Fragmente vereinen{Color:White}!", + "Was für ein Spaß - {Color:Blue}Fragmente vereinen{Color:White}!", "", "", "", - "{Sound:02:0C}{04:10:0E}Grüne Kleidung, komische Mütze...\nDu musst {Player} sein.\nHab's vom Ältesten im Wald gehört.\nIch heiβe {Color:Green}Melta {Color:White}und bin hier der Chef.\nEs gilt, das {Color:Red}Heilige Schwert{Color:White} zu\nschmieden,\num die Prinzessin von dem\nFluch zu befreien, nicht wahr?\nDas Schwert der Minish kann die Kraft\nder {Color:Red}Elemente {Color:White}aufnehmen.\nGib mir das {Color:Red}zerbrochene Schwert der\nMinish{Color:White}! Ich helfe der Prinzessin gern.\nIch werde das Schwert erneuern, damit\nes zum Heiligen Schwert werden kann.", + "{Sound:02:0C}{04:10:0E}Grüne Kleidung, komische Mütze...\nDu musst {Player} sein.\nHab's vom Ältesten im Wald gehört.\nIch heiße {Color:Green}Melta {Color:White}und bin hier der Chef.\nEs gilt, das {Color:Red}Heilige Schwert{Color:White} zu\nschmieden,\num die Prinzessin von dem\nFluch zu befreien, nicht wahr?\nDas Schwert der Minish kann die Kraft\nder {Color:Red}Elemente {Color:White}aufnehmen.\nGib mir das {Color:Red}zerbrochene Schwert der\nMinish{Color:White}! Ich helfe der Prinzessin gern.\nIch werde das Schwert erneuern, damit\nes zum Heiligen Schwert werden kann.", "{04:10:00}Es wird eine Weile dauern,\nbis es fertig ist.\nGeh inzwischen das {Color:Red}Element {Color:White}suchen!\nHier in der Nähe befindet sich eine {Color:Green}Mine{Color:White}!\nSie wurde vor langer Zeit von\nden Menschen geschaffen.", "{04:10:00}Gut! Dann wollen wir mal\nmit der Arbeit anfangen!", "{Sound:00:92}Gut, {Player}.\nDie schaffen das auch ohne uns.\nWir suchen inzwischen nach dem {Color:Red}Element{Color:White}!", @@ -1747,9 +1747,9 @@ "", "", "", - "{Sound:02:0C}{04:10:00}Oh! Du warst schneller, als ich dachte!\nHier ist auch alles perfekt gelaufen.\nSchau es dir an!\nDas ist das neue {Color:Red}Weiβe Schwert{Color:White}!", + "{Sound:02:0C}{04:10:00}Oh! Du warst schneller, als ich dachte!\nHier ist auch alles perfekt gelaufen.\nSchau es dir an!\nDas ist das neue {Color:Red}Weiße Schwert{Color:White}!", "{Color:Blue}Mit der Kraft der Elemente{Color:White} wird aus\ndiesem Schwert das {Color:Red}Heilige Schwert{Color:White}!\nDer Älteste im Wald sagte,\ndie Kraft der Elemente sei nur an...\n...einem Ort auf das Schwert\nübertragbar: an der {Color:Green}Heiligen Stätte{Color:White}.\nSie befindet sich zwischen der Welt\nder Minish und der der Menschen.\nDer Eingang soll in {Color:Green}Schloss Hyrule{Color:White} sein\nund sich nur alle 100 Jahre öffnen!\nMit dem {Color:Red}Heiligen Schwert{Color:White}, das die Kraft\nder vier {Color:Red}Elemente {Color:White}in sich trägt,\nkann man den Fluch gewiss brechen.\nZum Schloss gelangst du am...\n...schnellsten, wenn du durch die Tür,\ndie zur Mine führt, gehst.\nDu schaffst das!", - "Zum Fuβ des Berges? Geh hier hinaus\nund dann den Steilhang hinunter!", + "Zum Fuß des Berges? Geh hier hinaus\nund dann den Steilhang hinunter!", "", "", "", @@ -1763,7 +1763,7 @@ "{Sound:01:E7}Kann es sein?!? Du, {Color:Green}Vaati{Color:White}!?!\n", "{Sound:01:E9}Immer noch in dieser jämmerlichen\nGestalt? Mein {Color:Blue}Fluch {Color:White}ist stark, was?\nJedenfalls ist er immer noch wirksam!\nKeine Kraft wird dich von ihm befreien!", "Du scheinst dich nicht geändert\nzu haben.\nDoch die {Color:Red}Mütze {Color:White}schuf ich nicht für deine\nniederträchtigen Machenschaften!", - "Eine {Color:Red}Mütze{Color:White}, die die Wünsche desjenigen\nerfüllt, der sie trägt - wunderbar!\nDank dir bin ich jetzt einzigartig\nauf der Welt!\nDer gröβte {Color:Blue}Hexenmeister {Color:White}überhaupt!\nJetzt fehlt mir nur noch das {Color:Red}Force{Color:White}!\nDas habe ich alles dir zu verdanken.\nHier ist mein Geschenk an dich!", + "Eine {Color:Red}Mütze{Color:White}, die die Wünsche desjenigen\nerfüllt, der sie trägt - wunderbar!\nDank dir bin ich jetzt einzigartig\nauf der Welt!\nDer größte {Color:Blue}Hexenmeister {Color:White}überhaupt!\nJetzt fehlt mir nur noch das {Color:Red}Force{Color:White}!\nDas habe ich alles dir zu verdanken.\nHier ist mein Geschenk an dich!", "Warte!\nSo warte doch, {Color:Green}Vaati{Color:White}!", "", "", @@ -1799,13 +1799,13 @@ "{Sound:00:A3}Ah, {Player}! Du bist wieder da! Und,\nkonntest du die {Color:Green}Wald-Minish{Color:White} treffen?\nWie?\nAha. Die {Color:Red}vier Elemente{Color:White}...\nWenn wir die Kraft der Minish brauchen,\num die vier Elemente zu sammeln,\nmuss ich dich wohl erneut\num deine Hilfe bitten.\nWir müssen so schnell wie möglich das\n{Color:Red}Heilige Schwert{Color:White} zusammenfügen.\nIch zähle auf dich, {Player}!", "{Sound:00:A9}Ah, {Player}!\nIst alles gut gegangen?", "{Sound:00:AA}Du bist {Player}?\nDer {Color:Green}König {Color:White}ist im hinteren Zimmer.", - "{Sound:00:A3}Ah, {Player}! Schön, dich zu sehen.\nUnd, ist das {Color:Red}Heilige Schwert{Color:White} fertig?\nWie?\nDie {Color:Green}Heilige Stätte{Color:White}? Aha...\nIch weiβ von keinem solchen\nOrt im Schloss, aber...", - "{Sound:00:A9}Die {Color:Green}Heilige Stätte{Color:White}...\n\nMeine Groβmutter erzählte früher\nvon einem Tor im Schlosshof.\nWenn es einmal alle 100 Jahre offen\nist, {Color:Blue}ist das vielleicht jetzt der Fall{Color:White}!\nWenn nur Kinder dieses Tor sehen\nkönnen, ist es mir wohl entgangen.", + "{Sound:00:A3}Ah, {Player}! Schön, dich zu sehen.\nUnd, ist das {Color:Red}Heilige Schwert{Color:White} fertig?\nWie?\nDie {Color:Green}Heilige Stätte{Color:White}? Aha...\nIch weiß von keinem solchen\nOrt im Schloss, aber...", + "{Sound:00:A9}Die {Color:Green}Heilige Stätte{Color:White}...\n\nMeine Großmutter erzählte früher\nvon einem Tor im Schlosshof.\nWenn es einmal alle 100 Jahre offen\nist, {Color:Blue}ist das vielleicht jetzt der Fall{Color:White}!\nWenn nur Kinder dieses Tor sehen\nkönnen, ist es mir wohl entgangen.", "{Sound:00:AA}{Color:Green}Heilige Stätte{Color:White}?\nDie kenne ich nicht.", "{Sound:00:AA}Die {Color:Green}Heilige Stätte{Color:White}?\nDer {Color:Green}Minister {Color:White}hat davon gesprochen...", "{Sound:00:92}Ah! {Player}! Ist das nicht das Tor\nzur {Color:Green}Heiligen Stätte{Color:White}?\nOffenbar können nur du und ich\ndiesen Ort sehen! Los, hinein!", "{Sound:00:A3}Wer hätte das gedacht? Das Tor zur\n{Color:Green}Heiligen Stätte{Color:White} ist mitten im Schlosshof!\nFür die anderen sieht es einfach\nnur aus wie eine Wand...\nNoch zwei {Color:Red}Elemente{Color:White} und das {Color:Red}Heilige\nSchwert{Color:White} kann erschaffen werden.\nIch zähle auf dich, {Player}!", - "{Sound:00:A9}Ah, der Eingang ist im Schlosshof?\nMeine Groβmutter hatte also Recht.\nAlle aus meiner Familie waren schon\nimmer sehr aufrichtig.\nDeswegen konnten sie die Minish\nund den Eingang sehen.\nAber ich konnte sie nicht sehen...\nWoran mag das nur liegen?", + "{Sound:00:A9}Ah, der Eingang ist im Schlosshof?\nMeine Großmutter hatte also Recht.\nAlle aus meiner Familie waren schon\nimmer sehr aufrichtig.\nDeswegen konnten sie die Minish\nund den Eingang sehen.\nAber ich konnte sie nicht sehen...\nWoran mag das nur liegen?", "{04:10:07}{Color:Green}Vaati{Color:White}! Was machst du da?!?" ], [ @@ -1823,7 +1823,7 @@ "{Sound:00:92}Holla!\n\nWeil das {Color:Red}Heilige Schwert{Color:White} nun vollkommen\nist, hat sich eine Tür geöffnet.\nVielleicht führt sie zu dem Raum, in dem\ndas Geheimnis des {Color:Red}Force {Color:White}verborgen ist.\n{Player}! Lass uns hineingehen!", "{Sound:00:92}Ah, wenn man diesen Strahl auf\nMenschen richtet, die versteinert sind,\n{Color:Blue}kann man sie zurückverwandeln{Color:White}!\nDu hast es geschafft, {Player}!\nJetzt können wir {Color:Green}Zelda {Color:White}retten.", "{Sound:00:8E}Hm. Dies muss die {Color:Green}Heilige Stätte{Color:White} sein.\n\nHier kann man {Color:Blue}die Kraft der Elemente{Color:White}\n{Color:Blue}auf das Schwert übertragen{Color:White}.\nDort in der Mitte ist ein Podest\nfür das Schwert.", - "{Sound:00:92}Oh! Dein {Color:Blue}Körper hat sich verdoppelt{Color:White}!\nDas ist die {Color:Blue}Kraft des Weiβen Schwertes{Color:White}!\nDas bedeutet, auf diesen Tafeln\nkannst du dich vervielfachen!", + "{Sound:00:92}Oh! Dein {Color:Blue}Körper hat sich verdoppelt{Color:White}!\nDas ist die {Color:Blue}Kraft des Weißen Schwertes{Color:White}!\nDas bedeutet, auf diesen Tafeln\nkannst du dich vervielfachen!", "{Sound:00:8E}Soso...\n\n\"{Color:Blue}Lade das Schwert dort auf,\nwo der Boden leuchtet!{Color:White}\"\nSo steht es geschrieben...", "{Sound:00:8D}He! Wo gehst du hin, {Player}?!\nLass uns durch das Tor gehen!", "{Sound:00:8D}He, {Player}! Du bist zu weit\ngelaufen.\nStelle dich auf die leuchtende\nTafel und lade das Schwert auf!" @@ -1832,9 +1832,9 @@ "", "{Sound:00:8E}Nanu?\nDieses Bild aus Glas...\nEs scheint auf den Ort hinzuweisen,\nan dem sich das {Color:Red}Force {Color:White}befindet!", "{Sound:01:E8}{04:10:0E}Uahahahaha!\nDu bist so unglaublich naiv!\nErst gibst du mir die {Color:Red}Mütze der \nWünsche {Color:White}und dann führst du mich her!\nIch brauche euch nicht mehr!", - "{Sound:01:E8}{04:10:0E}Hehehehe... Jetzt weiβ ich,\nwo das {Color:Red}Force {Color:White}verborgen ist!", + "{Sound:01:E8}{04:10:0E}Hehehehe... Jetzt weiß ich,\nwo das {Color:Red}Force {Color:White}verborgen ist!", "{Sound:00:92}{Player}! ...Wach auf! ...{Player}!", - "{Sound:00:8E}{Color:Green}Dieser Vaati{Color:White}... hat sich in den König\nverwandelt, um das {Color:Red}Force {Color:White}zu suchen.\nIrgendwie hat er von diesem Ort\nerfahren und darauf gewartet,\ndass wir das {Color:Red}Heilige Schwert{Color:White}\nwieder erschaffen.\nWenn die Darstellung auf dem Glasbild\nstimmt, {Color:Blue}ruht das Force in Zelda{Color:White}!\nDieser Kerl wird bestimmt versuchen,\n{Color:Green}Zelda {Color:White}das {Color:Red}Force {Color:White}zu entreiβen!\nWir dürfen nicht zulassen, dass er\n{Color:Green}Zelda {Color:White}noch mehr antut!\nBeeil dich, {Player}!\nWir müssen {Color:Green}Vaati {Color:White}aufhalten!!!", + "{Sound:00:8E}{Color:Green}Dieser Vaati{Color:White}... hat sich in den König\nverwandelt, um das {Color:Red}Force {Color:White}zu suchen.\nIrgendwie hat er von diesem Ort\nerfahren und darauf gewartet,\ndass wir das {Color:Red}Heilige Schwert{Color:White}\nwieder erschaffen.\nWenn die Darstellung auf dem Glasbild\nstimmt, {Color:Blue}ruht das Force in Zelda{Color:White}!\nDieser Kerl wird bestimmt versuchen,\n{Color:Green}Zelda {Color:White}das {Color:Red}Force {Color:White}zu entreißen!\nWir dürfen nicht zulassen, dass er\n{Color:Green}Zelda {Color:White}noch mehr antut!\nBeeil dich, {Player}!\nWir müssen {Color:Green}Vaati {Color:White}aufhalten!!!", "", "", "", @@ -1923,8 +1923,8 @@ "Mein Name ist {Color:Green}Ezelo{Color:White}.\nIch bin der Weise von Tyloria.\nIch war es, der die {Color:Red}Mütze des\nHexenmeisters{Color:White} erschaffen hat.\nMeine Schwäche hat den\nMenschen viel Leid gebracht.\nBitte verzeiht mir!\nViele Menschen mussten sterben.\nDas Schloss ist zerstört.\nDoch gebt die Hoffnung nicht auf!\nDa auch ich meine ursprüngliche\nGestalt zurückerlangt habe,\nlässt sich mit {Color:Green}Zeldas {Color:Red}Force {Color:White}und der\n{Color:Red}Mütze {Color:White}vielleicht noch etwas ausrichten.", "Wenn ein aufrichtiger Mensch sie trägt,\nentfaltet die {Color:Red}Mütze {Color:White}ihre wahre Kraft...", "Nun denn, Zelda!\nBete inbrünstig für deinen {Color:Red}Wunsch{Color:White}!!! ", - "{Sound:01:E6}Ja!\nIch spüre die Lebenskraft überquellen!\nSelbst die magische Mütze\nerzittert vor solcher Energie!\nDie Mütze heiβt {Color:Red}Mütze der Wünsche{Color:White}.\nSie erfüllt die Wünsche des Trägers.\nWeil {Color:Green}Vaati {Color:White}so ein böses Herz hatte,\nwurde er zu einem Dämon.\nDoch {Color:Green}Zeldas {Color:White}Wunsch und die Kraft des\n{Color:Red}Force {Color:White}könnten ein Wunder vollbringen!", - "{Sound:01:E6}Ja... Die Zeit des Abschieds\nscheint gekommen.\nDas Tor von {Color:Green}Tyloria{Color:White}, das sich nur alle\n100 Jahre öffnet, {Color:Blue}schlieβt sich wieder{Color:White}.\nIch kehre zurück nach {Color:Green}Tyloria{Color:White}.\nIch weiβ,...\n...durch meine Schuld geschah\nviel Leid, doch das Böse ist besiegt.\nDank {Color:Green}Zelda {Color:White}erstrahlt Hyrule\nwieder im alten Glanz!", + "{Sound:01:E6}Ja!\nIch spüre die Lebenskraft überquellen!\nSelbst die magische Mütze\nerzittert vor solcher Energie!\nDie Mütze heißt {Color:Red}Mütze der Wünsche{Color:White}.\nSie erfüllt die Wünsche des Trägers.\nWeil {Color:Green}Vaati {Color:White}so ein böses Herz hatte,\nwurde er zu einem Dämon.\nDoch {Color:Green}Zeldas {Color:White}Wunsch und die Kraft des\n{Color:Red}Force {Color:White}könnten ein Wunder vollbringen!", + "{Sound:01:E6}Ja... Die Zeit des Abschieds\nscheint gekommen.\nDas Tor von {Color:Green}Tyloria{Color:White}, das sich nur alle\n100 Jahre öffnet, {Color:Blue}schließt sich wieder{Color:White}.\nIch kehre zurück nach {Color:Green}Tyloria{Color:White}.\nIch weiß,...\n...durch meine Schuld geschah\nviel Leid, doch das Böse ist besiegt.\nDank {Color:Green}Zelda {Color:White}erstrahlt Hyrule\nwieder im alten Glanz!", "{04:10:00}{Player}! Unsere gemeinsame Reise\nhatte durchaus vergnügliche Seiten.\nDer Abschied stimmt mich ein bisschen\ntraurig...", "{04:10:00}Nimm bitte dieses Geschenk!", "So sehe ich dich zum ersten Mal...\n{09:78}\n{Sound:01:E6}Aber sie steht dir, kleiner Held!\n{09:78}", @@ -1937,7 +1937,7 @@ [ "", "{Color:Blue}{Sound:02:0E}... ... ...\n\nKind...!\n\nKind, das du versuchst, meine Erbin\nZelda zu retten...\nSei willkommen...\n\nMein Name ist {Color:Green}Gustaf{Color:Blue}...\n\nDer König von Hyrule\naus ferner Vergangenheit...", - "{Color:Blue}Ich überreiche dir dieses Fragment...\n\nGehe zur {Color:Green}groβen Quelle von Hyrule{Color:Blue}...\n\nDann wird sich ein Weg öffnen...\n\n{Color:Green}Zeldas {Color:Blue}Schicksal ... Ja...\n\nDas Schicksal von ganz Hyrule\nliegt in deinen Händen, Kind...", + "{Color:Blue}Ich überreiche dir dieses Fragment...\n\nGehe zur {Color:Green}großen Quelle von Hyrule{Color:Blue}...\n\nDann wird sich ein Weg öffnen...\n\n{Color:Green}Zeldas {Color:Blue}Schicksal ... Ja...\n\nDas Schicksal von ganz Hyrule\nliegt in deinen Händen, Kind...", "{Sound:00:8E}Nanu! Der König von Hyrule hat aus\nder Vergangenheit zu uns gesprochen!\nDie {Color:Green}Quelle von Hyrule{Color:White} also...\nWo mag sie sein?", "", "Der Unwissende wird stehen.\nDer wohl Wissende wird gehen.\nDie Wahrheit, fürs Auge unsichtbar,\nin den Flammen wird erst klar." @@ -1973,9 +1973,9 @@ "", "", "", - "Willkommen im Gongol-Berg!\nIch bin die {Color:Green}Hohe Feenkönigin{Color:White}.\nIch gebe dir eine {Color:Red}Groβe Geldbörse{Color:White}.", - "Willkommen im Gongol-Berg!\nIch bin die {Color:Green}Hohe Schimmer-Fee{Color:White}.\nIch gebe dir eine {Color:Red}Groβe Bombentasche{Color:White}.", - "Willkommen im Gongol-Berg!\nIch bin die {Color:Green}Hohe Libellen-Fee{Color:White}.\nIch gebe dir einen {Color:Red}Groβen Pfeilköcher{Color:White}.", + "Willkommen im Gongol-Berg!\nIch bin die {Color:Green}Hohe Feenkönigin{Color:White}.\nIch gebe dir eine {Color:Red}Große Geldbörse{Color:White}.", + "Willkommen im Gongol-Berg!\nIch bin die {Color:Green}Hohe Schimmer-Fee{Color:White}.\nIch gebe dir eine {Color:Red}Große Bombentasche{Color:White}.", + "Willkommen im Gongol-Berg!\nIch bin die {Color:Green}Hohe Libellen-Fee{Color:White}.\nIch gebe dir einen {Color:Red}Großen Pfeilköcher{Color:White}.", "", "", "", @@ -1990,7 +1990,7 @@ "{Sound:00:B5}Ich bin Handwerksmeister {Color:Green}Mutoh{Color:White}.\n\nWir reparieren die Stadt im\nAuftrag des Königs von Hyrule!\nVorhin gab es ein Erdbeben! Jetzt\nmuss der Schaden behoben werden!\nBleib weg, mein Kind! Das ist gefährlich!\n", "", "Die Kiste war in Wahrheit ein Bannort\ngefährlicher Ungeheuer!\nSie war versiegelt worden mit\ndem {Color:Red}Schwert der Minish{Color:White}.\nDoch {Color:Green}Vaati {Color:White}hatte etwas anderes\ndarin vermutet.\nEr entfesselte die Ungeheuer, die\nnun ganz Hyrule terrorisieren!", - "Die Ungeheuer hier haben wir\neinigermaβen im Griff.\nAber auf dem Weg zum {Color:Green}Tyloria-Wald\n{Color:White}wirst du noch viele treffen.\nSei vorsichtig!", + "Die Ungeheuer hier haben wir\neinigermaßen im Griff.\nAber auf dem Weg zum {Color:Green}Tyloria-Wald\n{Color:White}wirst du noch viele treffen.\nSei vorsichtig!", "", "", "", @@ -2028,24 +2028,24 @@ [ "", "Gut. Das {Color:Red}Erd-Element{Color:White} haben wir.\nErzählen wir nun dem {Color:Green}Ältesten {Color:White}davon.", - "Meine Güte, war das heiβ! Ich dachte\nschon, mein Allerwertester fängt Feuer!\nGehen wir nun zurück zu {Color:Green}Melta{Color:White}.", + "Meine Güte, war das heiß! Ich dachte\nschon, mein Allerwertester fängt Feuer!\nGehen wir nun zurück zu {Color:Green}Melta{Color:White}.", "Wir fanden zwar kein {Color:Red}Element{Color:White},\naber wenigstens einen Hinweis.\nMit Hilfe der {Color:Red}Okarina des Windes{Color:White}\nwerden sich neue Wege öffnen.\nSuchen wir nun das nächste {Color:Red}Element{Color:White}!", "Brrrrrrrrrrr...\nPuh! Ich dachte, mir friert die Nase zu!", "Wir besitzen nun alle vier {Color:Red}Elemente{Color:White}!\nErschaffen wir das {Color:Red}Heilige Schwert{Color:White}!" ], [ "{Sound:01:B8}Uwaaahhhh...\n\nFein geschlafen!", - "{Sound:01:B9}Herzlich willkommen,\nmein putziger, kleiner Mützenwicht!\nSchön, dass du mich im letzten\nWinkel des Gebirges besuchen kommst.\nUnd... komm bitte wieder, sobald du\netwas Groβartiges vollbracht hast!\nNicht vergessen!", + "{Sound:01:B9}Herzlich willkommen,\nmein putziger, kleiner Mützenwicht!\nSchön, dass du mich im letzten\nWinkel des Gebirges besuchen kommst.\nUnd... komm bitte wieder, sobald du\netwas Großartiges vollbracht hast!\nNicht vergessen!", "{Sound:01:B8}Herzlich willkommen,\nmein putziger, kleiner Mützenwicht.\nSchön, dass du mich hier im letzten\nWinkel des Gebirges besuchen kommst.\nHast du zufällig schon einmal\neinen {Color:Red}Schild{Color:White} gesehen?\nSchilde gelten unter den\nEisen-Gourmets der Goronen...\n...als wahre Delikatesse!!!\n\nAah! Ich würde so gerne\nmal einen probieren...", "{Sound:01:B9}Danke nochmals, dass ich deinen\nköstlichen {Color:Red}Schild {Color:White}kosten durfte!\nDer Geschmack war unvergesslich...\n... ... ...\n... ... ...\n... ... ...\n... ... ...\n... ... ...\nHach! Dieser erlesene Geschmack! Ach,\nentschuldige! Ich gerate ins Schwelgen!\nKönntest du mir vielleicht noch\neinen Schild mitbringen?\nBring mir bitte noch einen Schild!", - "{Sound:01:BA}Herzlich willkommen,\nmein putziger, kleiner Mützenwicht.\nSchön, dass du mich hier im letzten\nWinkel des Gebirges besuchen kommst.\nHm?! Trägst du da etwa einen {Color:Red}Schild{Color:White}\nin deiner Hand?\nFür uns Goronen ist das die\nallergröβte Delikatesse!\nOh, bitte! Mein lieber Mützenwicht!\nLass mich von deinem Schild probieren!\nKeine Sorge! Ich probiere nur ein\nklitzekleines Stückchen! Ehrlich!\nLässt du mich deinen Schild kosten?\n{Choice:1D:06}Na gut. {Choice:1D:07}Nein! Wie eklig!", + "{Sound:01:BA}Herzlich willkommen,\nmein putziger, kleiner Mützenwicht.\nSchön, dass du mich hier im letzten\nWinkel des Gebirges besuchen kommst.\nHm?! Trägst du da etwa einen {Color:Red}Schild{Color:White}\nin deiner Hand?\nFür uns Goronen ist das die\nallergrößte Delikatesse!\nOh, bitte! Mein lieber Mützenwicht!\nLass mich von deinem Schild probieren!\nKeine Sorge! Ich probiere nur ein\nklitzekleines Stückchen! Ehrlich!\nLässt du mich deinen Schild kosten?\n{Choice:1D:06}Na gut. {Choice:1D:07}Nein! Wie eklig!", "{Sound:01:B7}Herzlich willkommen,\nmein putziger, kleiner Mützenwicht.\nNanu?! Kann es denn sein?\nHast du da einen {Color:Red}Schild{Color:White}?!?\nLässt du mich deinen Schild kosten?\n{Choice:1D:06}Na gut. {Choice:1D:07}Nein! Wie eklig!", "{Sound:01:B8}Ist dir klar, dass du den Schild in der\nZwischenzeit nicht verwenden kannst?\nÜberlässt du ihn mir trotzdem?\n{Choice:FF}Ja doch! {Choice:1D:07}Stimmt. Lassen wir's.", "{Sound:01:B7}Ach so...\nDa kann man nichts machen.", "{Sound:01:BA}Wirklich?! Danke!!!\nDann will ich gleich mal...\nMahlzeit!", "{Sound:01:B8}Mampf! Klonk! Ooh, wie vorzüglich! Es\nstimmt tatsächlich! Erlesenes Futter!", "{Sound:01:B8}Mampf! Klonk! Ooh, wie lecker! Lass\nmich noch ein Stückchen probieren!", - "{Sound:01:B8}Mampf! Klonk!\nOoh, formidabel!\nVielen Dank, mein lieber Mützenwicht!\n\nVielen Dank, dass du mich den\nSchild schmecken lieβest!\nEs fällt mir nicht leicht, aber\nversprochen ist versprochen.\nIch spucke den {Color:Red}Schild {Color:White}jetzt aus!", + "{Sound:01:B8}Mampf! Klonk!\nOoh, formidabel!\nVielen Dank, mein lieber Mützenwicht!\n\nVielen Dank, dass du mich den\nSchild schmecken ließest!\nEs fällt mir nicht leicht, aber\nversprochen ist versprochen.\nIch spucke den {Color:Red}Schild {Color:White}jetzt aus!", "{Sound:01:B7}Äh... Ups!?!\n\nIrgendwie hat sich die {Color:Blue}Form {Color:White}des\nSchildes ein wenig - geändert...\nA-Aber kein Problem! Der Schild\nist einfach nur anders geformt!\nFinde ich, jedenfalls...\n\nTja, also... Nichts für ungut! Tschüssi!" ], [ @@ -2056,8 +2056,8 @@ "{Sound:01:FB}Grüne Kleidung und eine\nkomische Mütze!\nBist du vielleicht der Mensch {Player},\nder das {Color:Red}Erd-Element{Color:White} gefunden hat?\nEs ist also wahr! Ich habe schon von\ndir gehört.\nIch bin {Color:Green}Heureta, der Item-Erfinder{Color:White}. Ich\nerforsche alle möglichen Werkzeuge.\nDu findest keinen Weg zur Stadt,\nweil alle Wege versperrt sind?\nIch gebe dir etwas Feines,\ndas dir bestimmt weiterhelfen wird!", "Bomben sind toll, stimmt's?\n", "Du benutzt meine {Color:Red}Bomben{Color:White}, wie ich sehe.\nHier hast du noch mehr!", - "Kennst du eine heiβe Quelle\nhier in der Nähe?\nFür mein aktuelles Experiment\n{Color:Blue}benötige ich heiβes Quellwasser{Color:White}.", - "Was? Du hast mir {Color:Red}heiβes Quellwasser\n{Color:White}mitgebracht?! Danke!\nNun kann das Experiment weitergehen.\nAls Dank gebe ich dir was Feines!", + "Kennst du eine heiße Quelle\nhier in der Nähe?\nFür mein aktuelles Experiment\n{Color:Blue}benötige ich heißes Quellwasser{Color:White}.", + "Was? Du hast mir {Color:Red}heißes Quellwasser\n{Color:White}mitgebracht?! Danke!\nNun kann das Experiment weitergehen.\nAls Dank gebe ich dir was Feines!", "", "So! Forschen, forschen!", "Es wäre doch praktisch, wenn es\nBomben gäbe,\ndie genau dann explodieren,\nwenn du es willst...", @@ -2080,7 +2080,7 @@ "{Sound:01:E5}Du hast das {Color:Red}Erd-Element{Color:White}, obwohl es im\nSchrein von Monstern nur so wimmelt?!?\nAlle Achtung!\n\nMenschen sind schon sensationell!\nAuch der Älteste wird staunen.", "{Sound:01:E5}Du willst das Heilige Schwert\nerschaffen, um Zelda zu retten,\nnicht wahr? Du schaffst das!", "{Sound:01:E5}Du hast die {Color:Red}Quatschbirne {Color:White}gegessen.\n\n... ... ...\n\n{07:1F:1C}", - "Über das {Color:Red}Schwert {Color:White}weiβ ich nichts.\nDer {Color:Green}Älteste {Color:White}weiβ bestimmt mehr!", + "Über das {Color:Red}Schwert {Color:White}weiß ich nichts.\nDer {Color:Green}Älteste {Color:White}weiß bestimmt mehr!", "", "", "Ah! Kindchen!\n\nDas ist die {Color:Red}Quatschbirne{Color:White},\nvon der Festa erzählte.\nDann lass uns gleich mal davon\nprobieren!", @@ -2088,7 +2088,7 @@ "", "{Sound:02:03}Ud tsgas saw?", "{Sound:02:03}{Color:Red}Du hast also die Quatschbirne{Color:White}\ngegessen und kannst uns verstehen.\nDer {Color:Green}Älteste {Color:White}sagte, die Menschen von\nheute könnten uns nicht mehr sehen.\nUnglaublich, dass du uns sehen kannst!", - "{Sound:02:03}{Color:Red}Wir bauen hier {Color:Blue}Tyloriander {Color:White}an.\n\nDer {Color:Blue}Saft dieser Pflanze{Color:White} heiβt {Color:Red}Tyrup{Color:White}\nund wird in der Stadt verkauft.\nHeimlich und unbemerkt legen wir\nes den Menschen auf den Weg.", + "{Sound:02:03}{Color:Red}Wir bauen hier {Color:Blue}Tyloriander {Color:White}an.\n\nDer {Color:Blue}Saft dieser Pflanze{Color:White} heißt {Color:Red}Tyrup{Color:White}\nund wird in der Stadt verkauft.\nHeimlich und unbemerkt legen wir\nes den Menschen auf den Weg.", "Südlich von hier ist ein Fass-Haus.\nDort gibt es eine {Color:Red}Quatschbirne{Color:White}.\nWenn du die {Color:Red}Quatschbirne {Color:White}isst,\nkannst du unsere Sprache sprechen.", "", "", @@ -2144,13 +2144,13 @@ [ "", "{Sound:02:04}Wir {Color:Green}Wald-Minish{Color:White} züchten Pflanzen und\nkönnen besonders gut Items herstellen.\nAuch der {Color:Red}Tyloriander{Color:White} trägt {Color:Red}Früchte{Color:White},\ndie Menschen Glück bringen.", - "{Sound:01:F9}Auβerhalb des Dorfes lebt ein komischer\nKauz, der {Color:Blue}Werkzeuge erforscht{Color:White}.\nBei seinem letzten Besuch fragte er:\n\"{Color:Blue}Hast du {Color:Red}Milch{Color:Blue}?{Color:White}\"\nVielleicht hatte er ja Durst?", - "{Sound:01:FE}Auβerhalb des Dorfes lebt ein komischer\nKauz, der {Color:Blue}Werkzeuge erforscht{Color:White}.\nBei seinem letzten Besuch fragte er:\n\"{Color:Blue}Hast du {Color:Red}Rotes und Blaues Elixier{Color:Blue}?{Color:White}\"\nVielleicht hatte er ja Schnupfen?", + "{Sound:01:F9}Außerhalb des Dorfes lebt ein komischer\nKauz, der {Color:Blue}Werkzeuge erforscht{Color:White}.\nBei seinem letzten Besuch fragte er:\n\"{Color:Blue}Hast du {Color:Red}Milch{Color:Blue}?{Color:White}\"\nVielleicht hatte er ja Durst?", + "{Sound:01:FE}Außerhalb des Dorfes lebt ein komischer\nKauz, der {Color:Blue}Werkzeuge erforscht{Color:White}.\nBei seinem letzten Besuch fragte er:\n\"{Color:Blue}Hast du {Color:Red}Rotes und Blaues Elixier{Color:Blue}?{Color:White}\"\nVielleicht hatte er ja Schnupfen?", "", "", "{Sound:01:F7}Mal Blumensamen, mal Steine,\nwir produzieren allerlei Glücksbringer.\nEs ist gar nicht so einfach, von den\nMenschen unbemerkt zu bleiben.", "{Sound:02:03}Mal Blumensamen, mal Steine,\nwir produzieren allerlei Glücksbringer.\nEs ist gar nicht so einfach, von den\nMenschen unbemerkt zu bleiben.", - "{Sound:01:FD}Ich werde immer besser darin, heimlich\nund unbemerkt Werkzeuge herzustellen!\nJaaa. Das ist ein Spaβ...", + "{Sound:01:FD}Ich werde immer besser darin, heimlich\nund unbemerkt Werkzeuge herzustellen!\nJaaa. Das ist ein Spaß...", "", "", "", @@ -2158,7 +2158,7 @@ "", "{Sound:02:05}Erstaunlich, dass du das hier gefunden\nhast! Ich bekomme fast nie Besuch...", "{Sound:01:FE}Hihi! Lass uns Fragmente vereinen!", - "{Sound:01:FF}Hihi! Fragmente vereinen macht Spaβ!\nMan kann es einfach nicht lassen!", + "{Sound:01:FF}Hihi! Fragmente vereinen macht Spaß!\nMan kann es einfach nicht lassen!", "{Sound:01:FD}Nanu? Nicht Fragmente vereinen?", "", "", @@ -2189,8 +2189,8 @@ "", "", "{Sound:01:F8}Wow! Das ist aber schick. Ich will\nauch mal Menschenkleider tragen!", - "{Sound:01:F9}Ich bin im Minish-Dorf geboren\nund aufgewachsen.\nDeshalb kenne ich die Welt\nda drauβen überhaupt nicht.\nIm Wald soll es grüne Ungeheuer geben,\naber du bist heil hierher gelangt.", - "{Sound:01:F9}Ja! Ich habe mich entschieden!\n\nWenn ich groβ bin, werde ich Mensch!\nÄh... Ich glaube, das geht gar nicht.", + "{Sound:01:F9}Ich bin im Minish-Dorf geboren\nund aufgewachsen.\nDeshalb kenne ich die Welt\nda draußen überhaupt nicht.\nIm Wald soll es grüne Ungeheuer geben,\naber du bist heil hierher gelangt.", + "{Sound:01:F9}Ja! Ich habe mich entschieden!\n\nWenn ich groß bin, werde ich Mensch!\nÄh... Ich glaube, das geht gar nicht.", "{Sound:01:FA}Ich gehe einen Freund in der Stadt\nbesuchen.", "", "{Sound:01:FB}Wir {Color:Green}Minish {Color:White}leben an verschiedenen\nOrten in ganz Hyrule.", @@ -2212,8 +2212,8 @@ "{Sound:01:FD}Wunderbar! Danke!\nJetzt können wir wieder forschen!\nWenn der Tyloriander blüht! {Symbol:0B}", "", "{Sound:01:FF}Juhu!\nDer {Color:Blue}Blaue Tyloriander{Color:White} blüht!\nDas haben wir allein dir zu verdanken.\nDanke!", - "{Sound:01:FC}Wir wollen neue Tyloriander-Sorten\nzüchten. Dazu benötigen wir...\n...{Color:Red}Rotes Elixier{Color:White}. Wo gibt es das bloβ?\nWer könnte es uns bringen?", - "{Sound:01:FD}Wunderbar, danke! Jetzt heiβt es\nwieder Forschen ohne Ende!\nFreu dich auf das Ergebnis! {Symbol:0B}", + "{Sound:01:FC}Wir wollen neue Tyloriander-Sorten\nzüchten. Dazu benötigen wir...\n...{Color:Red}Rotes Elixier{Color:White}. Wo gibt es das bloß?\nWer könnte es uns bringen?", + "{Sound:01:FD}Wunderbar, danke! Jetzt heißt es\nwieder Forschen ohne Ende!\nFreu dich auf das Ergebnis! {Symbol:0B}", "", "{Sound:01:FF}Juhu!\nDer {Color:Blue}Orangefarbene Tyloriander{Color:White} blüht!\nDank deiner Hilfe!\nDanke, danke, danke schön!", "{Sound:01:FA}Wir forschen vorerst nicht weiter, aber\nwir haben schon viele neue Ideen.\nSamba-Tyloriander, Jumbo-\nTyloriander, Mambo-Tyloriander...", @@ -2225,14 +2225,14 @@ [ "", "In diesem Wald sollen Minish\nleben.\nTief verborgen im Wald haben sie\nheimlich ein Dorf gebaut.\nUm in das Dorf zu gelangen, musst du\nzunächst klein werden.\nWir müssen einen Baumstumpf finden.\nIch mache dich dann zum Minish!", - "{Sound:00:92}{04:10:00}Kindchen!\nIch verrate dir etwas.\nDie Welt der {Color:Green}Minish {Color:White}ist sehr klein.\nDu kannst die Minish nicht treffen,\nsolange du groβ bist.\n\nSchau mal dort! Sieht aus wie ein\nnormaler Baumstumpf, nicht?\nJa, ja, aber!\n\nDieser Baumstumpf ist ein geheimes\n{Color:Blue}Portal{Color:White}, das die Menschen vor langer...\n...Zeit erschaffen haben, um ihre\nKörpergröβe ändern zu können!\nWenn ich dabei bin, {Color:Blue}kannst du dort\nso klein werden wie ein Minish{Color:White}!\nWenn du auf dem Baumstumpf {Key:Right}\ndrückst, wirst du klein.\nUm wieder groβ zu werden,\ndrückst du erneut {Key:Right}.\nAlso los, ab geht die Post!", - "Jetzt siehst du die Welt\nmit den Augen eines Minish!\nUnd, war das nicht nett von mir?\nDu brauchst dich nicht zu bedanken!\nSolche Portale gibt es {Color:Blue}hier\nund da, in verschiedenster Gestalt{Color:White}.\nUm wieder groβ zu werden, stell dich\nneben den Baumstumpf und drücke {Key:Right}!\nDu musst aufpassen, denn {Color:Blue}wenn du\nklein bist, lauern viele Gefahren{Color:White}!\nWenn du groβ bist, ist es eine kleine\nPfütze, wenn du klein bist, ein Meer.\nWenn dir was passiert, geht es mir\nauch an den Kragen. Also aufgepasst!" + "{Sound:00:92}{04:10:00}Kindchen!\nIch verrate dir etwas.\nDie Welt der {Color:Green}Minish {Color:White}ist sehr klein.\nDu kannst die Minish nicht treffen,\nsolange du groß bist.\n\nSchau mal dort! Sieht aus wie ein\nnormaler Baumstumpf, nicht?\nJa, ja, aber!\n\nDieser Baumstumpf ist ein geheimes\n{Color:Blue}Portal{Color:White}, das die Menschen vor langer...\n...Zeit erschaffen haben, um ihre\nKörpergröße ändern zu können!\nWenn ich dabei bin, {Color:Blue}kannst du dort\nso klein werden wie ein Minish{Color:White}!\nWenn du auf dem Baumstumpf {Key:Right}\ndrückst, wirst du klein.\nUm wieder groß zu werden,\ndrückst du erneut {Key:Right}.\nAlso los, ab geht die Post!", + "Jetzt siehst du die Welt\nmit den Augen eines Minish!\nUnd, war das nicht nett von mir?\nDu brauchst dich nicht zu bedanken!\nSolche Portale gibt es {Color:Blue}hier\nund da, in verschiedenster Gestalt{Color:White}.\nUm wieder groß zu werden, stell dich\nneben den Baumstumpf und drücke {Key:Right}!\nDu musst aufpassen, denn {Color:Blue}wenn du\nklein bist, lauern viele Gefahren{Color:White}!\nWenn du groß bist, ist es eine kleine\nPfütze, wenn du klein bist, ein Meer.\nWenn dir was passiert, geht es mir\nauch an den Kragen. Also aufgepasst!" ], [ "", "", "Der Sumpf in der {Color:Green}geheimen Welt von\nTabanta{Color:White} hat keinen Boden.\nUm diesen Sumpf zu überqueren,\n{Color:Blue}muss man schnell sein wie der Wind{Color:White}!", - "Ich mag es lieber dunkel.\nMach bloβ nicht das Licht an!", + "Ich mag es lieber dunkel.\nMach bloß nicht das Licht an!", "Oje, jetzt ist es raus.\nErzähl es niemandem!", "", "", @@ -2241,8 +2241,8 @@ "", "", "", - "Guten Tag, ich bin Poemun,\nDichter von Hyrule.\nDu bist {Player}, nicht wahr?\n\nIch bin viel gereist und habe dabei\nGedichte geschrieben.\nDoch jetzt, da ich wieder nach Hause\nwill, ist mir der Heimweg versperrt!\nAuβerdem ist das {Color:Red}hübsche Fragment{Color:White},\ndas ich unterwegs fand, verschwunden!\nEs ist furchtbar! {Color:Blue}Vielleicht habe\nich es im Hotel liegen lassen...{Color:White}\nIch werde ein Gedicht über meine\nTrauer schreiben.\n{Color:Blue} Die Sterne steh'n am Himmelsdach.\n So nah und doch so fern.\n Weg ist ein halbes Siegel, ach!\n Ein ganzes hätt ich gern...", - "Der Heimweg ist mir versperrt!\n\nAuβerdem ist das {Color:Red}hübsche Fragment{Color:White},\ndas ich unterwegs fand, verschwunden!\nEs ist furchtbar! {Color:Blue}Vielleicht habe\nich es im Hotel liegen lassen...\n{Color:White}Ich möchte meine Gefühle\nin einem Gedicht ausdrücken.\n{Color:Blue} Die Sterne steh'n am Himmelsdach.\n So nah und doch so fern.\n Weg ist ein halbes Siegel, ach!\n Ein ganzes hätt ich gern...", + "Guten Tag, ich bin Poemun,\nDichter von Hyrule.\nDu bist {Player}, nicht wahr?\n\nIch bin viel gereist und habe dabei\nGedichte geschrieben.\nDoch jetzt, da ich wieder nach Hause\nwill, ist mir der Heimweg versperrt!\nAußerdem ist das {Color:Red}hübsche Fragment{Color:White},\ndas ich unterwegs fand, verschwunden!\nEs ist furchtbar! {Color:Blue}Vielleicht habe\nich es im Hotel liegen lassen...{Color:White}\nIch werde ein Gedicht über meine\nTrauer schreiben.\n{Color:Blue} Die Sterne steh'n am Himmelsdach.\n So nah und doch so fern.\n Weg ist ein halbes Siegel, ach!\n Ein ganzes hätt ich gern...", + "Der Heimweg ist mir versperrt!\n\nAußerdem ist das {Color:Red}hübsche Fragment{Color:White},\ndas ich unterwegs fand, verschwunden!\nEs ist furchtbar! {Color:Blue}Vielleicht habe\nich es im Hotel liegen lassen...\n{Color:White}Ich möchte meine Gefühle\nin einem Gedicht ausdrücken.\n{Color:Blue} Die Sterne steh'n am Himmelsdach.\n So nah und doch so fern.\n Weg ist ein halbes Siegel, ach!\n Ein ganzes hätt ich gern...", "Leider habe ich nur ein Fragment.\nTut mir wirklich Leid.", "Oh, das sieht ja genau aus wie mein\n{Color:Red}Fragment{Color:White}! Passen die beiden vielleicht?", "Juhuu! Passt perfekt!\n\nEs ist so weit, es ist so weit!\nDas gibt ein wunderbares Gedicht!\n{Color:Blue} Getrennt oder zusammen,\n Die Hälften sehnen sich,\n Nach dem was sie verloren,\n Genau wie einst auch ich.", @@ -2273,7 +2273,7 @@ ], [ "", - "Guck mal, {Player}!\nDas wird ein Spaβ!\n{07:25:02}", + "Guck mal, {Player}!\nDas wird ein Spaß!\n{07:25:02}", "Komm, wir gehen da hin!", "{Player}, hör doch mal dem\nGeschichtenerzähler zu!\nHe! Was ist das da?", "{Color:Green}Minish{Color:White} gibt es also wirklich!\nVater behauptet das auch immer!\nHe!\nWas ist das da?", @@ -2289,14 +2289,14 @@ "Ich glaube nicht an die {Color:Green}Minish{Color:White}!\n\nIch bin doch kein Kind mehr!\nDiese {Color:Green}Minish {Color:White}gibt es doch gar nicht.", "Nur wer Gutes tut, soll die {Color:Green}Minish\n{Color:White}treffen können? Hm...", "Gemüse! Frisches Gemüse! Beste\nWare zu sensationellen Niedrigpreisen!", - "{Sound:00:AD}Jaa! Das Fest ist wunderbar!\n\nUnd meine süβen Früchte machen\ndas Fest noch wundervoller!", + "{Sound:00:AD}Jaa! Das Fest ist wunderbar!\n\nUnd meine süßen Früchte machen\ndas Fest noch wundervoller!", "Viele schöne Sachen,\ndie ganz viel Freude machen!\nNehmt an der Lotterie teil und\nerspielt euch absolute Topgewinne!", "He, du. Hast du schon mal einen {Color:Green}Minish{Color:White}\ngesehen? Ich schon!\nSie haben rote Zipfelmützen auf und\nsind winzig. Sie waren in Papas Schuh!", "Ich bin ein braves Kind. Deswegen kann\nich bald mit den {Color:Green}Minish {Color:White}spielen.", "Einmal in 100 Jahren öffnet sich das\nTor zwischen der Welt der {Color:Green}Minish{Color:White}...\n...und der Welt der Menschen.\nUnd dieses Jahr ist es soweit!\nDann besuchen die kleinen {Color:Green}Minish {Color:White}unsere\nWelt. Ich freue mich schon!\nMan muss nur lange genug leben.", "Jedes Jahr beim {Color:Blue}Minish-Fest{Color:White} gibt es\nein Schwertkampf-Turnier.\nDas diesjährige ist schon zu Ende. Ein\n{Color:Green}düsterer Mann{Color:White} hat diesmal gewonnen.", "Die {Color:Green}Minish {Color:White}bringen uns Menschen\nGlück mit!\nHach... Wann kommt wohl das Glück\nzu mir?", - "Ah, {Player}, hast du Spaβ?\nDieses Fest ist das gröβte in {Color:Green}Hyrule{Color:White},\ndeshalb sollte man es genieβen.", + "Ah, {Player}, hast du Spaß?\nDieses Fest ist das größte in {Color:Green}Hyrule{Color:White},\ndeshalb sollte man es genießen.", "Ja. Ich war lange auf Reisen und kam\nwegen des Festes in die Stadt.\nStadt Hyrule ist wirklich schön. Ich\nwill ein Gedicht darüber schreiben...", "Das Fest ist schön - so lebendig!\nEin herrliches Fest der Friedenszeit!", "Ich bin mit meiner Schwester von ganz\nweit weg zum {Color:Blue}Minish-Fest {Color:White}gekommen!", @@ -2327,7 +2327,7 @@ "Ich mache dir das Tor auf.\nSei vorsichtig!", "{Color:Blue}Links, links, links, oben, oben, oben...{Color:White}\nDen Rest des Wegs habe ich vergessen.", "Wollen wir {Color:Blue}Fragmente vereinen{Color:White}?", - "Ha! Passt perfekt!\n\nHoffentlich bekomme ich jetzt\nregelmäβig was zu tun.", + "Ha! Passt perfekt!\n\nHoffentlich bekomme ich jetzt\nregelmäßig was zu tun.", "Wenn du neue {Color:Red}Fragmente {Color:White}findest,\nkomm zum Vereinen wieder hierher.", "Ich bin {Color:Green}Boris, der Totengräber{Color:White}! Was?\nDer Geist eines Königs rief dich?\nDas muss der König von Hyrule aus der\nfernen Vergangenheit gewesen sein.\nIch bin ihm auch schon im Traum\nbegegnet.", "Diese Krähe! Sie hat den\n{Color:Red}Schlüssel zum Friedhof{Color:White} geklaut!\nRenn hinterher und hol den Schlüssel\nzurück!", @@ -2364,7 +2364,7 @@ [ "", "Der {Color:Red}Rote Tyrup{Color:White} bewirkt, dass mehr\nHerzen auftauchen.\n{07:2B:0F}", - "Der {Color:Red}Weiβe Tyrup{Color:White} bewirkt, dass mehr\n{Color:Red}Glücksfragmente {Color:White}auftauchen.\n{07:2B:0F}", + "Der {Color:Red}Weiße Tyrup{Color:White} bewirkt, dass mehr\n{Color:Red}Glücksfragmente {Color:White}auftauchen.\n{07:2B:0F}", "Der {Color:Red}Grüne Tyrup{Color:White} bewirkt, dass mehr\nMysteriöse Muscheln auftauchen.\n{07:2B:0F}", "Der {Color:Red}Gelbe Tyrup{Color:White} bewirkt, dass mehr\nRubine auftauchen.\n{07:2B:0F}", "Der {Color:Red}Blaue Tyrup{Color:White} bewirkt, dass mehr\nItems auftauchen.\n{07:2B:0F}", @@ -2400,12 +2400,12 @@ "Ein {Color:Red}Schild{Color:White}. Das macht {Var:1} Rubine.\nExtrem günstig!\n{07:2C:14}", "{Color:Red}10 Bomben{Color:White}. Das macht {Var:1} Rubine.\nExtrem günstig!\n{07:2C:14}", "Eine {Color:Red}Geldbörse{Color:White}. Macht {Var:1} Rubine.\nDa passen viele Rubine rein! Praktisch!\n{07:2C:14}", - "{Color:Red}30 Mysteriöse Muscheln{Color:White}.\nDas macht {Var:1} Rubine.\nSie werden dir Spaβ bereiten!\n\n{07:2C:14}", + "{Color:Red}30 Mysteriöse Muscheln{Color:White}.\nDas macht {Var:1} Rubine.\nSie werden dir Spaß bereiten!\n\n{07:2C:14}", "{Sound:01:F4}Hoppla! Wie kommst du denn hierher!?!\nIst dir die {Color:Red}Flasche {Color:White}so wichtig?\nSie scheint dir ja sehr zu gefallen...\nEigentlich ist sie nicht zu verkaufen,\naber für dich mache ich eine Ausnahme.\nEine {Color:Red}Flasche{Color:White}. Das macht {Var:1} Rubine.\n{07:2C:14}", "{Color:Red}Der Pfeilköcher{Color:White} kostet {Var:1} Rubine.\nDamit kannst du viele {Color:Red}Pfeile {Color:White}tragen.\n{07:2C:14}", "{Color:Red}10 Pfeile{Color:White}. Das macht {Var:1} Rubine.\nExtrem günstig!\n{07:2C:14}", - "{Color:Red}30 Bomben{Color:White}. Das macht {Var:1} Rubine.\nNoch günstiger in der Groβpackung!\n{07:2C:14}", - "{Color:Red}30 Pfeile{Color:White}. Das macht {Var:1} Rubine.\nNoch günstiger in der Groβpackung!\n{07:2C:14}", + "{Color:Red}30 Bomben{Color:White}. Das macht {Var:1} Rubine.\nNoch günstiger in der Großpackung!\n{07:2C:14}", + "{Color:Red}30 Pfeile{Color:White}. Das macht {Var:1} Rubine.\nNoch günstiger in der Großpackung!\n{07:2C:14}", "{Color:Blue}Du hast doch einen guten Schild{Color:White}!\nZwei davon brauchst du nicht!", "{Sound:01:F4}Nur rumlungern gibt's nicht!\nBring her, was du kaufen willst!", "Aiyaaa! Du hast\nnicht genug Rubine dabei!\nSo wird das nichts.\nDu musst Rubine mitbringen!", @@ -2417,7 +2417,7 @@ "{Sound:01:F4}Nanu?! Also ist da doch jemand!\nAuf einmal bist du hier hinten!\nSo geht das nicht, einfach hier\nreinkommen und mich erschrecken!", "Kaufst du das?\n{Choice:FF}Ja. {Choice:2C:0C}Nein.", "", - "{Sound:01:F4}Aiyaaa! Kind,\ndas da ist nicht verkäuflich!\nIn der Flasche ist das Futter für\nmeinen süβen Hund Schnappzu.\nWie? Du willst die {Color:Red}Flasche {Color:White}unbedingt?\nWas mach ich nur mit dir...\nGut, dann geh doch zu meinem Haus und\ngib dem kleinen Schnappzu sein Futter.\n{Color:Blue}Dann schenke ich sie dir.{Color:White} In Ordnung?\n{Choice:FF}Einverstanden. {Choice:2C:17}Nein danke.", + "{Sound:01:F4}Aiyaaa! Kind,\ndas da ist nicht verkäuflich!\nIn der Flasche ist das Futter für\nmeinen süßen Hund Schnappzu.\nWie? Du willst die {Color:Red}Flasche {Color:White}unbedingt?\nWas mach ich nur mit dir...\nGut, dann geh doch zu meinem Haus und\ngib dem kleinen Schnappzu sein Futter.\n{Color:Blue}Dann schenke ich sie dir.{Color:White} In Ordnung?\n{Choice:FF}Einverstanden. {Choice:2C:17}Nein danke.", "War ja nur ein Angebot von mir.\n", "Oh! Sehr gut.\nDann bitte schön und vielen Dank!", "Ich habe mein Haus auf deiner {Color:Red}Karte{Color:White}\nmarkiert!", @@ -2431,19 +2431,19 @@ "Alles ausverkauft!\nNächstes Mal habe ich wieder was da.", "", "{Sound:00:D1}Mein Herrchen {Color:Green}Aiya {Color:White}kommt immer\nso spät nach Hause! Winsel!", - "Ein {Color:Red}Bumerang{Color:White}. Das macht {Var:1} Rubine.\nEine groβe Hilfe bei deinen Abenteuern.\n{07:2C:14}" + "Ein {Color:Red}Bumerang{Color:White}. Das macht {Var:1} Rubine.\nEine große Hilfe bei deinen Abenteuern.\n{07:2C:14}" ], [ "{Choice:FF}Kaufen. {Choice:2D:0A}Nein danke.", - "Willkommen! Na, Appetit auf\nGroβmütterchens {Color:Red}Blaues Elixier{Color:White}?\nKaum getrunken, schon bist du fit!\nNur zu. Probier mal.", - "Das ist Groβmütterchens {Color:Red}Blaues Elixier{Color:White}!\nEine Flasche kostet 60 Rubine.\nWie wär's damit?\n{07:2D:00}", - "Schon mal Groβmütterchens {Color:Red}Blaues \nElixier{Color:White} probiert? Macht dich fit!\nZum Mitnehmen in der {Color:Red}Flasche{Color:White}.\nEine Portion kostet 60 Rubine.\nKaufst du eine?\n{07:2D:00}", + "Willkommen! Na, Appetit auf\nGroßmütterchens {Color:Red}Blaues Elixier{Color:White}?\nKaum getrunken, schon bist du fit!\nNur zu. Probier mal.", + "Das ist Großmütterchens {Color:Red}Blaues Elixier{Color:White}!\nEine Flasche kostet 60 Rubine.\nWie wär's damit?\n{07:2D:00}", + "Schon mal Großmütterchens {Color:Red}Blaues \nElixier{Color:White} probiert? Macht dich fit!\nZum Mitnehmen in der {Color:Red}Flasche{Color:White}.\nEine Portion kostet 60 Rubine.\nKaufst du eine?\n{07:2D:00}", "{Color:Red}Rotes Elixier{Color:White}!\nNach altem Rezept gebraut!\nEine {Color:Red}Flasche {Color:White}kostet 150 Rubine.\nWie wär's, nimmst du eine Portion mit?\n{07:2D:00}", "Probiere es, und du willst nie wieder\n{Color:Red}Blaues Elixier{Color:White}!\n{Color:Red}Rotes Elixier{Color:White}! Neu und besser!\nNur 150 Rubine die Portion! Kaufen?\n{07:2D:00}", "Wenn's alle ist, komm einfach wieder!\nHahahahahaha!", "Ah, mein Kind, eine gute Wahl!\nDiesen Artikel gibt es nur jetzt!\nDamit wachst du auf der Stelle auf!\nEinmal riechen und du bist hellwach!\nEinen {Color:Red}Weckpilz {Color:White}für 60 Rubine kaufen?\n{Choice:FF}Kaufen. {Choice:FF}Nein danke.", - "Ein guter Einkauf! Groβmütterchens\n{Color:Red}Blaues Elixier{Color:White} ist auch zu empfehlen!", - "Hallo und willkommen! Groβmütterchens\n{Color:Red}Blaues {Color:White}und {Color:Red}Rotes Elixier{Color:White} im Angebot!\nKaum getrunken, schon bist du fit!\nWelches von beiden magst du lieber?", + "Ein guter Einkauf! Großmütterchens\n{Color:Red}Blaues Elixier{Color:White} ist auch zu empfehlen!", + "Hallo und willkommen! Großmütterchens\n{Color:Red}Blaues {Color:White}und {Color:Red}Rotes Elixier{Color:White} im Angebot!\nKaum getrunken, schon bist du fit!\nWelches von beiden magst du lieber?", "Du willst nichts? Du musst es ja wissen!\nHahahahahaha!", "Ohne Rubine kannst du nichts kaufen.\nSchade, aber komm wieder!\nInzwischen widme ich mich wieder voller\nLiebe dem Brauen meiner Elixiere.\nHahahahahaha!", "Na so was! Du hast {Color:Blue}keine leere Flasche{Color:White}!\nDann kann ich dir kein Elixier abfüllen!\nBring nächstes Mal\neine {Color:Red}leere Flasche{Color:White} mit!" @@ -2478,7 +2478,7 @@ ], [ "", - "Als ich noch jung war, nannte man mich\n{Color:Green}Gasto, den Windstoβ{Color:White}.\nIch war fast ein wenig berühmt.\n\nIn letzter Zeit fühle ich mich irgendwie\nso schwer. Ich kann nicht aufstehen...", + "Als ich noch jung war, nannte man mich\n{Color:Green}Gasto, den Windstoß{Color:White}.\nIch war fast ein wenig berühmt.\n\nIn letzter Zeit fühle ich mich irgendwie\nso schwer. Ich kann nicht aufstehen...", "Na, so was! Besuch! Eine seltene Ehre.\nWie bist du überhaupt hierher gelangt?", "Wer hätte gedacht, dass {Color:Green}Opa Gasto\n{Color:White}krank wird. Er war immer so gesund...\nVielleicht ist er von einem bösen\nWesen besessen...", "Keiner glaubt mir. Ich habe gesehen,\nwie ein Geist Opa befallen hat.", @@ -2488,27 +2488,27 @@ "Komm mal wieder vorbei,\nwenn du in der Nähe bist.", "Komm mal wieder vorbei,\nwenn du in der Nähe bist.", "Wer hätte das gedacht!?!\n\nOpa sieht schon viel besser aus!\nWie soll ich dir nur danken?!\nIch hätte nie gedacht, dass er wirklich\nvon einem Geist befallen sein könnte.", - "Sei gegrüβt! Wir sind das\n{Color:Green}Volk des Windes{Color:White}. Vor langer Zeit...\n...stiegen wir auf zum Himmel und\nnahmen den {Color:Green}Palast des Windes {Color:White}mit uns.\nZurück blieb das, was ihr die\n{Color:Green}Ruine des Windes {Color:White}nennt.\nWir sehen, was unten geschieht, denn\nder Wind erzählt uns, was er sieht.\nEin kleines Kind sucht die {Color:Red}Elemente{Color:White},\num die Prinzessin zu retten...\nAuch, dass {Color:Green}Vaati {Color:White}Böses tut,\nhat uns der Wind zugetragen.\nDas {Color:Red}Wind-Element {Color:White}befindet sich im\n{Color:Green}Palast des Windes über uns{Color:White}.{Color:Green}\n{Color:Blue}Ist das Heilige Schwert vollkommen,\nöffnet sich Vaatis Weg zum Force.{Color:White}\nSo heiβt es in den Legenden,\ndie das {Color:Green}Volk des Windes {Color:White}kennt.\nGib Acht, wenn du alle\nvier {Color:Red}Elemente {Color:White}auf das Schwert...\n...übertragen hast und so das\n{Color:Red}Heilige Schwert {Color:White}entstanden ist.\nEs ist möglich, dass auch {Color:Green}Vaati{Color:White}\ndavon weiβ und auf den...\n...entscheidenden Moment wartet.\nMenschen dürfen unseren Palast...\n...eigentlich nicht betreten,\ndoch bei dir machen wir eine Ausnahme.\nGeh nur hinauf auf's Dach!", + "Sei gegrüßt! Wir sind das\n{Color:Green}Volk des Windes{Color:White}. Vor langer Zeit...\n...stiegen wir auf zum Himmel und\nnahmen den {Color:Green}Palast des Windes {Color:White}mit uns.\nZurück blieb das, was ihr die\n{Color:Green}Ruine des Windes {Color:White}nennt.\nWir sehen, was unten geschieht, denn\nder Wind erzählt uns, was er sieht.\nEin kleines Kind sucht die {Color:Red}Elemente{Color:White},\num die Prinzessin zu retten...\nAuch, dass {Color:Green}Vaati {Color:White}Böses tut,\nhat uns der Wind zugetragen.\nDas {Color:Red}Wind-Element {Color:White}befindet sich im\n{Color:Green}Palast des Windes über uns{Color:White}.{Color:Green}\n{Color:Blue}Ist das Heilige Schwert vollkommen,\nöffnet sich Vaatis Weg zum Force.{Color:White}\nSo heißt es in den Legenden,\ndie das {Color:Green}Volk des Windes {Color:White}kennt.\nGib Acht, wenn du alle\nvier {Color:Red}Elemente {Color:White}auf das Schwert...\n...übertragen hast und so das\n{Color:Red}Heilige Schwert {Color:White}entstanden ist.\nEs ist möglich, dass auch {Color:Green}Vaati{Color:White}\ndavon weiß und auf den...\n...entscheidenden Moment wartet.\nMenschen dürfen unseren Palast...\n...eigentlich nicht betreten,\ndoch bei dir machen wir eine Ausnahme.\nGeh nur hinauf auf's Dach!", "Auf dem Dach ist ein {Color:Blue}Wirbelwind{Color:White}. Mit\nihm gelangst du zum {Color:Green}Palast des Windes{Color:White}.\nVervollkommne schnell das {Color:Red}Heilige\nSchwert {Color:White}und rette die Prinzessin!", "Ah, du bist {Player}!\nDanke für deine Hilfe!\nIch habe wieder etwas Gutes gefunden\nund für dich verwahrt. Bitte!", - "Ah, du bist doch {Player}!\n\nDa du vorhin mit Hilfe des\nGlückssiegels zu uns kamst,\nweiβt du wahrscheinlich nicht, dass\ndies die Zuflucht unseres Volkes ist.\nWir wachen über den {Color:Green}Palast des Windes{Color:White}.\nDort ruht das {Color:Red}Wind-Element{Color:White}.", + "Ah, du bist doch {Player}!\n\nDa du vorhin mit Hilfe des\nGlückssiegels zu uns kamst,\nweißt du wahrscheinlich nicht, dass\ndies die Zuflucht unseres Volkes ist.\nWir wachen über den {Color:Green}Palast des Windes{Color:White}.\nDort ruht das {Color:Red}Wind-Element{Color:White}.", "Wer hätte das gedacht?\nDas ist doch {Player}!\nVielen Dank nochmals wegen neulich.\nUnserem Opa geht es blendend!", - "Wir vom Volk des Windes haben groβes\nTalent darin, {Color:Red}Fragmente{Color:White} zu finden.\nWir sind so gut, dass wir nicht wissen,\nwohin mit den vielen {Color:Red}Fragmenten{Color:White}!\nDa hilft auch Ordnen nichts! Wenn sie\nuns nur jemand abnehmen würde...", + "Wir vom Volk des Windes haben großes\nTalent darin, {Color:Red}Fragmente{Color:White} zu finden.\nWir sind so gut, dass wir nicht wissen,\nwohin mit den vielen {Color:Red}Fragmenten{Color:White}!\nDa hilft auch Ordnen nichts! Wenn sie\nuns nur jemand abnehmen würde...", "Ah, du bist es!\n\nIch dachte schon, dass wir nie wieder\nnach Hause zurückkehren könnten,\naber du hast uns gerettet, indem\ndu Fragmente vereint hast.\nWenn du etwas suchst, frag doch\nmal die Älteste im 5. Stock!\nSie kennt alle Gerüchte,\ndie der Wind über das Land trägt.", - "Gehst du zum {Color:Green}Palast{Color:White}?\n\nWenn ich groβ bin, traue ich mich\nvielleicht, den {Color:Green}Palast {Color:White}zu erforschen.", - "Nimm den groβen Wirbelwind hier auf\ndem Dach, um zum {Color:Green}Palast {Color:White}zu gelangen!", + "Gehst du zum {Color:Green}Palast{Color:White}?\n\nWenn ich groß bin, traue ich mich\nvielleicht, den {Color:Green}Palast {Color:White}zu erforschen.", + "Nimm den großen Wirbelwind hier auf\ndem Dach, um zum {Color:Green}Palast {Color:White}zu gelangen!", "Hier über den Wolken ist die\nZuflucht des {Color:Green}Volkes des Windes{Color:White}.\nWir wachen über den {Color:Green}Palast des Windes{Color:White}.\nIn ihm ruht das {Color:Red}Wind-Element{Color:White}.", "Wir vom Volk des Windes lebten\neinst unten auf der Erde.\nAn dem Ort, den ihr die\n{Color:Green}Ruine des Windes {Color:White}nennt.", "He! Wie geht denn das???\nDu kannst ja auf Wolken gehen,\nobwohl du von der Erde bist!\nAber was mich noch mehr wundert...\nIch war mit meiner Schwester auf dem\n{Color:Blue}Minish-Fest{Color:White},\nund auf dem Rückweg war auf einmal\nalles voll von Ungeheuern!\nNormalerweise weht ein günstiger\nWind, wenn man mit dem {Color:Red}Fragment{Color:White},\ndas auf dieser Wolkentafel abgebildet\nist, {Color:Blue}Fragmente vereint{Color:White}.\nDoch wegen der Ungeheuer können wir\nkeine {Color:Red}Fragmente {Color:White}suchen...\n...und auch nicht dorthin gelangen,\nwo man {Color:Blue}Fragmente vereint{Color:White}.\nDu bist doch stark! Suchst du ein paar\n{Color:Red}Fragmente {Color:White}für uns und vereinigst sie?", "Was machen wir nur?\nWas machen wir nur...?\nNanu!?!\n\nWenn du als Mensch von der Erde auf\nWolken gehen kannst,\nmusst du ein guter Mensch sein!\nIch habe ein Problem.\nIch war mit meiner Schwester\nauf dem {Color:Blue}Minish-Fest{Color:White}... \n...und auf dem Rückweg\nwehte plötzlich kein Wind mehr!\nJetzt kommen wir nicht mehr\nnach Hause!", "Manchmal sind {Color:Red}Glücksfragmente {Color:White}auch\nim Inneren von Wolken verborgen.", - "Das Minish-Fest in Stadt Hyrule\nhat unglaublich viel Spaβ gemacht!\nAber jetzt kommen wir nicht mehr\nnach Hause. Was sollen wir jetzt tun?", + "Das Minish-Fest in Stadt Hyrule\nhat unglaublich viel Spaß gemacht!\nAber jetzt kommen wir nicht mehr\nnach Hause. Was sollen wir jetzt tun?", "Hier über den Wolken ist die\nZuflucht des {Color:Green}Volkes des Windes{Color:White}.\nWir wachen über den {Color:Green}Palast des Windes{Color:White}.\nIn ihm ruht das {Color:Red}Wind-Element{Color:White}.\nUnd wie du hierher kamst!\nDie Winde trugen dich zu uns!\nUnglaublich, was man alles erreichen\nkann, wenn man {Color:Blue}Fragmente vereint{Color:White}! " ], [ "", "Oh weh!\nDie {Color:Blue}Hühner sind weg{Color:White}!\nHilfst du mir, sie wieder einzufangen?\n{Choice:FF}Klar doch! {Choice:30:03}Nein.", - "Gut, dann fang {Var:2} Hühner\nin {Var:1} Sekunden ein!\nDu brauchst nicht in Häusern oder\nauβerhalb der Stadt zu suchen!", + "Gut, dann fang {Var:2} Hühner\nin {Var:1} Sekunden ein!\nDu brauchst nicht in Häusern oder\naußerhalb der Stadt zu suchen!", "Warum denn nicht? Bitte, bitte, bitte!", "Die Zeit ist abgelaufen!\nAus und vorbei!", "Hmm. Du hast leider nicht genügend\nHühner eingefangen...\nTrotzdem: Danke! Ich freue\nmich über jede Hilfe!", @@ -2542,7 +2542,7 @@ "Was? Du kannst es mir nicht sagen?\nDu verheimlichst mir doch nichts, oder?", "Du kannst es mir nicht sagen?\nWenn du was erfährst, erzähl es mir!", "Das nächste Haus baue ich hier.", - "Na, Kind, ein gutes Haus, oder?\nGerade erst fertig gestellt!\nWie du weiβt, nur für eine\nallein stehende Frau geeignet.\n{07:31:0E}", + "Na, Kind, ein gutes Haus, oder?\nGerade erst fertig gestellt!\nWie du weißt, nur für eine\nallein stehende Frau geeignet.\n{07:31:0E}", "Stell mir eine Interessentin vor!", "Oh! Du willst mir ein Haus zeigen?\n{Choice:FF}Ja. {Choice:31:09}Nein.", "Du stellst mir einen Vermieter vor?\n{Choice:FF}Ja. {Choice:31:0A}Nein.", @@ -2550,7 +2550,7 @@ "Ja, wirklich?\nEin ganz neu gebautes Haus? Toll!", "Was für ein Glück!\nEin ganz neues Haus! Wunderbar!", "Juhu! Vielen Dank!\nWas für ein Glück - ein Neubau!", - "Wenn man diese Katzen vertreibt,\nkann man hier ein groβes Haus bauen.\nHahaha!", + "Wenn man diese Katzen vertreibt,\nkann man hier ein großes Haus bauen.\nHahaha!", "Oh. Guten Tag, {Player}.\nIch fühle mich sehr wohl in dem Haus.\n{07:31:28}", "Wenn du den {Color:Red}Talisman {Color:White}verlierst,\ngebe ich dir einen neuen.", "Soll der {Color:Red}Talisman {Color:White}in die {Color:Red}Flasche{Color:White}?\n{Choice:FF}Ja bitte. {Choice:31:1A}Nein danke.", @@ -2586,11 +2586,11 @@ "Oh, {Player}, strengst du dich an?\nRuh dich ruhig im ersten Stock aus!\nIch fertige Schwerter für die Soldaten,\ndie gegen die Monster kämpfen.\nIch würde dir ja gerne helfen, aber du\nmusst {Color:Green}Prinzessin Zelda {Color:White}alleine retten!", "Oh, {Player}, du strengst dich an,\nja? Da fällt mir ein...\nWarst du schon bei {Color:Green}Schuster Schlumm{Color:White}?\n\nEr macht gute Schuhe. Solche kannst\ndu bei den Abenteuern gut gebrauchen.", "Oh, {Player}. Du bist stattlicher\ngeworden. Da fällt mir ein...\nWarst du schon in der {Color:Green}Bücherei{Color:White}?\n\nFrüher hat ein Kind dort {Color:Green}Minish{Color:White}\ngesehen. Das könnte nützlich sein.", - "Oh, hallo {Player}!\nNur noch ein {Color:Red}Element {Color:White}fehlt.\nDa fällt mir ein...\n\nWeiβt du, dass im Osten des Schlosses\ndas{Color:Green} Tal der Königsfamilie {Color:White}ist?\nFrüher gelangte man über die\n{Color:Green}Hochebene von Beele{Color:White} dorthin.\nDoch jetzt gelangt man nur\nüber einen geheimen Weg dorthin.\nIch glaube, er liegt {Color:Blue}im Westen der\nnördlichen Ebene von Hyrule{Color:White}...", + "Oh, hallo {Player}!\nNur noch ein {Color:Red}Element {Color:White}fehlt.\nDa fällt mir ein...\n\nWeißt du, dass im Osten des Schlosses\ndas{Color:Green} Tal der Königsfamilie {Color:White}ist?\nFrüher gelangte man über die\n{Color:Green}Hochebene von Beele{Color:White} dorthin.\nDoch jetzt gelangt man nur\nüber einen geheimen Weg dorthin.\nIch glaube, er liegt {Color:Blue}im Westen der\nnördlichen Ebene von Hyrule{Color:White}...", "Oh, {Player}, du bist wieder da!\nDu warst schon fast überall in Hyrule.\nDa fällt mir ein...\n\nWarst du auch schon beim\n{Color:Green}Sela-Wasserfall{Color:White}?\nAngeblich hat noch kein\nMensch seine Quelle gesehen!\nSei vorsichtig, wenn du dorthin gehst!", "Oh, {Player}. Es steht\nschlecht um {Color:Green}Schloss Hyrule{Color:White}!\nDa fällt mir ein...\n\nVerwendest du auch alle {Color:Red}Items{Color:White}, die du\nbisher erhalten hast? Wenn du...\n...einmal nicht weiter kommst, solltest\ndu verschiedene Items ausprobieren.", "He, bist du nicht müde?\n\nWillst du dich ein bisschen ausruhen?\n{Choice:FF}Ja. {Choice:32:08}Nein.", - "Bist du sicher? Die Kinder von heute\nwerden wohl nie müde...\nUnd ich bin gerädert, obwohl ich bloβ\nden ganzen Tag auf deinem Kopf sitze!", + "Bist du sicher? Die Kinder von heute\nwerden wohl nie müde...\nUnd ich bin gerädert, obwohl ich bloß\nden ganzen Tag auf deinem Kopf sitze!", "Gääähn... Das war gut. Also, dann\nwollen wir mal wieder, {Player}!", "", "" @@ -2602,11 +2602,11 @@ ], [ "", - "Drauβen ist es gefährlich, auch wenn\ndu ein {Color:Red}Schwert {Color:White}und einen {Color:Red}Schild {Color:White}hast!\nIch kann doch nicht ein Kind, {Color:Blue}das nicht\nfechten kann{Color:White}, rauslassen!", - "Ooh!\nDu hast die {Color:Red}Wirbelattacke {Color:White}erlernt!\nLass mich überprüfen, ob man dich\nwirklich nach drauβen lassen kann.\nZeigst du mir eine {Color:Red}Wirbelattacke{Color:White}?", + "Draußen ist es gefährlich, auch wenn\ndu ein {Color:Red}Schwert {Color:White}und einen {Color:Red}Schild {Color:White}hast!\nIch kann doch nicht ein Kind, {Color:Blue}das nicht\nfechten kann{Color:White}, rauslassen!", + "Ooh!\nDu hast die {Color:Red}Wirbelattacke {Color:White}erlernt!\nLass mich überprüfen, ob man dich\nwirklich nach draußen lassen kann.\nZeigst du mir eine {Color:Red}Wirbelattacke{Color:White}?", "Man merkt, dass wir das 100. Jubiläum\nfeiern. Was für eine Stimmung!", "Was für eine Freude das\n100. Jubiläum mitfeiern zu können!\nOb ich es noch einmal erleben werde?\nDann wäre ich 118... Ach, kein Problem!", - "Die Stadt ist friedlich, aber da\ndrauβen wimmelt es von Monstern!\nGeh doch mal zu {Color:Green}Aiyas Laden{Color:White} und\nsieh dir seine Werkzeuge an!", + "Die Stadt ist friedlich, aber da\ndraußen wimmelt es von Monstern!\nGeh doch mal zu {Color:Green}Aiyas Laden{Color:White} und\nsieh dir seine Werkzeuge an!", "Es gibt plötzlich so viele Monster. Und\ndann dieses Erdbeben... Merkwürdig...", "Miau!", "Fauch!", @@ -2629,16 +2629,16 @@ "Als streunender Hund hat man es\ngut. Essen findet man überall.", "Das Schwertkampf-Turnier war toll!\nIch habe vor Aufregung laut gejubelt!", "Ich freue mich schon auf das\nTurnier im nächsten Jahr!", - "Das war ein heiβer Kampf!\n\nSchade, dass unser Kämpfer\nnicht stark genug war.", + "Das war ein heißer Kampf!\n\nSchade, dass unser Kämpfer\nnicht stark genug war.", "Unser Kämpfer...?\nDa bin ja sogar ich stärker!", "Ich möchte spielen, aber der Laden ist\nnoch zu. Ich bin zu früh dran.", "Das Sitzkissen ist schmutzig. Da wird\nsich bestimmt keiner draufsetzen.", "Obst oder Gemüse...\nWas soll ich heute kaufen?", "Seht her!\nSchönes, frisches Obst!", - "Seht her, seht her!\nFrisches Obst - süβ und gesund!", + "Seht her, seht her!\nFrisches Obst - süß und gesund!", "Frisches Gemüse! Von {Color:Green}Karo und Toffel\n{Color:White}mit Sorgfalt gezüchtet! Sehr gesund!", "Zu Fleisch sollte man immer\nauch Gemüse essen!", - "Einkaufen macht Spaβ! {Symbol:0B} Ah, ich muss\nnoch {Color:Red}Glücksbrot {Color:White}beim Bäcker holen!", + "Einkaufen macht Spaß! {Symbol:0B} Ah, ich muss\nnoch {Color:Red}Glücksbrot {Color:White}beim Bäcker holen!", "Ah! Genau! Ich muss auf dem Rückweg\n{Color:Red}Lon Lon-Milch{Color:White} kaufen!", "", "", @@ -2649,9 +2649,9 @@ "", "Egal was die Leute sagen,\nder Bürgermeister ist ein guter Mann!", "Er ist in Ordnung, auch wenn er ein\nLoch in seinem Garten gebuddelt hat.", - "Oh! Ihr scheint ja richtig viel\nSpaβ zu haben!", + "Oh! Ihr scheint ja richtig viel\nSpaß zu haben!", "Ich gehe auch bald in die Schule!\nZum Spielen!", - "Da drauβen ist es zu gefährlich!\nIch kann dich nicht durchlassen!", + "Da draußen ist es zu gefährlich!\nIch kann dich nicht durchlassen!", "Hier wird gebaut.\nDu kommst hier nicht durch.\nEs tut mir Leid.", "Ah, {Player}! Jetzt ist gerade\nUnterricht. Da kommst du nicht rein.", "Jetzt ist gerade Unterricht.\nDa kommst du nicht rein.", @@ -2695,7 +2695,7 @@ "Kauft! Kauft!", "Daran riechen kostet nichts!", "Grünes Gemüse!\n\nIst auch gut für die Augen!", - "Wenn du kein Gemüse isst,\nwirst du nicht groβ und stark!", + "Wenn du kein Gemüse isst,\nwirst du nicht groß und stark!", "So wütend habe ich den {Color:Green}König {Color:White}noch\nnie gesehen! Und so streng...", "Die Leute im Schloss\nsind sehr im Stress.", "", @@ -2707,7 +2707,7 @@ "Ah, {Player}, wir haben gerade\nDeutsch. Wichtig, sehr wichtig!", "Ich habe gehört, dass die {Color:Green}Minish {Color:White}den\nMenschen das {Color:Red}Force {Color:White}gegeben haben.\nAber gibt es die Minish wirklich?\nNiemand hat sie bisher gesehen...", "Man sagt, dass etwas in Hyrule\ngeschieht, wenn diese Glocke läutet.", - "Keiner weiβ, was dann geschehen wird.", + "Keiner weiß, was dann geschehen wird.", "Ich bin hier, um ein Buch auszuleihen.\nEigentlich müsste schon geöffnet sein.", "Kann man das {Color:Red}Force {Color:White}in die Hand\nnehmen? Ach, du bist ja noch ein Kind!", "Dieses kleine rote Ding\nirritiert mich.\nEs sieht aus wie ein Haus.", @@ -2749,7 +2749,7 @@ "", "", "BUH!!!\n...\nHast du keine Angst?", - "So macht das keinen Spaβ.\nIch habe wohl kein Talent...", + "So macht das keinen Spaß.\nIch habe wohl kein Talent...", "Wau! Wau!", "Hast du dich schon mal gefragt,\nwarum ich immer hier bin?\nEs ist, weil...\n\n...ich dich fressen will!\n\nWar nur ein Scherz.\nHast du dich erschreckt?", "Ich kann das {Color:Red}Force {Color:White}nicht finden...\nDer {Color:Green}König {Color:White}wird böse sein.", @@ -2781,12 +2781,12 @@ "Der Hund soll das {Color:Red}Force {Color:White}suchen...\nIch finde es einfach nicht.", "Die Figuren von {Color:Green}Minitendo{Color:White}\nsind etwas ganz besonderes.\nAber ein Kind wie du\nversteht das noch nicht.", "Dieses {Color:Red}Force{Color:White}... Ich glaube nicht,\ndass ich es finden werde.", - "Oh, das macht bestimmt Spaβ!\nIch will auch mal!", + "Oh, das macht bestimmt Spaß!\nIch will auch mal!", "Ich will auch spielen!", "{Color:Green}Shimaros Laden {Color:White}ist eröffnet.\nShimaro sitzt schon hinter der Theke.", "Viele Leute bringen die Leihbücher\naus der Bücherei nicht mehr zurück.", "Man sollte an die anderen denken\nund die Bücher zurückbringen!", - "Ich hätte auch gerne Figuren, aber\nsie sind zu groβ für uns Minish.", + "Ich hätte auch gerne Figuren, aber\nsie sind zu groß für uns Minish.", "Einen Kopfsprung in den Brunnen!\nWahrscheinlich ertrinkt man...", "Ich habe Angst vor Gespenstern.\nEs sieht zwar drollig aus, aber ich...\n...habe trotzdem Angst. Du nicht?", "Uoooh!\nIch schaff's nicht.\nIch komme nicht vorwärts.\nUoooh!", @@ -2848,14 +2848,14 @@ "Wie gelangt man in den 2. Stock des\nHotels? Warst du schon mal dort?", "Ich bin reich. Und Sammler,\nwie so viele Reiche.", "Zeig mir deine {Color:Green}Minitendo-Figuren{Color:White},\nwenn deine Sammlung {Color:Blue}kompletto {Color:White}ist.\nVerstehst du? Wenn du alle Figuren\nhast, die es gibt.", - "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind groβzügig.", + "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind großzügig.", "Du machst das super.\nEin guter Tag heute...", "Wenn ich renne,\nwird mir immer schlecht...", "Juhu! Juhu!", "Ich pflege das Blumenbeet.", - "Man muss sie jeden Tag gieβen.", + "Man muss sie jeden Tag gießen.", "\"Figur\" klingt ja noch gut, aber\n\"Puppe\" wäre lächerlich.", - "Das {Color:Red}Force {Color:White}muss für die {Color:Green}Minish{Color:White}\netwas Riesengroβes sein...", + "Das {Color:Red}Force {Color:White}muss für die {Color:Green}Minish{Color:White}\netwas Riesengroßes sein...", "Der Herr Hund hat zwar eine sehr\ndirekte Art, aber mir gefällt das.", "Schön, dass du da bist.\nEs kommt fast niemand mehr hierher.", "Nanu! Du bist ja in Windeseile\nhierher gelangt. Alle Achtung!", @@ -2868,8 +2868,8 @@ ], [ "", - "Weiβt du, wie es in {Color:Green}Anjus{Color:White}\n{Color:Green}Hühnerhaus {Color:White}aussieht?\nHihihihi...", - "Eine wahre Freude,\ndiese lebendige Stadt!\nWenn es doch bloβ immer so wäre...", + "Weißt du, wie es in {Color:Green}Anjus{Color:White}\n{Color:Green}Hühnerhaus {Color:White}aussieht?\nHihihihi...", + "Eine wahre Freude,\ndiese lebendige Stadt!\nWenn es doch bloß immer so wäre...", "Miau!", "Fauch!", "", @@ -2916,7 +2916,7 @@ "Kinder sind so lieb.\nSolange sie sich nicht verlieben.", "Ich bin reich. Und Sammler,\nwie so viele Reiche.", "Zeig mir deine {Color:Green}Minitendo-Figuren{Color:White},\nwenn deine Sammlung {Color:Blue}kompletto {Color:White}ist.\nVerstehst du? Wenn du alle Figuren\nhast, die es gibt.", - "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind groβzügig.", + "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind großzügig.", "Du machst das super!\nEin guter Tag heute...", "Ich glaube, mir ist schlecht.", "Juhu! Juhu!", @@ -2979,7 +2979,7 @@ "Es ist sehr still hier. Werden die\nMonster wirklich angreifen?", "Ich bin reich. Und Sammler,\nwie so viele Reiche.", "Zeig mir deine {Color:Green}Minitendo-Figuren{Color:White},\nwenn deine Sammlung {Color:Blue}kompletto {Color:White}ist.\nVerstehst du? Wenn du alle Figuren\nhast, die es gibt.", - "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind groβzügig.", + "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind großzügig.", "Du machst das super!\nEin guter Tag heute...", "Sollen wir Schutz suchen? Wie lästig!\nNa ja, wenn die anderen alle gehen...", "Immer mehr Leute verschwinden.\nWas wird nur aus Stadt Hyrule?", @@ -3000,18 +3000,18 @@ "Alle sind weg.\nIch bekomme Angst...", "Was für Monster auch kommen mögen -\nich werde die Stadt beschützen!", "Es war eine so lebendige Stadt...\nWas soll nur aus diesem Land werden!?!", - "Du! Es ist gefährlich, hier drauβen\nherumzulaufen. Geh in dein Haus!", + "Du! Es ist gefährlich, hier draußen\nherumzulaufen. Geh in dein Haus!", "", "Wir beschützen die Stadt. Hab keine\nAngst und geh nach Hause!", "Dass der {Color:Green}König {Color:White}sich so verändert hat,\nliegt bestimmt auch an den Monstern.", "Hier ist es gefährlich!\nGeh schnell nach Hause!", "Wir sind jederzeit bereit, die Stadt\ngegen die Monster zu verteidigen.", - "He, was machst du hier drauβen?!\nGeh schnell nach Hause!", + "He, was machst du hier draußen?!\nGeh schnell nach Hause!", "Die Tiere sind auch weg...\nWas ist nur geschehen?", "Ich bin reich. Und Sammler,\nwie so viele Reiche.", "Zeig mir deine {Color:Green}Minitendo-Figuren{Color:White},\nwenn deine Sammlung {Color:Blue}kompletto {Color:White}ist.\nVerstehst du? Wenn du alle Figuren\nhast, die es gibt.", - "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind groβzügig.", - "Du machst das super! Ich bin zufrieden,\nauch wenn es drauβen hoch her geht.", + "...!?\n\nUoooooooooooooooh!!!\n\nHey, nicht schlecht!\nKompletto!!! Voll krass!\nPuh...! Du bist ein echter Maniac...!\nDas macht echt was her!\nIch lade dich in mein Haus ein.\nNimm einfach mit, was dir gefällt.\nReiche Leute sind großzügig.", + "Du machst das super! Ich bin zufrieden,\nauch wenn es draußen hoch her geht.", "{Color:Green}Handwerksmeister Mutoh{Color:White} hat gesagt,\ndass er kaum noch gute Aufträge...\n...bekommt. Ich würde ihm ja gerne\nhelfen...", "Jetzt geht es dem {Color:Green}Meister {Color:White}wieder gut!\nMan muss nur Köpfchen haben!" ], @@ -3054,8 +3054,8 @@ ], [ "", - "Hallo! Willkommen in {Color:Green}Shimaros Laden{Color:White}! Ich\nleite dies auβergewöhnliche Geschäft.\nSoll ich dir erklären, was ich anbiete?\n{Choice:3D:02}Ja bitte. {Choice:3D:03}Nein danke.", - "Nun gut! Um es kurz zu sagen:\nBei mir kannst du deinen Mut beweisen!\n\"Ich ermögliche dir, im Traum\ngegen Monster anzutreten!\"\nAber das ist noch nicht alles...\nEigentlich ist das fast zu groβzügig!\nWenn du im Traum siegreich bist,\ngewinnst du {Color:Blue}einen Preis{Color:White}...\nNun ja... Das könnte geschehen...\nVielleicht... Möglicherweise... im Traum.\nDoch sei gewarnt! Du kämpfst zwar nur\nim Traum, aber streng dich trotzdem an!\nVerletzungen im Traum sind echt!\nWirst du besiegt, dann...\nWer weiβ, was dann passiert!\n\n{07:3D:03}", + "Hallo! Willkommen in {Color:Green}Shimaros Laden{Color:White}! Ich\nleite dies außergewöhnliche Geschäft.\nSoll ich dir erklären, was ich anbiete?\n{Choice:3D:02}Ja bitte. {Choice:3D:03}Nein danke.", + "Nun gut! Um es kurz zu sagen:\nBei mir kannst du deinen Mut beweisen!\n\"Ich ermögliche dir, im Traum\ngegen Monster anzutreten!\"\nAber das ist noch nicht alles...\nEigentlich ist das fast zu großzügig!\nWenn du im Traum siegreich bist,\ngewinnst du {Color:Blue}einen Preis{Color:White}...\nNun ja... Das könnte geschehen...\nVielleicht... Möglicherweise... im Traum.\nDoch sei gewarnt! Du kämpfst zwar nur\nim Traum, aber streng dich trotzdem an!\nVerletzungen im Traum sind echt!\nWirst du besiegt, dann...\nWer weiß, was dann passiert!\n\n{07:3D:03}", "Wagst du {Color:Blue}einen Kampf{Color:White} für {Color:Blue}10 Rubine{Color:White}?\n{Choice:FF}Sicher. {Choice:3D:04}Lieber nicht.", "Oh, wie die Zeit vergeht! \n\nIch will nicht unhöflich sein,\naber du solltest jetzt gehen.", "Eins, zwei, drei... Nanu? Kann es denn\nsein, dass ich mich verzählt habe?\nDu hast offenbar nicht genügend\nRubine! Dabei wären es nur {Color:Blue}10 Rubine{Color:White}...\nUnd nicht einmal die hast du?\nTs, ts, ts.", @@ -3108,23 +3108,23 @@ "Hast du {Color:Green}Swingle {Color:White}gesehen?\nEr trägt blaue Kleider.\nUnd er ist mein Zwillingsbruder.\nIch kann ihn einfach nicht finden.", "Ganz unter uns: mit manchen Leuten\nkann man {Color:Blue}mehrmals Fragmente vereinen{Color:White}.\nAndere muss man {Color:Blue}mehrmals bitten{Color:White},\nobwohl sie Fragmente besitzen.", "Ja hallo, Herr Fee! {Color:Green}Tingle {Color:White}hat mich\ngebeten, auf dich zu warten!\nEr hat mir auch ein {Color:Red}Fragment {Color:White}gegeben!\nWollen wir {Color:Blue}Fragmente vereinen{Color:White}?", - "Er sieht uns Brüdern sehr ähnlich, aber\nder Weiβe ist nicht unser Bruder.\nWarum er uns wohl so ähnlich sieht?", + "Er sieht uns Brüdern sehr ähnlich, aber\nder Weiße ist nicht unser Bruder.\nWarum er uns wohl so ähnlich sieht?", "Bist du Herr Fee?\nDu bist doch Herr Fee, oder?\n{Color:Green}Tingle {Color:White}hat mir ein {Color:Red}Fragment {Color:White}gegeben.\n{Color:Blue}Du willst Fragmente vereinen{Color:White}, sagte er.\nWie sieht es aus?\nSollen wir {Color:Blue}Fragmente vereinen{Color:White}?", "{Color:Green}Tingle {Color:White}ist nicht mein Bruder!\nWarum helfe ich ihm dann?", "{Color:Green}Tingle {Color:White}hat mir neue\n{Color:Red}Fragmente {Color:White}gegeben.\nEigentlich will ich ja\nselbst Abenteuer erleben.\nUnd dann diese Klamotten,\ndie wir tragen müssen...", "Der gute Schatzsucher konsultiert\nausgiebig seine {Color:Red}Karte{Color:White}!{Color:Blue}\nSieh auf die Karte{Color:White}! Die {Color:Red}Karte{Color:White}!\nIch sage nur die {Color:Red}KARTE{Color:White}! Ja, also...\nToller Tipp und so, nicht? Ich würde\nauch gerne Abenteuer erleben!", - "{Sound:01:B7}Sie will einfach nicht kaputtgehen!\nIch brauche Hilfe, um sie einzureiβen.", + "{Sound:01:B7}Sie will einfach nicht kaputtgehen!\nIch brauche Hilfe, um sie einzureißen.", "{Sound:01:B8}Puh! Ist die hart!\nMir tun schon die Hände weh!", - "{Sound:01:B9}Was ist bloβ dahinter?\nWahrscheinlich leckere Steine!", - "{Sound:01:BA}Mit mehr Leuten macht es mehr Spaβ!\nDa falle ich Faulpelz nicht so auf...", + "{Sound:01:B9}Was ist bloß dahinter?\nWahrscheinlich leckere Steine!", + "{Sound:01:BA}Mit mehr Leuten macht es mehr Spaß!\nDa falle ich Faulpelz nicht so auf...", "{Sound:01:B7}Gleich ist es so weit!\nSchade, dass es dann vorbei ist.", "{Sound:01:B8}Wir sind drin!\nDas hat lange gedauert!", "{Sound:01:B9}Gemeinsam kann man alles schaffen!", "{Sound:01:BA}Diese Steine sind lecker!\nIch möchte für immer hier bleiben!", - "{Sound:01:B7}Mit mehr Leuten macht es mehr Spaβ!\nAber...\nIrgendwie sehen alle\n{Color:Green}Goronen {Color:White}gleich aus...", + "{Sound:01:B7}Mit mehr Leuten macht es mehr Spaß!\nAber...\nIrgendwie sehen alle\n{Color:Green}Goronen {Color:White}gleich aus...", "{Sound:01:B8}Sechs {Color:Green}Goronen {Color:White}auf einem Haufen\nsind ein bisschen zu viel...", "{Sound:01:B9}Die Goronen-Statue vor der Höhle\nist ein bisschen gruselig...", - "Du hast den Grabstein weggeschoben.\nJetzt kann ich endlich nach drauβen.\nAber ich fühle mich so allein hier.\nKomm mich ab und zu besuchen, ja?\nIch sammle inzwischen viele {Color:Red}Fragmente{Color:White}.\nKomm auf jeden Fall vorbei, ja?!", + "Du hast den Grabstein weggeschoben.\nJetzt kann ich endlich nach draußen.\nAber ich fühle mich so allein hier.\nKomm mich ab und zu besuchen, ja?\nIch sammle inzwischen viele {Color:Red}Fragmente{Color:White}.\nKomm auf jeden Fall vorbei, ja?!", "Ah, du kommst mich besuchen!\nWie schön!\nEs ist zwar ein Grab,\naber mach es dir gemütlich!", "Du musst noch\n{Var:1} Glücksfragmente finden.\nDeine Suche hat gerade erst begonnen.\nEs ist noch ein weiter Weg.", "Du musst noch\n{Var:1} Glücksfragmente finden.\nEs gibt noch viel zu tun.", @@ -3135,13 +3135,13 @@ "Du musst noch\n{Var:1} Glücksfragmente finden.\nEs gibt noch viel zu tun.", "Du musst noch\n{Var:1} Glücksfragmente finden.\nDu bist schon recht weit. \nGib jetzt nicht auf!", "Du musst nur noch\n{Var:1} Glücksfragment(e) finden.\nDu bist fast am Ziel!\nNur noch ein Stückchen!", - "Oh! Du hast alle Glücksfragmente\ngefunden! Meinen Glückwunsch!\nMein Bruder Tingle wird vor\nFreude auβer sich sein!", + "Oh! Du hast alle Glücksfragmente\ngefunden! Meinen Glückwunsch!\nMein Bruder Tingle wird vor\nFreude außer sich sein!", "Herr Fee, du musst noch\n{Var:1} Glücksfragmente finden.\nDu hast gerade erst angefangen.\nEs ist noch ein langer Weg.", "Herr Fee, du musst noch\n{Var:1} Glücksfragmente finden.\nEs gibt noch viel zu tun.\nPack es an!", "Herr Fee, du musst noch\n{Var:1} Glücksfragmente finden.\nDu bist schon recht weit.\nIch drücke dir die Daumen!", "Herr Fee, du musst noch\n{Var:1} Glücksfragment(e) finden.\nDu bist fast fertig.\nFinde dein Glück!", "Du hast alle Glücksfragmente gefunden!\nBist du jetzt glücklich, Herr Fee?", - "Glücksfragmente, die du noch\nfinden musst? Es sind noch {Var:1}.\nDiese Information kommt von {Color:Green}Tingle{Color:White}.\nWoher er das wohl weiβ?", + "Glücksfragmente, die du noch\nfinden musst? Es sind noch {Var:1}.\nDiese Information kommt von {Color:Green}Tingle{Color:White}.\nWoher er das wohl weiß?", "Glücksfragmente, die du noch\nfinden musst? Es sind noch {Var:1}.\nDu hast noch viel zu tun. Ich würde\nauch gerne auf Glückssuche gehen.", "Glücksfragmente, die du noch\nfinden musst? Es sind noch {Var:1}.\nDu bist schon recht weit. Sammelst\ndu für mich mit?", "Glücksfragmente, die du noch\nfinden musst? Es sind noch {Var:1}.\nDu bist fast fertig. Wenn du nicht mehr\nsuchst, wird es hier wieder so einsam...", @@ -3176,7 +3176,7 @@ "Alle Ausgaben der {Color:Red}Magnus-Schwertfibel\n{Color:White}sind fertig!\nDie waren doch sehr informativ, oder?\nDu Schlaumeier! {Symbol:0B}", "Ich bin der flinke {Color:Green}Briefträger{Color:White}\nund eile für dich durch die Stadt!", "Im Nu sind alle Briefe da!\nDein zuverlässiger {Color:Green}Briefträger{Color:White}!", - "Leichten Fuβes schlängele ich mich\ndurch - dein {Color:Green}Briefträger{Color:White}!", + "Leichten Fußes schlängele ich mich\ndurch - dein {Color:Green}Briefträger{Color:White}!", "Rennen, Springen, Zustellen!\nDein {Color:Green}Briefträger{Color:White}!", "Die Post ist da, bevor du es merkst.\nDer Held der Post - dein {Color:Green}Briefträger{Color:White}!", "In ganz Hyrule unterwegs -\ndein {Color:Green}Briefträger{Color:White}!", @@ -3187,14 +3187,14 @@ "Meine Vorfahren haben das Schloss\ngebaut! Ein Meisterwerk der Baukunst!", "Hast du einen Auftrag für einen\nhervorragenden Handwerker wie mich?!", "Hast du einen Auftrag für einen\nhervorragenden Handwerker wie mich?!", - "Na, das lief ja wie am Schnürchen!\nDas war genial!\nNiemand auβer mir hätte das in so\nkurzer Zeit geschafft! Hahahahaha!!!", + "Na, das lief ja wie am Schnürchen!\nDas war genial!\nNiemand außer mir hätte das in so\nkurzer Zeit geschafft! Hahahahaha!!!", "Was?! Ich soll zu Hause bleiben, weil\ndie Monster kommen? So ein Quatsch!\nWenn ich einen Auftrag kriege, gehe ich\nda hin! Das wäre doch gelacht!" ], [ "", "", "Ooh... Ein Kunde...\nWarum ich einen {Color:Green}Glücksspielsalon {Color:White}habe?\nÄh, weil man beim Glücksspiel\nmanchmal gewinnen kann.\nIch kann es nicht empfehlen,\naber probiere es ruhig aus!", - "{Color:Blue}Ein Spiel{Color:White} kostet {Color:Blue}10 Rubine{Color:White}.\n\nWillst du es probieren, obwohl du nicht\nweiβt, ob du etwas gewinnst?\nEs ist besser, du lässt es.\n{Choice:FF}Ich probier's. {Choice:42:05}Ich lass es sein.", + "{Color:Blue}Ein Spiel{Color:White} kostet {Color:Blue}10 Rubine{Color:White}.\n\nWillst du es probieren, obwohl du nicht\nweißt, ob du etwas gewinnst?\nEs ist besser, du lässt es.\n{Choice:FF}Ich probier's. {Choice:42:05}Ich lass es sein.", "Glück gehabt!\nDu hast nicht genug Rubine.\nLass lieber die Hände vom Glücksspiel!\nFordere dein Glück nicht heraus!", "Sag ich doch. Es ist besser so.\nLass lieber die Hände vom Glücksspiel!", "", @@ -3275,13 +3275,13 @@ "Gib nicht auf und komm bald wieder!", "Unglaublich!\n\nDu hast jetzt alle Figuren, die in der\nLotterie-Maschine waren!\nIch werde noch mehr {Color:Red}Figuren {Color:White}herstellen,\nalso komm bald wieder!", "Herzlichen Glückwunsch!\nDu hast {Color:Blue}alle Figuren, die es gibt{Color:White}!\nIch bewahre sie sorgfältig auf. Du\nkannst sie dir jederzeit hier ansehen.\nGut, dann will ich mal weiter {Color:Red}Figuren{Color:White}\nbasteln!\nJetzt muss mich nur noch\ndie Muse küssen!", - "Herzlichen Glückwunsch!\nDu hast {Color:Blue}alle Figuren, die es gibt{Color:White}!\nIch bewahre sie sorgfältig auf. Du\nkannst sie dir jederzeit hier ansehen.\nAuβerdem verleihe ich dir diese\n{Color:Red}Minitendo-Goldmedaille{Color:White}!\nIch hoffe, du weiβt das zu würdigen!", + "Herzlichen Glückwunsch!\nDu hast {Color:Blue}alle Figuren, die es gibt{Color:White}!\nIch bewahre sie sorgfältig auf. Du\nkannst sie dir jederzeit hier ansehen.\nAußerdem verleihe ich dir diese\n{Color:Red}Minitendo-Goldmedaille{Color:White}!\nIch hoffe, du weißt das zu würdigen!", "", "Interessierst du dich für diese\n{Color:Blue}Maschine{Color:White}? Dann hör mir erst einmal zu!", "", "", "Dieses Regal ist für {Color:Red}Figuren{Color:White}, aber es\nhat noch niemand eine hineingestellt.", - "Gefällt sie dir,\ndie {Color:Red}Minitendo-Goldmedaille{Color:White}?\nEs gibt keine gröβere Ehre\nfür einen echten Maniac.", + "Gefällt sie dir,\ndie {Color:Red}Minitendo-Goldmedaille{Color:White}?\nEs gibt keine größere Ehre\nfür einen echten Maniac.", "", "", "" @@ -3303,8 +3303,8 @@ "Schuhe für Zelda, wie schön!", "...?!?\nNanu? Was ist denn das?\nEs sind ja schon wieder\nneue Schuhe fertig!\nIch habe nämlich die Angewohnheit,\nim Schlaf Schuhe herzustellen...\nDu bist hier, weil du unbedingt\nSchuhe von mir haben willst, oder?\nIch schenke dir diese Schuhe,\nweil du mich geweckt hast!\nEinen Moment, sie sind gleich fertig.", "", - "{Sound:02:04}{Color:Red}Ziehe die Pegasus-Stiefel{Color:White}\nan und lauf los!\nEs macht unheimlich viel\nSpaβ, Dinge zu rammen!", - "{Sound:01:FC}Unsere {Color:Red}Pegasus-Stiefel\n{Color:White}sind äuβerst bequem!", + "{Sound:02:04}{Color:Red}Ziehe die Pegasus-Stiefel{Color:White}\nan und lauf los!\nEs macht unheimlich viel\nSpaß, Dinge zu rammen!", + "{Sound:01:FC}Unsere {Color:Red}Pegasus-Stiefel\n{Color:White}sind äußerst bequem!", "{Sound:01:F8}Bitte geh sorgfältig mit ihnen um!", "", "", @@ -3334,27 +3334,27 @@ "Das Standard-Zimmer\nfür {Var:1} Rubine!\n{07:45:06}", "Oh ja! Du kommst wohl aus\ngutem Hause, mein Kind!\nDas Luxus-Zimmer\nfür {Var:1} Rubine!\n{07:45:06}", "Du bezahlst im Voraus!", - "Wie bitte?!? Du kleine\nGöre hast kein Geld?\nKomm wieder, wenn du groβ bist!\nGeh nach Hause!", + "Wie bitte?!? Du kleine\nGöre hast kein Geld?\nKomm wieder, wenn du groß bist!\nGeh nach Hause!", "Danke für deinen Besuch!\nSchlaf gut!", "Möchtest du nicht ein\nwenig schlafen? Nein?\nNa, du bist jederzeit willkommen!", "Das ist der Ausgang!\nRuh dich in deinem Zimmer ein wenig aus!", "Na, hast du gut geschlafen? Und\ndas {Color:Red}Geschenk{Color:White}? Komm bald wieder!", - "Es gibt groβe Unterschiede zwischen\nden guten und den schlechten Zimmern.", + "Es gibt große Unterschiede zwischen\nden guten und den schlechten Zimmern.", "Die Unterschiede erkennst du nur,\nwenn du dir die Zimmer selbst ansiehst.", "Hast du schon von dem {Color:Red}Force {Color:White}gehört?\nDem Schatz, der alle Wünsche erfüllt?\nDer {Color:Green}König {Color:White}soll ganz verrückt danach\nsein. Früher war er ja nicht so gierig.\nEr ist wie ausgewechselt...", "Was ist nur mit dem {Color:Green}König {Color:White}los?\nSo war er früher nie...", "Juhu! Juhu!", "Warte!", "Bruder!", - "Endlich sind wir da. Ganz schön\ngroβ, diese Stadt!", + "Endlich sind wir da. Ganz schön\ngroß, diese Stadt!", "Immer im Hotel wohnen ist auch\nnicht das Wahre...", "Ich muss mir ein ruhiges\nZuhause suchen.", "Der {Color:Green}König {Color:White}benimmt sich in letzter\nZeit unmöglich!\nNeulich waren Soldaten in meinem Haus,\ndie von mir das {Color:Red}Force {Color:White}haben wollten!", "Um ins {Color:Green}Tal der Königsfamilie{Color:White} zu\ngelangen, muss man durch den {Color:Blue}Irrwald{Color:White}.\nEs ist nicht einfach, ihn zu\ndurchqueren. Achte auf die Schilder!", "Du willst zum {Color:Green}Grab {Color:White}von König Gustaf?\n\nDann musst du zu {Color:Green}Boris{Color:White}, dem\nTotengräber, ins {Color:Green}Tal der Königsfamilie{Color:White}!", - "Du warst im Luxus-Zimmer? Ich weiβ\nnicht, in welches Zimmer ich gehen soll.", + "Du warst im Luxus-Zimmer? Ich weiß\nnicht, in welches Zimmer ich gehen soll.", "Der {Color:Green}Sela-Wasserfall{Color:White} ist eine Quelle in\nHyrule. Dort entspringt alles Wasser!", - "Vor den Kindern sollte man\ndas zwar nicht sagen, aber...\nIrgendetwas stimmt nicht\nin {Color:Green}Schloss Hyrule{Color:White}.\nWas da nicht stimmt? Tja...\nIch weiβ es auch nicht genau...", + "Vor den Kindern sollte man\ndas zwar nicht sagen, aber...\nIrgendetwas stimmt nicht\nin {Color:Green}Schloss Hyrule{Color:White}.\nWas da nicht stimmt? Tja...\nIch weiß es auch nicht genau...", "Ich habe es mit eigenen Augen gesehen!\nIm {Color:Green}Schloss {Color:White}sind überall Monster!\nEinige von uns sind nicht mehr\naus dem Schloss zurückgekehrt!", "Wir haben heute früher Schluss!\nJuhuu! {Symbol:0B}", "Bruder, warte auf mich!", @@ -3365,7 +3365,7 @@ "Ich werde sie mal besuchen gehen. {Symbol:0B}", "Zu zweit kommt einfach\nkeine Stimmung auf.", "Allein wird man schnell einsam. Ich will\nmir auch eine schöne Bleibe suchen.", - "Allein hat man es schwer.\nWohin könnte ich bloβ umziehen...?", + "Allein hat man es schwer.\nWohin könnte ich bloß umziehen...?", "Wenn du wieder etwas hast, sagst du\nmir Bescheid, ja?", "", "", @@ -3438,18 +3438,18 @@ "Es gibt nichts, was ich dir noch\nbeibringen könnte!\nDu musst immer weitertrainieren!\nDie Schwertkunst ist etwas Erhabenes!", "{Sound:00:D0}Ich bin {Color:Green}Maximilian{Color:White}, der wahrhaftigste\nMeister der Schwertkunst von Hyrule!\nWenn du bei mir {Color:Blue}trainierst{Color:White},\nwirst du schnell Fortschritte machen!\nNanu?\n\nEs ist noch ein wenig zu früh für\ndich, bei mir zu trainieren.\nKomm wieder, wenn du {Color:Red}mindestens\nzehn Herzen{Color:White} hast!", "", - "{Sound:00:D0}Ich bin {Color:Green}Magnus der Erste{Color:White}. Der gröβte\nMeister der Schwertkunst aller Zeiten!\nDas {Color:Blue}Training {Color:White}bei mir ist unvergleichlich!\nEin besseres gibt es nicht!", + "{Sound:00:D0}Ich bin {Color:Green}Magnus der Erste{Color:White}. Der größte\nMeister der Schwertkunst aller Zeiten!\nDas {Color:Blue}Training {Color:White}bei mir ist unvergleichlich!\nEin besseres gibt es nicht!", "Bist du willens, bei mir zu {Color:Blue}trainieren{Color:White}?\n{Choice:FF}Ja bitte. {Choice:46:5F}Nein danke.", - "So denn. Ich werde dich die\nhöchste Schwerttechnik lehren:\nDie {Color:Red}groβe Wirbelattacke{Color:White}!\n\n{Color:Blue}1. {Color:White}Starte eine Wirbelattacke.\n\n{Color:Blue}2. {Color:White}Drücke wiederholt den Knopf!\n\nEs ist vollbracht!\n\nIst dir der Ablauf gewahr geworden?\n{Choice:FF}Ja. {Choice:46:3F}Nein.", + "So denn. Ich werde dich die\nhöchste Schwerttechnik lehren:\nDie {Color:Red}große Wirbelattacke{Color:White}!\n\n{Color:Blue}1. {Color:White}Starte eine Wirbelattacke.\n\n{Color:Blue}2. {Color:White}Drücke wiederholt den Knopf!\n\nEs ist vollbracht!\n\nIst dir der Ablauf gewahr geworden?\n{Choice:FF}Ja. {Choice:46:3F}Nein.", "So, so. Du glaubst, zu wissen,\nwie die hohe Kunst vollbracht wird!\nNun. Schwerttechniken muss man\nmit dem eigenen Körper erlernen.\nDu sollst nun eine Marionette sein,\ndie Technik eigenmächtig auszuführen!\nNun also, die {Color:Blue}Marionettentechnik{Color:White} von\nMagnus dem Ersten! Sehe und staune!\nEins, zwei, drei...\n\nMarionette nun sei!", "So denn.\nNun sollst du es {Color:Blue}selbst {Color:White}versuchen!\n{07:46:67}", "Beachtlich!\n\nNur ein wahrer Kämpfer besteht das\nTraining von {Color:Green}Magnus dem Ersten{Color:White}!\nFeierlich überreiche ich dir nun diese\n{Color:Red}Schriftrolle der Schwertkunst{Color:White}!\nFalls du eine Schwerttechnik vergessen\nsolltest, kannst du dort nachsehen!", - "Du hast bereits alle\nSchwerttechniken erlernt!\nJetzt heiβt es üben und nochmals üben!\nDu musst immer weitertrainieren!\nEs beginnt und endet mit dem Schwert!", - "{Sound:00:D0}Ich bin {Color:Green}Magnus der Erste{Color:White}. Der gröβte\nMeister der Schwertkunst aller Zeiten!\nDas {Color:Blue}Training {Color:White}bei mir ist unvergleichlich!\nEin besseres gibt es nicht!\nNanu?\n\nEs ist noch ein wenig zu früh für\ndich, bei mir zu trainieren.\nKomm wieder, wenn du {Color:Red}alle sieben\nSchriftrollen der Schwertkunst {Color:White}hast!", + "Du hast bereits alle\nSchwerttechniken erlernt!\nJetzt heißt es üben und nochmals üben!\nDu musst immer weitertrainieren!\nEs beginnt und endet mit dem Schwert!", + "{Sound:00:D0}Ich bin {Color:Green}Magnus der Erste{Color:White}. Der größte\nMeister der Schwertkunst aller Zeiten!\nDas {Color:Blue}Training {Color:White}bei mir ist unvergleichlich!\nEin besseres gibt es nicht!\nNanu?\n\nEs ist noch ein wenig zu früh für\ndich, bei mir zu trainieren.\nKomm wieder, wenn du {Color:Red}alle sieben\nSchriftrollen der Schwertkunst {Color:White}hast!", "", "{Sound:00:D0}Ich bin {Color:Green}Austin{Color:White}, einer der besten\nSchwertkämpfer von Hyrule!\nWenn du bei mir {Color:Blue}trainierst{Color:White}, kannst du\nim Nu deine Schwerttechnik verbessern!", "Was ist? Willst du bei mir {Color:Blue}trainieren{Color:White}?\n{Choice:FF}Ja bitte. {Choice:46:5F}Nein danke.", - "Ja!\nDu beherrschst die {Color:Red}Wirbelattacke{Color:White}!\nIch zeige dir, wie du sie noch\nschneller aktivieren kannst!\nFür das {Color:Blue}Training {Color:White}bei mir ist deine\nVorstellungskraft sehr wichtig!\nAlso, schlieβe deine Augen...\n\nStell dir vor, wie du {Color:Blue}blitzschnell die\nWirbelattacke aktivierst{Color:White}...\nUoooooooh!\n\nWiiiiiirbel!", + "Ja!\nDu beherrschst die {Color:Red}Wirbelattacke{Color:White}!\nIch zeige dir, wie du sie noch\nschneller aktivieren kannst!\nFür das {Color:Blue}Training {Color:White}bei mir ist deine\nVorstellungskraft sehr wichtig!\nAlso, schließe deine Augen...\n\nStell dir vor, wie du {Color:Blue}blitzschnell die\nWirbelattacke aktivierst{Color:White}...\nUoooooooh!\n\nWiiiiiirbel!", "Haha!\n\nJetzt kannst du die Wirbelattacke\n{Color:Blue}blitzschnell aktivieren{Color:White}!\n...Das ist kein Scherz!\n\nAlles hängt von deiner \nVorstellungskraft ab! \nBündle deine Energie!", "", "", @@ -3459,7 +3459,7 @@ "", "{Sound:00:D0}Ich bin {Color:Green}Dustin{Color:White}, der beinahe beste\nSchwertkämpfer von Hyrule!\nWenn du bei mir {Color:Blue}trainierst{Color:White}, kannst du\nim Nu deine geheimen Kräfte stärken!", "Was ist? Willst du bei mir {Color:Blue}trainieren{Color:White}?\n{Choice:FF}Ja bitte. {Choice:46:5F}Nein danke.", - "Ja! Ich zeige dir, wie du dein\nSchwert {Color:Red}noch schneller auflädst{Color:White},\ndamit es dich im Nu mehrfach gibt!\n\nFür das {Color:Blue}Training {Color:White}bei mir ist deine\nVorstellungskraft sehr wichtig!\nAlso, schlieβe deine Augen...\n\nStell dir vor, wie {Color:Blue}es dich\nplötzlich multipliziert{Color:White}...\nAoooooooh!\n\nMuuuuultipliziiiiiert!", + "Ja! Ich zeige dir, wie du dein\nSchwert {Color:Red}noch schneller auflädst{Color:White},\ndamit es dich im Nu mehrfach gibt!\n\nFür das {Color:Blue}Training {Color:White}bei mir ist deine\nVorstellungskraft sehr wichtig!\nAlso, schließe deine Augen...\n\nStell dir vor, wie {Color:Blue}es dich\nplötzlich multipliziert{Color:White}...\nAoooooooh!\n\nMuuuuultipliziiiiiert!", "Haha...!!!\n\nJetzt {Color:Blue}multiplizierst du dich im Nu{Color:White}!\n\n...Das ist kein Scherz!\n\nLüge und Wahrheit sind die zwei Seiten\neiner Medaille. Bündle deine Energie!", "", "", @@ -3469,7 +3469,7 @@ "", "{Sound:00:D0}Ich bin {Color:Green}Justin{Color:White}, so etwas Ähnliches wie\nder beste Schwertkämpfer von Hyrule!\nWenn du bei mir {Color:Blue}trainierst{Color:White}, kannst du\nim Nu deine Schwerttechnik verbessern!", "Was ist? Willst du bei mir {Color:Blue}trainieren{Color:White}?\n{Choice:FF}Ja bitte. {Choice:46:5F}Nein danke.", - "Ja! Ich zeige dir, wie deine {Color:Red}groβe{Color:White}\n{Color:Red}Wirbelattacke{Color:White} noch länger anhält!\nFür das {Color:Blue}Training {Color:White}bei mir ist deine\nVorstellungskraft sehr wichtig!\nAlso, schlieβe deine Augen...\n\nStell dir vor, wie du dich\n{Color:Blue}ununterbrochen um dich selbst drehst{Color:White}!\nHahaaaaaah!\n\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel!", + "Ja! Ich zeige dir, wie deine {Color:Red}große{Color:White}\n{Color:Red}Wirbelattacke{Color:White} noch länger anhält!\nFür das {Color:Blue}Training {Color:White}bei mir ist deine\nVorstellungskraft sehr wichtig!\nAlso, schließe deine Augen...\n\nStell dir vor, wie du dich\n{Color:Blue}ununterbrochen um dich selbst drehst{Color:White}!\nHahaaaaaah!\n\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel...\nWirbel!", "Haha!\n\nJetzt {Color:Blue}hält deine Wirbelattacke\nnoch länger an als vorher{Color:White}!\n...Das ist kein Scherz!\n\nWer misstrauisch ist, verkennt die Welt.\nBündle deine Energie!", "{Sound:00:D0}Ich bin {Color:Green}Justin{Color:White}, so etwas Ähnliches wie\nder beste Schwertkämpfer von Hyrule!\nWenn du bei mir {Color:Blue}trainierst{Color:White}, kannst du\nim Nu deine Schwerttechnik verbessern!\nNanu?\n\nEs ist noch ein wenig zu früh für\ndich, bei mir zu trainieren.\nKomm wieder, wenn du die {Color:Red}höchste\nSchwerttechnik {Color:White}überhaupt erlernt hast.", "Gut...\nDu kannst gehen.", @@ -3489,38 +3489,38 @@ "{Sound:01:FE}Keine Lust zum {Color:Blue}Fragmente vereinen{Color:White}?\n", "{Sound:01:FF}Na bitte! Passt perfekt! Bestimmt\npassiert mir jetzt etwas Wunderbares!", "", - "{Sound:01:F7}Ich habe ein {Color:Red}Fragment{Color:White} gefunden,\ndas total auβergewöhnlich ist!\nIch glaube, das ist ein seltenes Stück.\n", + "{Sound:01:F7}Ich habe ein {Color:Red}Fragment{Color:White} gefunden,\ndas total außergewöhnlich ist!\nIch glaube, das ist ein seltenes Stück.\n", "{Sound:01:F8}Wirklich?! Du willst mit mir \n{Color:Blue}Fragmente vereinen{Color:White}?! Hurra!", "{Sound:01:F9}Äh, möchtest du nicht \n{Color:Blue}Fragmente vereinen{Color:White}?", "{Sound:01:FA}Oh, sie passen perfekt!\nToll! Auf dass ich jetzt Glück habe!", "", - "{Sound:01:FE}Hm...\nIch habe ein {Color:Red}Fragment{Color:White} gefunden,\ndas sieht ganz auβergewöhnlich aus.\nVielleicht ist es eine seltene Sorte...", + "{Sound:01:FE}Hm...\nIch habe ein {Color:Red}Fragment{Color:White} gefunden,\ndas sieht ganz außergewöhnlich aus.\nVielleicht ist es eine seltene Sorte...", "{Sound:01:FF}Willst du {Color:Blue}Fragmente vereinen{Color:White}?\nHast du auch ein passendes {Color:Red}Fragment{Color:White}?", "{Sound:01:FD}Oh! Für dieses {Color:Red}Fragment{Color:White} ist ein\npassendes wohl schwer zu finden.", "{Sound:01:FB}He! Passt doch perfekt, oder?!\n\nIch hätte nicht gedacht, dass es\nein passendes {Color:Red}Fragment{Color:White} gibt!", - "{Sound:01:FB}Ich glaube, das ist ein sehr\nauβergewöhnliches {Color:Red}Fragment{Color:White}!", - "{Sound:02:05}Sieh doch, dieses {Color:Red}Fragment{Color:White}!\nHast du so eins schon mal gesehen?\nWas? Du weiβt nicht, was {Color:Red}Fragmente{Color:White}\nsind? Dann finde es erst mal heraus!", + "{Sound:01:FB}Ich glaube, das ist ein sehr\naußergewöhnliches {Color:Red}Fragment{Color:White}!", + "{Sound:02:05}Sieh doch, dieses {Color:Red}Fragment{Color:White}!\nHast du so eins schon mal gesehen?\nWas? Du weißt nicht, was {Color:Red}Fragmente{Color:White}\nsind? Dann finde es erst mal heraus!", "{Sound:02:00}Wie? Du willst {Color:Blue}Fragmente vereinen{Color:White}?", "{Sound:01:FA}Für dieses {Color:Red}Fragment{Color:White} ist ein passendes\nwohl nur sehr schwer zu finden.", "{Sound:01:F9}Na so was! Passt perfekt!\nDu hattest auch ein seltenes Stück...", - "{Sound:01:FD}Was? Du weiβt nicht, was {Color:Red}Fragmente{Color:White}\nsind? Dann finde es erst mal heraus!", + "{Sound:01:FD}Was? Du weißt nicht, was {Color:Red}Fragmente{Color:White}\nsind? Dann finde es erst mal heraus!", "{Sound:01:FA}Welch seltene Ehre,\nBesuch zu bekommen.\nHier gibt es zwar nichts, aber bitte,\nbleibt doch und ruht euch aus!", "{Sound:02:00}Oh! Du willst {Color:Blue}Fragmente vereinen{Color:White}?\nGut, dann wollen wir mal!", "{Sound:02:01}Hm. Doch nicht...", "{Sound:02:02}Oh! Sie passen perfekt zusammen!\nJetzt werde ich Glück haben!", "", - "{Sound:02:05}Du hast den Felsen für mich\nbeiseite geschoben!\nEndlich kann ich wieder\nnach drauβen...", + "{Sound:02:05}Du hast den Felsen für mich\nbeiseite geschoben!\nEndlich kann ich wieder\nnach draußen...", "{Sound:01:FE}Ah! Du willst {Color:Blue}Fragmente vereinen{Color:White}.\nWelche denn?", "{Sound:01:FB}Es gibt wohl doch kein Fragment, das\nzu diesem komischen Fragment passt...", "{Sound:01:FC}Na so etwas! Das passt ja!\nHervorragend sogar! Glück gehabt!", "", "{Sound:01:F9}Was ist?\n\nNa! Du hast wohl ein Auge auf dieses\nseltene {Color:Red}Fragment{Color:White} geworfen, was?", - "{Sound:01:FA}Was tust du da!\n{Color:Blue}Vereine {Color:White}bloβ nicht {Color:Blue}Fragmente{Color:White}!", + "{Sound:01:FA}Was tust du da!\n{Color:Blue}Vereine {Color:White}bloß nicht {Color:Blue}Fragmente{Color:White}!", "{Sound:01:FD}Puh! Meinem {Color:Red}Fragmentchen{Color:White} ist\nnichts passiert! Juchhe, juchhu! {Symbol:0B}", "{Sound:02:02}Oh nein... Jetzt sind sie zusammen...\nMein {Color:Red}Fragmentchen{Color:White}...", "", "{Sound:02:03}Oh! Du trägst Menschenkleidung! Wie\nschön! Ich hätte auch gerne welche.\nIch finde, Menschen sehen irgendwie\ncooler aus als {Color:Green}Minish{Color:White}.\nIch glaube, ich bin nicht der einzige\n{Color:Green}Minish{Color:White}, der so denkt.", - "{Sound:02:02}{Color:Blue}Gongol-Bohnen{Color:White} brauchen\nWasser, damit sie wachsen.\nDie blauen Bohnen wachsen,\nwenn du sie mit {Color:Red}Wasser {Color:White}begieβt.\nDie grünen Bohnen wachsen, wenn\ndu sie mit {Color:Red}Gongol-Wasser{Color:White} begieβt.\n{Color:Red}Gongol-Wasser{Color:White} ist grün und ist\nnur am {Color:Green}Gongol-Berg{Color:White} zu finden.\nEs entspringt in der Nähe des\nEingangs zum {Color:Green}Gongol-Berg{Color:White}.", + "{Sound:02:02}{Color:Blue}Gongol-Bohnen{Color:White} brauchen\nWasser, damit sie wachsen.\nDie blauen Bohnen wachsen,\nwenn du sie mit {Color:Red}Wasser {Color:White}begießt.\nDie grünen Bohnen wachsen, wenn\ndu sie mit {Color:Red}Gongol-Wasser{Color:White} begießt.\n{Color:Red}Gongol-Wasser{Color:White} ist grün und ist\nnur am {Color:Green}Gongol-Berg{Color:White} zu finden.\nEs entspringt in der Nähe des\nEingangs zum {Color:Green}Gongol-Berg{Color:White}.", "{Sound:02:01}Diese{Color:Green} Stein-Soldaten\n{Color:White}sind Marionetten,\ndie wir Minish einst für die\nMenschen erschaffen haben.\nDas Geheimnis ist: Man kann sie mit\ndem {Color:Blue}Schalter ein- und ausschalten{Color:White}.", "{Sound:02:01}Mit den {Color:Red}Flossen{Color:White}, die der {Color:Green}Älteste{Color:White}\nin der {Color:Green}Bücherei {Color:White}hat,\nkann man geschwind durch\nden See schwimmen.", "{Sound:02:04}Kannst du dieses Rätsel lösen?\n\"{Color:Blue}Klipp-klapp, Plitsch-platsch.\nDie Lösung ist in jenem Haus.{Color:White}\"{Color:Blue}\n{Color:White}Ob du meinen Freund treffen wirst?", @@ -3532,7 +3532,7 @@ ], [ "", - "{Sound:01:FC}Nanu? Ein Gast! Welch seltene Ehre!\nWenn du Fragen hast, dann frag mich!\nIch weiβ fast alles! Wie? Du willst in den\n{Color:Blue}Tempel, den man vom See aus sieht{Color:White}?\nEs gibt einen Minish, der den Tempel\nvor langer Zeit einmal betreten hat.\nEr heiβt {Color:Green}Lexta {Color:White}und lebt in der\n{Color:Green}Bücherei in der Stadt{Color:White}!\nDie Bücherei müsste bald aufmachen.\nGeh doch mal hin!", + "{Sound:01:FC}Nanu? Ein Gast! Welch seltene Ehre!\nWenn du Fragen hast, dann frag mich!\nIch weiß fast alles! Wie? Du willst in den\n{Color:Blue}Tempel, den man vom See aus sieht{Color:White}?\nEs gibt einen Minish, der den Tempel\nvor langer Zeit einmal betreten hat.\nEr heißt {Color:Green}Lexta {Color:White}und lebt in der\n{Color:Green}Bücherei in der Stadt{Color:White}!\nDie Bücherei müsste bald aufmachen.\nGeh doch mal hin!", "{Sound:01:FB}{Color:Green}Lexta {Color:White}war schon mal im {Color:Green}Tempel des\nTropfens{Color:White}. Er wohnt in der {Color:Green}Bücherei\nin der Stadt{Color:White}. Mehr Tipps kann ich dir\nleider nicht geben.", "{Sound:02:05}Hast du {Color:Green}Lexta {Color:White}getroffen?!\nUnd, war er im {Color:Green}Tempel des Tropfens{Color:White}?\nIch wusste es!\nIch bin eben unschlagbar!", "{Sound:01:FE}Ich halte Augen und Ohren offen, aber\nim Moment habe ich keine Neuigkeiten.", @@ -3548,13 +3548,13 @@ "Als Nächstes wäre da das Buch...\n\nGenau! \"{Color:Red}Die Legende der Minish{Color:White}\"\nist auch schon lange überfällig.\nDas hat ein Forscher, der etwas\nzerstreut wirkt und er wohnt...\n...{Color:Blue}in der Nähe der Mühle am Bach{Color:White}.", "Zuletzt wäre da noch\n\"{Color:Red}Alles über Masken{Color:White}\"!\nBürgermeister {Color:Green}Hagar {Color:White}hat es\nausgeliehen. Es geht doch nicht,\ndass der wichtigste Mann der Stadt\ndas Buch nicht zurückgibt!", "", - "Dieses \"{Color:Red}Bilderlexikon der Tierwelt{Color:White}\"\nwar schon ewig ausgeliehen!\nAha! Jaaa! {Player}, du hast\nes mir zurückgebracht!?!\nDanke!\nDas ist eine groβe Hilfe! Ach!\nDu bist wirklich sehr nett!", + "Dieses \"{Color:Red}Bilderlexikon der Tierwelt{Color:White}\"\nwar schon ewig ausgeliehen!\nAha! Jaaa! {Player}, du hast\nes mir zurückgebracht!?!\nDanke!\nDas ist eine große Hilfe! Ach!\nDu bist wirklich sehr nett!", "Ah, das Buch kenne ich doch! \"{Color:Red}Die\nLegende der Minish{Color:White}\" - lange überfällig!\nHast du es mir etwa zurückgebracht,\n{Player}!?! Ju-hu-bel!!!", "Ah, da ist ja das Buch!\n\"{Color:Red}Alles über Masken{Color:White}\" - lange überfällig!\nDer {Color:Green}Bürgermeister {Color:White}ist so nachlässig!\n\nWar es nicht sehr schwierig, das\nBuch zurückzubekommen?\nIch bin dir wirklich sehr dankbar!!!\nDanke, {Player}.", "", "", "", - "Nun gut!!!\nDu warst eine groβe Hilfe, {Player}!\nDank deiner Hilfe sind alle\nausgeliehenen Bücher wieder da!\nDu verdienst wahrlich\ntosenden Beifall!\nJetzt können wir die Bücher im\n1. Stock wieder ordentlich hinstellen!\n{Color:Green}Vadder Orco{Color:White}?!? Würdest du\ndich bitte darum kümmern?", + "Nun gut!!!\nDu warst eine große Hilfe, {Player}!\nDank deiner Hilfe sind alle\nausgeliehenen Bücher wieder da!\nDu verdienst wahrlich\ntosenden Beifall!\nJetzt können wir die Bücher im\n1. Stock wieder ordentlich hinstellen!\n{Color:Green}Vadder Orco{Color:White}?!? Würdest du\ndich bitte darum kümmern?", "Hier bin ich!\nIst schon so gut wie erledigt!!!", "{Sound:00:DB}Die Bücher bewegen sich ganz\nvon alleine. Aber das glaubt mir keiner!", "{Color:Green}Vadder Orco{Color:White} aus dem 1. Stock\nist in letzter Zeit so komisch.\nEr behauptet, die Bücher würden\nsich von alleine bewegen.\nVielleicht gibt es dort Mäuse.", @@ -3584,7 +3584,7 @@ "KOBITO{Symbol:1F}HONDANA{Symbol:1F}014", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}015", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}016", - "{Sound:02:05}Ich bin {Color:Green}Lextas {Color:White}Schüler. Mein Name\nist Programm! Ich heiβe {Color:Green}Studius{Color:White}.\n{Color:Green}Lextas {Color:White}Abenteuergeschichten...\n\n{Sound:01:FD}...sind die besten!!!\nJa, absolut!\nIch bin ein Minish und denke auch so,\ndeshalb mag ich mutige Männer!", + "{Sound:02:05}Ich bin {Color:Green}Lextas {Color:White}Schüler. Mein Name\nist Programm! Ich heiße {Color:Green}Studius{Color:White}.\n{Color:Green}Lextas {Color:White}Abenteuergeschichten...\n\n{Sound:01:FD}...sind die besten!!!\nJa, absolut!\nIch bin ein Minish und denke auch so,\ndeshalb mag ich mutige Männer!", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}018", "{Sound:01:FD}Oh! Du hast dieses wunderbare\nWerkzeug von {Color:Green}Lexta {Color:White}bekommen?\nIch beneide dich!\nIch kann mich nicht so gut bewegen...\nWenn du wie {Color:Green}Lexta {Color:White}zu Abenteuern\naufbrichst, musst du auch sein wie er.\nStandhaft! Mutig! Feurig!\nGenau so.", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}020", @@ -3592,7 +3592,7 @@ "KOBITO{Symbol:1F}HONDANA{Symbol:1F}022", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}023", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}024", - "{Sound:02:0D}Hohohoho!\nWas willst du denn von mir?\nNein! Erst will ich mich vorstellen!\nHohohohooo!\nHüstel! Räusper!\n\nIch heiβe {Color:Green}Lexta{Color:White}!\nMein Alter... habe ich vergessen!\nAls junger Mann habe ich groβe\nAbenteuer bestanden!\nJetzt unterrichte ich meinen Schüler\nund verbringe so meinen Lebensabend.", + "{Sound:02:0D}Hohohoho!\nWas willst du denn von mir?\nNein! Erst will ich mich vorstellen!\nHohohohooo!\nHüstel! Räusper!\n\nIch heiße {Color:Green}Lexta{Color:White}!\nMein Alter... habe ich vergessen!\nAls junger Mann habe ich große\nAbenteuer bestanden!\nJetzt unterrichte ich meinen Schüler\nund verbringe so meinen Lebensabend.", "{Sound:02:0D}Ich war überall als {Color:Green}Lexta{Color:White},\nder Schatzsucher, bekannt!", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}027", "KOBITO{Symbol:1F}HONDANA{Symbol:1F}028", @@ -3657,7 +3657,7 @@ "Hust, hust!\n\nJa! Ich bin {Color:Green}Hagar{Color:White},\nBürgermeister dieser Stadt.\nWie bitte? \"{Color:Red}Alles über Masken{Color:White}\"?\nDas soll ich ausgeliehen haben?\nKann sein, dass ich es ausgeliehen\nhabe... Aber vielleicht auch nicht...", "Oh, du hast das {Color:Red}Buch {Color:White}gefunden.\nDas ist erfreulich!\nBestimmt haben dir meine\nMasken verraten, wo es ist!\nHaahahahaha!!!", "Als Nächstes leihe ich mir \n\"{Color:Red}Alles über Masken - Teil 2{Color:White}\" aus!", - "{Sound:01:FE}In diesem Haus wohnt ein wichtiger\nMensch: der {Color:Green}Bürgermeister{Color:White}.\nHagar heiβt er.", + "{Sound:01:FE}In diesem Haus wohnt ein wichtiger\nMensch: der {Color:Green}Bürgermeister{Color:White}.\nHagar heißt er.", "{Sound:01:F8}Der {Color:Green}Bürgermeister {Color:White}sammelt Masken\nund stellt auch selbst welche her.", "{Sound:01:FD}Der {Color:Green}Bürgermeister {Color:White}ging neulich mit einem\n{Color:Red}Buch {Color:White}unter dem Arm zum {Color:Green}Haus am See{Color:White}.\nDer Weg zum Haus am See ist jetzt\nwegen des Erdbebens versperrt.", "{Sound:01:F6}Als er zurückkam, hatte er\ndas {Color:Red}Buch {Color:White}nicht mehr dabei.\nWahrscheinlich hat er es\nim {Color:Green}Haus am See{Color:White} liegen lassen.\nDer {Color:Green}Bürgermeister {Color:White}ist oft\nunachtsam.", @@ -3668,9 +3668,9 @@ "Ich denke, dass ich\n{Color:Green}Stadt Hyrule{Color:White} gut regiere.\nIch möchte auch in Zukunft\nBürgermeister bleiben!", "Hust, hust! Das Loch im\nGarten dient als Zuflucht.\nAber sie ist nicht für\nmich alleine gemacht!\nDas darfst du nicht falsch verstehen!", "Die {Color:Green}Bücherei {Color:White}braucht mehr Bücher.\nBesonders solche über Masken!", - "Es sieht vielleicht so aus, als hätte\nich wenig zu tun, aber nein!\nSobald ihr drauβen seid, arbeite ich\nhier wie verrückt!", + "Es sieht vielleicht so aus, als hätte\nich wenig zu tun, aber nein!\nSobald ihr draußen seid, arbeite ich\nhier wie verrückt!", "In solchen Zeiten bin ich als\nBürgermeister besonders gefordert!\nIch werde {Color:Green}Stadt Hyrule{Color:White} beschützen!\nKomme, was wolle!", - "Die Monster werden vielleicht angreifen!\nKeiner darf nach drauβen!\nDu bist natürlich eine Ausnahme!\nGeh nur, {Player}!\nDein Schwert und dein Mut\nsind unsere Hoffnung!", + "Die Monster werden vielleicht angreifen!\nKeiner darf nach draußen!\nDu bist natürlich eine Ausnahme!\nGeh nur, {Player}!\nDein Schwert und dein Mut\nsind unsere Hoffnung!", "SHICYO{Symbol:1F}TEI{Symbol:1F}019", "Auf mein Ferienhaus am\n{Color:Green}Hylia-See{Color:White} bin ich sehr stolz.\nEin sehr, sehr hübsches, gemütliches\nHäuschen. Dort bastle ich Masken.", "{Sound:01:F9}Das kleine {Color:Green}Haus am See{Color:White}\nist relativ weit weg.", @@ -3688,7 +3688,7 @@ "Ah, Kindchen, bist du wieder zu mir\ngekommen, um {Color:Blue}etwas über die Minish{Color:White}...\n...{Color:Blue}zu erfahren{Color:White}? Das geheime Tor,\ndurch das die {Color:Green}Minish {Color:White}in die Welt...\n...der Menschen gelangen, öffnet sich\nnur alle 100 Jahre.\nDie {Color:Green}Minish{Color:White}, die jetzt unter uns leben,\nmüssen die Nachfahren von denen sein,\ndie vor langer Zeit zu uns gekommen\nsind.\nDieses Jahr ist genau das 100. Jahr.\nVielleicht sind neue {Color:Green}Minish {Color:White}gekommen.", "Je mehr ich über die {Color:Green}Minish {Color:White}forsche,\ndesto näher fühle ich mich ihnen.\nAls wären sie hier in der Nähe!", "Ob Monster da sind oder nicht,\nich gehe sowieso nicht aus dem Haus!", - "Kennst du den {Color:Blue}geheimen Spruch{Color:White},\nder zum {Color:Red}Schatz {Color:White}führen soll?\n{Color:Blue}Über den reiβenden Strom führt eine\nschmale Brücke...\nDann vorbei an den groβen Wesen.\nNeben einem wilden Wasserfall...\n...ist der geheime Eingang zu dem Ort,\nan dem der Schatz verborgen ist.{Color:White}\nEs soll ein {Color:Red}Werkzeug {Color:White}sein, mit dem wir\n{Color:Green}Minish {Color:White}riesige Dinge schieben können!\nDer Legende zufolge muss man {Color:Blue}von\ndiesem Haus aus losgehen{Color:White}...", + "Kennst du den {Color:Blue}geheimen Spruch{Color:White},\nder zum {Color:Red}Schatz {Color:White}führen soll?\n{Color:Blue}Über den reißenden Strom führt eine\nschmale Brücke...\nDann vorbei an den großen Wesen.\nNeben einem wilden Wasserfall...\n...ist der geheime Eingang zu dem Ort,\nan dem der Schatz verborgen ist.{Color:White}\nEs soll ein {Color:Red}Werkzeug {Color:White}sein, mit dem wir\n{Color:Green}Minish {Color:White}riesige Dinge schieben können!\nDer Legende zufolge muss man {Color:Blue}von\ndiesem Haus aus losgehen{Color:White}...", "{Sound:01:FB}Hm... Soll ich oder soll ich nicht gehen?\nStöre mich nicht! Ich denke nach!\n...Was sagst du?\nDu hast den {Color:Red}Schatz {Color:White}gefunden?!?\nDu bist mir zuvorgekommen!?!\nDas darf doch nicht wahr sein!!!", "{Sound:01:FC}Du bist unglaublich mutig!\nRespekt!", "{Sound:01:FD}Du hast den {Color:Red}Schatz {Color:White}gefunden?\nEin tolles Werkzeug, nicht wahr? {Symbol:0B}", @@ -3702,9 +3702,9 @@ "Unser Hund ist sehr schlau.\nUnd vielleicht ein bisschen verwöhnt...", "{Color:Green}Magmiez {Color:White}von nebenan ist schon weg.\nAber morgen sehe ich sie wieder! {Symbol:0B}", "Meine Schwester ist wieder da.\nEs ist besser, zu Hause zu bleiben.", - "Aua! Das ist heiβ! Wau!\n{Color:Blue}Der Kamin ist zu heiβ{Color:White}!\nMein Herrchen ist bei seiner\nLiebsten nebenan...\nAber wenn der Kamin aus ist,\nkommen manchmal Mäuse heraus.\nUnd das ist ein Problem, denn\nich mag keine Mäuse!", - "Heiβ! Wau!\n{Color:Blue}Der Kamin ist so heiβ{Color:White}...\nWeil mehr Menschen da sind, ist es\nnoch heiβer. Ich brauche Abkühlung!", - "Danke! Wau! Du hast das\nFeuer im Kamin ausgemacht.\nUnd mein Herrchen, also wirklich!\nFlirtet ständig mit der von nebenan.\nEr liebt sie heiβ und innig.", + "Aua! Das ist heiß! Wau!\n{Color:Blue}Der Kamin ist zu heiß{Color:White}!\nMein Herrchen ist bei seiner\nLiebsten nebenan...\nAber wenn der Kamin aus ist,\nkommen manchmal Mäuse heraus.\nUnd das ist ein Problem, denn\nich mag keine Mäuse!", + "Heiß! Wau!\n{Color:Blue}Der Kamin ist so heiß{Color:White}...\nWeil mehr Menschen da sind, ist es\nnoch heißer. Ich brauche Abkühlung!", + "Danke! Wau! Du hast das\nFeuer im Kamin ausgemacht.\nUnd mein Herrchen, also wirklich!\nFlirtet ständig mit der von nebenan.\nEr liebt sie heiß und innig.", "Wie? Das {Color:Red}Buch {Color:White}aus der {Color:Green}Bücherei{Color:White}?\n\"{Color:Red}Bilderlexikon der Tierwelt{Color:White}\"?\nJa, das habe ich ausgeliehen.\nBist du extra deswegen hier?\nDas ist aber nett. Kannst du es\nfür mich aus meinem {Color:Green}Haus {Color:White}holen?\nIch kann hier jetzt nicht weg.", "Der {Color:Green}König {Color:White}soll sich verändert haben.\nAn unserer Liebe ändert das nichts.", "", @@ -3765,13 +3765,13 @@ "Stärke dich bei uns!\nHihihi...", "Ein Moment der Ruhe...\n\nEin Kaffee und es geht mir fabelhaft.", "Heute trinke ich aber\nkeinen Kaffee.", - "Der {Color:Green}König {Color:White}hat den Soldaten befohlen,\ndas {Color:Red}Force {Color:White}zu suchen.\nDas {Color:Red}Force {Color:White}erfüllt alle Wünsche, heiβt\nes. Aber ich glaube nicht daran.", + "Der {Color:Green}König {Color:White}hat den Soldaten befohlen,\ndas {Color:Red}Force {Color:White}zu suchen.\nDas {Color:Red}Force {Color:White}erfüllt alle Wünsche, heißt\nes. Aber ich glaube nicht daran.", "Ich bin immer sehr gut informiert.", "Ein Prosit! Ein Prosit!\nEin Prosit mit Milch!\nMeinst du, dass ich heute\netwas anderes kochen sollte...\n...als gestern?", "Meinst du, dass ich heute\netwas anderes kochen sollte...\n...als gestern?", "Dieses Café ist so lebendig! Man hört\ndie unterschiedlichsten Geschichten.", "Genau der richtige Ort für uns.", - "Lass bloβ keinen auf uns drauf treten!", + "Lass bloß keinen auf uns drauf treten!", "Erwachsene Menschen können uns\n{Color:Green}Minish {Color:White}nicht sehen.", "Alle entspannen sich.\nDas ist gut so.\nEntspannen und nochmals entspannen!\nSo muss ein Café sein.", "Entspannen und nochmals entspannen!\nSo muss ein Café sein.", @@ -3802,7 +3802,7 @@ "Guten Tag!\nDa bist du ja wieder.", "Du bist richtig stattlich geworden!\nHihihi...", "Es gibt einen Grund, warum ich nicht\nstehen kann.\nWas sagst du dazu?", - "Was ist wahr? Wenn du das weiβt,\nübertrifft die Wahrheit die Zeit.", + "Was ist wahr? Wenn du das weißt,\nübertrifft die Wahrheit die Zeit.", "Die {Color:Green}Quelle {Color:White}- ist doch klar! Der Fluss in\nder {Color:Green}Stadt {Color:White}und der am {Color:Green}See {Color:White}haben den...\n...gleichen Ursprung. Gehe einfach\nflussaufwärts! Hohoho...", "Wenn du zur {Color:Green}Quelle {Color:White}willst, solltest du\ndich gut vorbereiten! Hohoho...", "Ein Prosit! Ein Prosit!\nEin Prosit mit Milch!\nBraucht man überhaupt Abendessen?", @@ -3838,9 +3838,9 @@ "Im {Color:Green}Tyloria-Wald{Color:White} kann man mit\neiner Wand {Color:Blue}Fragmente vereinen{Color:White}.\nUnd es gibt weitere Wände dieser Art,\ndie man ausgraben muss.", "Kennst du die {Color:Green}Goronen-Höhle{Color:White}?\nDie Höhle, in der die {Color:Green}Goronen {Color:White}buddeln.\nDu solltest mal in der Höhle\n{Color:Blue}Fragmente vereinen{Color:White}...\nAch, probier es einfach!", "Mit dem {Color:Green}Gespenst {Color:White}im {Color:Green}Grab der\nKönigsfamilie{Color:White} soll man...\n{Color:Blue}Fragmente vereinen{Color:White} können.\nMir ist das ja zu gruselig...", - "Im Leben geht es nicht immer nur\nvorwärts. Man muss auch mal...\n...zurückgehen. Und auβerdem:\nImmer schön {Color:Blue}Fragmente vereinen{Color:White}!", + "Im Leben geht es nicht immer nur\nvorwärts. Man muss auch mal...\n...zurückgehen. Und außerdem:\nImmer schön {Color:Blue}Fragmente vereinen{Color:White}!", "Beim {Color:Blue}Fragmente vereinen{Color:White} erhält\nman nicht nur {Color:Red}Rubine{Color:White}.\nManchmal erscheint jemand.\nManchmal verändert sich die Stadt.\nDas Glück kann auch auf diese\nWeise zu dir kommen.", - "Macht dir {Color:Blue}Fragmente vereinen\n{Color:White}Spaβ?\n{Color:Blue}Fragmente vereinen{Color:White} bringt dir\nund deinem Gegenüber Glück!\nIch glaube fest daran!", + "Macht dir {Color:Blue}Fragmente vereinen\n{Color:White}Spaß?\n{Color:Blue}Fragmente vereinen{Color:White} bringt dir\nund deinem Gegenüber Glück!\nIch glaube fest daran!", "Wenn du alle Fragmente vereint hast,\ndie es gibt, wirst du reich belohnt!", "{Color:Green}Schloss Hyrule{Color:White} ist dunkel... Ist es\nzu spät zum {Color:Blue}Fragmente vereinen{Color:White}?", "...Aber! Wir sollten gerade jetzt\n{Color:Blue}Fragmente vereinen{Color:White}, um den...\n...Menschen Glück zu bringen...", @@ -3852,4 +3852,4 @@ "", "" ] -] \ No newline at end of file +]