diff --git a/asm/macros/scripts.inc b/asm/macros/scripts.inc index eabc99cb..7d0ba66a 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/InitSaveHeader.inc b/asm/non_matching/InitSaveHeader.inc deleted file mode 100644 index c8b17b63..00000000 --- a/asm/non_matching/InitSaveHeader.inc +++ /dev/null @@ -1,59 +0,0 @@ - .syntax unified - push {r4, lr} - bl CheckHeaderValid - cmp r0, #0 - bne _080560F8 - movs r0, #0x80 - lsls r0, r0, #0x12 - bl ReadSaveHeader - adds r1, r0, #0 - movs r0, #1 - rsbs r0, r0, #0 - cmp r1, r0 - blt _080560E4 - cmp r1, #0 - ble _080560E4 - cmp r1, #1 - bne _080560E4 - bl CheckHeaderValid - cmp r0, #0 - bne _080560F8 -_080560E4: - ldr r0, _08056128 @ =sDefaultSettings - movs r4, #0x80 - lsls r4, r4, #0x12 - adds r1, r4, #0 - movs r2, #0x10 - bl MemCopy - adds r0, r4, #0 - bl WriteSaveHeader -_080560F8: - ldr r2, _0805612C @ =gUnk_02000010 - ldr r1, [r2] - ldr r0, _08056130 @ =0x4D435A33 - eors r1, r0 - rsbs r0, r1, #0 - orrs r0, r1 - lsrs r0, r0, #0x1f - ldrb r1, [r2, #4] - cmp r1, #0 - beq _08056112 - cmp r1, #0xc1 - beq _08056112 - movs r0, #1 -_08056112: - cmp r0, #0 - beq _08056124 - ldr r4, _0805612C @ =gUnk_02000010 - adds r0, r4, #0 - movs r1, #0x20 - bl MemClear - ldr r0, _08056130 @ =0x4D435A33 - str r0, [r4] -_08056124: - pop {r4, pc} - .align 2, 0 -_08056128: .4byte sDefaultSettings -_0805612C: .4byte gUnk_02000010 -_08056130: .4byte 0x4D435A33 - .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 e7e7effd..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 GetTileType - 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 GetTileType - 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 GetTileType - 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 GetTileType - 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/ClearBit.inc b/asm/non_matching/common/ClearBit.inc deleted file mode 100644 index 0d34ceb5..00000000 --- a/asm/non_matching/common/ClearBit.inc +++ /dev/null @@ -1,14 +0,0 @@ - .syntax unified - lsrs r2, r1, #3 - adds r3, r0, r2 - movs r2, #7 - ands r1, r2 - movs r2, #1 - lsls r2, r1 - ldrb r0, [r3] - adds r1, r0, #0 - bics r1, r2 - strb r1, [r3] - ands r0, r2 - bx lr - .syntax divided diff --git a/asm/non_matching/common/WriteBit.inc b/asm/non_matching/common/WriteBit.inc deleted file mode 100644 index 7986e488..00000000 --- a/asm/non_matching/common/WriteBit.inc +++ /dev/null @@ -1,14 +0,0 @@ - .syntax unified - lsrs r2, r1, #3 - adds r3, r0, r2 - movs r2, #7 - ands r1, r2 - movs r2, #1 - lsls r2, r1 - ldrb r0, [r3] - adds r1, r0, #0 - orrs r1, r2 - strb r1, [r3] - ands r0, r2 - bx lr - .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 09315195..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 @ =gUnk_0200AF00 - 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 gUnk_0200AF00 -_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/kid/sub_080622F4.inc b/asm/non_matching/kid/sub_080622F4.inc deleted file mode 100644 index 66a11664..00000000 --- a/asm/non_matching/kid/sub_080622F4.inc +++ /dev/null @@ -1,274 +0,0 @@ - .syntax unified - .text - - push {r4, r5, r6, r7, lr} - mov r7, sb - mov r6, r8 - push {r6, r7} - adds r7, r0, #0 - ldr r0, _0806239C @ =gPlayerEntity - mov r8, r0 - ldrh r1, [r0, #0x2e] - ldr r3, _080623A0 @ =0xFFFF0000 - adds r0, r3, #0 - ands r0, r5 - orrs r0, r1 - mov r2, r8 - ldrh r1, [r2, #0x32] - lsls r1, r1, #0x10 - ldr r2, _080623A4 @ =0x0000FFFF - ands r0, r2 - adds r5, r0, #0 - orrs r5, r1 - mov r1, r8 - ldrh r0, [r1, #0x36] - ands r3, r6 - orrs r3, r0 - ldr r0, _080623A8 @ =gPlayerState - adds r0, #0xa8 - ldrb r0, [r0] - lsls r0, r0, #0x10 - ldr r2, _080623AC @ =0xFF00FFFF - ands r2, r3 - orrs r2, r0 - ldrb r1, [r1, #0x14] - movs r0, #0x3f - ands r1, r0 - lsls r1, r1, #0x18 - ldr r0, _080623B0 @ =0xC0FFFFFF - ands r0, r2 - orrs r0, r1 - mov r1, r8 - adds r1, #0x38 - ldrb r1, [r1] - lsls r1, r1, #0x1e - ldr r2, _080623B4 @ =0x3FFFFFFF - ands r0, r2 - adds r6, r0, #0 - orrs r6, r1 - ldr r4, [r7, #0x64] - ldrb r0, [r4, #6] - cmp r0, #0x16 - bne _080623BE - lsrs r0, r6, #0x10 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0x16 - beq _080623BE - movs r2, #0x2e - ldrsh r1, [r7, r2] - mov r3, r8 - movs r2, #0x2e - ldrsh r0, [r3, r2] - subs r2, r1, r0 - movs r0, #0x32 - ldrsh r3, [r7, r0] - mov sb, r3 - mov r1, r8 - movs r3, #0x32 - ldrsh r0, [r1, r3] - mov r3, sb - subs r1, r3, r0 - cmp r2, #0 - bge _08062382 - rsbs r2, r2, #0 -_08062382: - cmp r1, #0 - bge _08062388 - rsbs r1, r1, #0 -_08062388: - cmp r2, #0x78 - bgt _08062390 - cmp r1, #0x50 - ble _080623B8 -_08062390: - adds r1, r7, #0 - adds r1, #0x68 - movs r0, #0 - strb r0, [r1] - b _080624F8 - .align 2, 0 -_0806239C: .4byte gPlayerEntity -_080623A0: .4byte 0xFFFF0000 -_080623A4: .4byte 0x0000FFFF -_080623A8: .4byte gPlayerState -_080623AC: .4byte 0xFF00FFFF -_080623B0: .4byte 0xC0FFFFFF -_080623B4: .4byte 0x3FFFFFFF -_080623B8: - adds r0, r7, #0 - bl sub_0806252C -_080623BE: - movs r0, #0 - mov sb, r0 - ldr r0, [r4] - cmp r5, r0 - bne _080623CE - ldr r0, [r4, #4] - cmp r6, r0 - beq _08062410 -_080623CE: - ldr r4, [r7, #0x64] - adds r4, #0x90 - movs r1, #0x69 - adds r1, r1, r7 - mov r8, r1 - adds r3, r7, #0 - adds r3, #0x38 - movs r2, #0x58 - adds r2, r2, r7 - mov ip, r2 - movs r2, #0x12 -_080623E4: - ldr r0, [r4] - ldr r1, [r4, #4] - str r0, [r4, #8] - str r1, [r4, #0xc] - subs r4, #8 - subs r2, #1 - cmp r2, #0 - bge _080623E4 - ldr r4, [r7, #0x64] - str r5, [r4] - str r6, [r4, #4] - movs r0, #4 - mov sb, r0 - mov r2, r8 - ldrb r1, [r2] - movs r0, #0 - ldrsb r0, [r2, r0] - cmp r0, #0 - ble _08062484 - subs r0, r1, #1 - strb r0, [r2] - b _08062484 -_08062410: - adds r4, #0x98 - movs r3, #4 - ldrsh r0, [r4, r3] - cmp r0, #0 - bge _08062442 - ldr r4, [r7, #0x64] - adds r4, #0x90 - movs r0, #0x69 - adds r0, r0, r7 - mov r8, r0 - adds r3, r7, #0 - adds r3, #0x38 - movs r1, #0x58 - adds r1, r1, r7 - mov ip, r1 - movs r2, #0x12 -_08062430: - ldr r0, [r4] - ldr r1, [r4, #4] - str r0, [r4, #8] - str r1, [r4, #0xc] - subs r4, #8 - subs r2, #1 - cmp r2, #0 - bge _08062430 - b _08062480 -_08062442: - ldr r1, _080624E8 @ =gPlayerEntity - movs r3, #0x2e - ldrsh r0, [r1, r3] - movs r2, #0x32 - ldrsh r1, [r1, r2] - ldrh r2, [r4] - ldrh r3, [r4, #2] - bl sub_080041E8 - lsrs r0, r0, #4 - movs r3, #0x69 - adds r3, r3, r7 - mov r8, r3 - adds r3, r7, #0 - adds r3, #0x38 - movs r1, #0x58 - adds r1, r1, r7 - mov ip, r1 - cmp r0, #0x18 - ble _08062484 - ldr r4, [r7, #0x64] - adds r4, #0x90 - movs r2, #0x12 -_08062470: - ldr r0, [r4] - ldr r1, [r4, #4] - str r0, [r4, #8] - str r1, [r4, #0xc] - subs r4, #8 - subs r2, #1 - cmp r2, #0 - bge _08062470 -_08062480: - movs r2, #4 - mov sb, r2 -_08062484: - ldr r4, [r7, #0x64] - adds r4, #0x98 - ldrh r0, [r4] - strh r0, [r7, #0x2e] - ldrh r0, [r4, #2] - strh r0, [r7, #0x32] - ldrh r0, [r4, #4] - strh r0, [r7, #0x36] - ldrb r0, [r4, #7] - lsls r0, r0, #0x1a - lsrs r0, r0, #0x1a - strb r0, [r7, #0x14] - ldrb r0, [r4, #7] - lsrs r0, r0, #6 - strb r0, [r3] - mov r1, r8 - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - ble _080624B2 - subs r0, r2, #1 - strb r0, [r1] -_080624B2: - mov r2, sb - ldrb r0, [r7, #0x14] - lsrs r0, r0, #1 - add sb, r0 - ldrb r0, [r7, #0xa] - cmp r0, #6 - bne _080624C4 - movs r3, #0x10 - add sb, r3 -_080624C4: - mov r0, ip - ldrb r0, [r0] - cmp sb, r0 - beq _080624EC - cmp r2, #0 - bne _080624D8 - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bgt _080624EC -_080624D8: - adds r0, r7, #0 - mov r1, sb - bl InitAnimationForceUpdate - movs r0, #0x1e - mov r1, r8 - strb r0, [r1] - b _080624F2 - .align 2, 0 -_080624E8: .4byte gPlayerEntity -_080624EC: - adds r0, r7, #0 - bl UpdateAnimationSingleFrame -_080624F2: - adds r0, r7, #0 - bl sub_0800451C -_080624F8: - pop {r3, r4} - mov r8, r3 - mov sb, r4 - 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 bb9a4674..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 sub_080B1B0C - 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 b777afc9..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 sub_080B1B44 - cmp r0, #0 - beq _0807A3FC - lsls r0, r4, #0x10 - lsrs r0, r0, #0x10 - mov r1, sl - adds r1, #0x38 - ldrb r1, [r1] - bl sub_080B1AE0 - 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 sub_08007DD6 - 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 sub_080B1B44 - cmp r0, #0 - beq _0807A44C - lsls r0, r4, #0x10 - lsrs r0, r0, #0x10 - adds r1, r5, #0 - adds r1, #0x38 - ldrb r1, [r1] - bl sub_080B1AE0 - 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 sub_08007DD6 - 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 sub_080B1B44 - 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 sub_080B1B44 - 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 sub_080B1B44 - 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 f53eb74d..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 sub_080197D4 -_0807C01C: - ldr r0, [r4] - ldr r0, [r0, #0x10] - bl sub_080197D4 - 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/pushableFurniture/sub_08090094.inc b/asm/non_matching/pushableFurniture/sub_08090094.inc deleted file mode 100644 index 2662f442..00000000 --- a/asm/non_matching/pushableFurniture/sub_08090094.inc +++ /dev/null @@ -1,201 +0,0 @@ - .syntax unified - push {r4, r5, r6, r7, lr} - adds r6, r0, #0 - adds r5, r1, #0 - adds r7, r2, #0 - adds r0, r7, #0 - movs r1, #1 - bl sub_080B1B44 - adds r4, r0, #0 - adds r0, r7, #0 - movs r1, #1 - bl GetTileIndex - adds r3, r0, #0 - movs r0, #0x80 - lsls r0, r0, #7 - ands r0, r3 - cmp r0, #0 - bne _0809012C - adds r3, r5, #0 - ldr r1, _080900D0 @ =0xFFFFBFDC - adds r0, r3, r1 - cmp r0, #0xb - bhi _0809011A - lsls r0, r0, #2 - ldr r1, _080900D4 @ =_080900D8 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_080900D0: .4byte 0xFFFFBFDC -_080900D4: .4byte _080900D8 -_080900D8: @ jump table - .4byte _08090114 @ case 0 - .4byte _08090108 @ case 1 - .4byte _0809011A @ case 2 - .4byte _0809011A @ case 3 - .4byte _0809011A @ case 4 - .4byte _0809011A @ case 5 - .4byte _0809011A @ case 6 - .4byte _0809011A @ case 7 - .4byte _08090114 @ case 8 - .4byte _0809010E @ case 9 - .4byte _08090114 @ case 10 - .4byte _0809010E @ case 11 -_08090108: - cmp r4, #5 - bne _0809011A - b _08090118 -_0809010E: - cmp r4, #5 - bne _0809011A - b _08090118 -_08090114: - cmp r4, #0xa - bne _0809011A -_08090118: - ldr r3, _08090128 @ =0x00004022 -_0809011A: - adds r0, r3, #0 - adds r1, r7, #0 - movs r2, #1 - bl SetTile - b _08090242 - .align 2, 0 -_08090128: .4byte 0x00004022 -_0809012C: - ldr r1, _08090140 @ =0xFFFFBFDE - adds r0, r3, r1 - cmp r0, #0xd - bls _08090136 - b _08090242 -_08090136: - lsls r0, r0, #2 - ldr r1, _08090144 @ =_08090148 - adds r0, r0, r1 - ldr r0, [r0] - mov pc, r0 - .align 2, 0 -_08090140: .4byte 0xFFFFBFDE -_08090144: .4byte _08090148 -_08090148: @ jump table - .4byte _08090242 @ case 0 - .4byte _08090242 @ case 1 - .4byte _080901EC @ case 2 - .4byte _08090180 @ case 3 - .4byte _08090242 @ case 4 - .4byte _08090242 @ case 5 - .4byte _08090242 @ case 6 - .4byte _08090242 @ case 7 - .4byte _08090242 @ case 8 - .4byte _08090242 @ case 9 - .4byte _08090210 @ case 10 - .4byte _080901B4 @ case 11 - .4byte _08090210 @ case 12 - .4byte _080901B4 @ case 13 -_08090180: - ldr r0, _080901A8 @ =0x00004024 - cmp r5, r0 - bne _08090194 - ldr r3, _080901AC @ =0x00004022 - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x10 - orrs r0, r1 - strb r0, [r2] -_08090194: - ldr r0, _080901B0 @ =0x0000402C - cmp r5, r0 - bne _08090238 - ldr r3, _080901AC @ =0x00004022 - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x10 - b _08090234 - .align 2, 0 -_080901A8: .4byte 0x00004024 -_080901AC: .4byte 0x00004022 -_080901B0: .4byte 0x0000402C -_080901B4: - ldr r0, _080901DC @ =0x0000402C - cmp r5, r0 - bne _080901C8 - ldr r3, _080901E0 @ =0x0000402B - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x10 - orrs r0, r1 - strb r0, [r2] -_080901C8: - ldr r0, _080901E4 @ =0x00004024 - cmp r5, r0 - bne _08090238 - ldr r3, _080901E8 @ =0x00004022 - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x10 - b _08090234 - .align 2, 0 -_080901DC: .4byte 0x0000402C -_080901E0: .4byte 0x0000402B -_080901E4: .4byte 0x00004024 -_080901E8: .4byte 0x00004022 -_080901EC: - ldr r0, _08090204 @ =0x00004025 - cmp r5, r0 - bne _08090200 - ldr r3, _08090208 @ =0x00004022 - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x20 - orrs r0, r1 - strb r0, [r2] -_08090200: - ldr r0, _0809020C @ =0x0000402D - b _08090226 - .align 2, 0 -_08090204: .4byte 0x00004025 -_08090208: .4byte 0x00004022 -_0809020C: .4byte 0x0000402D -_08090210: - ldr r0, _08090244 @ =0x0000402D - cmp r5, r0 - bne _08090224 - ldr r3, _08090248 @ =0x0000402B - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x20 - orrs r0, r1 - strb r0, [r2] -_08090224: - ldr r0, _0809024C @ =0x00004025 -_08090226: - cmp r5, r0 - bne _08090238 - ldr r3, _08090250 @ =0x00004022 - adds r2, r6, #0 - adds r2, #0x83 - ldrb r1, [r2] - movs r0, #0x20 -_08090234: - orrs r0, r1 - strb r0, [r2] -_08090238: - adds r0, r3, #0 - adds r1, r7, #0 - movs r2, #1 - bl SetTile -_08090242: - pop {r4, r5, r6, r7, pc} - .align 2, 0 -_08090244: .4byte 0x0000402D -_08090248: .4byte 0x0000402B -_0809024C: .4byte 0x00004025 -_08090250: .4byte 0x00004022 - .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 6998684b..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 sub_080045DA - 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 sub_080045DA - 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 sub_080045DA - 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 ae44f992..d66c23e9 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -21809,11 +21809,6 @@ "size": 4, "type": "animation" }, - { - "path": "evilSpirit/gUnk_08120678.bin", - "start": 1181304, - "size": 10 - }, { "path": "animations/gSpriteAnimations_EvilSpirit_0.bin", "start": 1181314, @@ -22883,19 +22878,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" @@ -26063,4 +26058,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/cloudTops/script_Npc4EFirstCloud.inc b/data/scripts/cloudTops/script_Npc4EFirstCloud.inc index 76d025fa..3ed822d7 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 aea96906..423e3ed9 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 _0807EDD4 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_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/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/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/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 70f9b944..7ffcc08a 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/include/area.h b/include/area.h index ce25c8df..a21ee5b0 100644 --- a/include/area.h +++ b/include/area.h @@ -6,6 +6,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 1f15a0ea..391ba768 100644 --- a/include/asm.h +++ b/include/asm.h @@ -19,7 +19,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 011e5a8a..871e5f05 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/functions.h b/include/functions.h index 0e7b79f8..a770563b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -98,7 +98,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 9b3557ce..3cd7c1d0 100644 --- a/include/global.h +++ b/include/global.h @@ -145,4 +145,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 ac6b9b83..c5b63874 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 9afd0f9e..36b6e594 100644 --- a/include/physics.h +++ b/include/physics.h @@ -25,7 +25,6 @@ bool32 EntityWithinDistance(Entity*, s32, s32, s32); 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 eb347479..49a4bce7 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,6 +209,7 @@ typedef enum { SURFACE_AUTO_LADDER, SURFACE_CLIMB_WALL, SURFACE_2C, + SURFACE_FF = 0xff, } SurfaceType; typedef enum { @@ -274,6 +283,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; @@ -303,7 +480,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 */ @@ -353,20 +531,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/room.h b/include/room.h index 57999ae2..a23dff14 100644 --- a/include/room.h +++ b/include/room.h @@ -133,7 +133,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; @@ -142,7 +142,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); @@ -155,8 +155,20 @@ typedef struct { /* 0x0a */ u16 stairs_idx; // seems to be a tile type /* 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; diff --git a/include/save.h b/include/save.h index aa206fe5..bc966efc 100644 --- a/include/save.h +++ b/include/save.h @@ -28,51 +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. */ - /*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 c6e41f17..4fbb2eef 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 sub_0807DEDC(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 9915face..1d3cac90 100644 --- a/include/tiles.h +++ b/include/tiles.h @@ -8,6 +8,15 @@ typedef enum { CUT_TREE = 0x1F, ROCK = 0x55, CHEST = 0x73, + CHEST_OPEN = 0x74, + TORCH = 0x76, + TORCH_LIT = 0x77, + PRESSURE_BUTTON = 0x78, + PRESSURE_BUTTON_PRESSED = 0x79, + PRESSURE_SQUARE = 0x7a, + PRESSURE_SQUARE_PRESSED = 0x7b, + STAIRS_UP = 0x92, + STAIRS_DOWN = 0x93, SIGNPOST = 0x176, PERMA_ROCK = 0x1D3, PERMA_ROCK2 = 0x1D4, 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 479e7328..dbfc5c3c 100644 --- a/linker.ld +++ b/linker.ld @@ -630,7 +630,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); @@ -706,7 +706,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); @@ -1390,7 +1390,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); @@ -1487,8 +1487,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 f1f85a4a..3d425817 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 (sub_080B1B44(position, gPlayerEntity.collisionLayer) != 0xf) { @@ -305,10 +306,10 @@ u32 UpdatePlayerCollision(void) { case 0x3a: case 0x5b: case 0x4051: - if ((gPlayerState.flags & PL_MINISH) != 0) { + if (gPlayerState.flags & PL_MINISH) { return 0; } - if (gPlayerEntity.animationState != 0) { + if (gPlayerEntity.animationState != IdleNorth) { return 0; } gUnk_0200AF00.rActionInteractTile = R_ACTION_READ; @@ -356,7 +357,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) { @@ -415,7 +417,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) { @@ -555,7 +557,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) { @@ -574,7 +576,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) { @@ -595,7 +597,8 @@ bool32 sub_0801A2B0(LayerStruct* layer, 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 = sub_080B1B54(GetTileType(position, gPlayerEntity.collisionLayer)); switch (temp4) { @@ -712,18 +715,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) { @@ -733,7 +736,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) { + LayerStruct* 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 = GetTileType(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 = GetTileType(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 = GetTileType(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 = GetTileType(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; @@ -1024,7 +1185,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) { @@ -1061,7 +1222,7 @@ void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer) { // Add a new entry at the end of gUnk_0200B240 void sub_0801AF48(u32 data, u32 position, u32 layer) { u32 index; - if ((data < 0x4000) && (gRoomTransition.field_0x2c[3] == 0)) { + if ((data < 0x4000) && (gRoomTransition.field30 == 0)) { index = gRoomVars.unk_0e; if (index < 0x100) { gUnk_0200B240[index].data = data; diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c index c3a7bdbd..1a040933 100644 --- a/src/code_0805EC04.c +++ b/src/code_0805EC04.c @@ -77,42 +77,36 @@ 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) { - 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) + (u8*)playerMacro += ((s16)playerMacro->keys); + else { + if (flags == 3) { + playerInput->playerMacroWaiting = 0; + playerInput->playerMacroHeldKeys = 0; + playerMacro = NULL; + playerInput->playerMacro = playerMacro; + break; + } else { + if (flags != 2) { + playerInput->playerMacroWaiting = playerMacro->flags; + playerInput->playerMacroHeldKeys = playerMacro->keys; + } + playerMacro++; + playerInput->playerMacro = playerMacro; + break; + } } - (u8*)playerMacro += ((s16)playerMacro->keys); - } while (TRUE); - if (flags == 3) { - playerInput->playerMacroWaiting = zero; - playerInput->playerMacroHeldKeys = zero; - playerMacro = NULL; - playerInput->playerMacro = playerMacro; - } else { - goto code_0; - } + } while (TRUE); } - code_4: playerInput->playerMacroWaiting--; keys = playerInput->playerMacroHeldKeys; } else { @@ -183,7 +177,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 78cb5a11..1f725095 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); @@ -162,7 +162,7 @@ u32 FindFreeObjPalette(u32 paletteCount) { void SetEntityObjPalette(Entity* entity, s32 palette) { u32 uVar1; u32 mask; - FORCE_REGISTER(u32 tmp, r1); + u32 tmp; Palette2* pPVar1; if (palette < 0) { diff --git a/src/common.c b/src/common.c index 1aa305df..81cec6d1 100644 --- a/src/common.c +++ b/src/common.c @@ -25,10 +25,11 @@ typedef struct { extern u8 gUnk_03003DE0; extern u8 gzHeap[0x1000]; +extern u8 gUnk_02035542[]; extern u32 gUnk_0201AEE0[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); @@ -84,6 +85,7 @@ bool32 IsRoomVisited(TileEntity* tileEntity, u32 bank); u32 sub_0801DF60(u32 a1, u8* p); u32 sub_0801DF78(u32 a1, u32 a2); void sub_0801DF28(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); @@ -347,7 +349,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; + + heapStartOffset = (u16*)(gzHeap); + numEntries = heapStartOffset[0]; + slotFound = TRUE; + + // 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++) { + + // 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; @@ -619,69 +720,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); } @@ -790,46 +893,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; - register s32 tmp asm("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) { @@ -837,13 +1053,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) { @@ -862,17 +1078,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; } } } @@ -880,12 +1096,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; } } @@ -894,92 +1110,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; @@ -1047,7 +1221,7 @@ void UpdateVisibleFusionMapMarkers(void) { #else if (sub_0807CB24(tmp, s->flag)) { #endif - WriteBit(&gSave.fusionUnmarked, kinstoneId); + WriteBit(&gSave.kinstones.fusionUnmarked, kinstoneId); } } } @@ -1068,8 +1242,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) { @@ -1100,8 +1274,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) { @@ -1118,11 +1292,11 @@ const struct_080C9C6C gUnk_080C9C6C[] = { { 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 eb2af238..46662008 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -461,7 +461,7 @@ void AcroBandit_Type1Action4(AcroBanditEntity* this) { } } - if (super->direction & 0xf) + if (super->direction & (0x3 | DirectionEast | DIR_DIAGONAL)) super->spriteSettings.flipX = (super->direction >> 4 ^ 1); ProcessMovement0(super); @@ -502,7 +502,7 @@ void AcroBandit_Type1Action6(AcroBanditEntity* this) { super->action = 7; dir = fallDirections[this->unk_74.HALF.LO * 5 + super->type2]; super->direction = dir; - if (dir >= 0x10) { + if (dir >= DirectionSouth) { super->spriteSettings.flipX = 1; } else { super->spriteSettings.flipX = 0; @@ -586,7 +586,7 @@ static void sub_080322E8(AcroBanditEntity* this) { } } else { u8 tmp = super->direction; - if (tmp & 0xF) { + if (tmp & (0x3 | DirectionEast | DIR_DIAGONAL)) { tmp >>= 4; tmp ^= 1; if (tmp != super->spriteSettings.flipX) { diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index f6650533..c567978f 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -112,7 +112,8 @@ void sub_080218CC(BeetleEntity* this) { if (super->subAction == 0) { super->subAction = 1; super->spriteSettings.draw = 1; - super->direction = ((sub_08049F84(super, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; + super->direction = ((sub_08049F84(super, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); super->speed = 0x100; super->zVelocity = Q_16_16(1.125); } @@ -251,9 +252,9 @@ void sub_08021B64(BeetleEntity* this) { super->zVelocity = Q_16_16(1.0); this->unk_87 = 0; if (gPlayerEntity.direction != 0xff) { - super->direction = 0x10 ^ gPlayerEntity.direction; + super->direction = DirectionSouth ^ gPlayerEntity.direction; } else { - super->direction = (gPlayerEntity.animationState << 2) ^ 0x10; + super->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth; } InitializeAnimation(super, 5); } else { diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 1f178dfa..4d89bc1b 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -16,18 +16,20 @@ typedef struct { /*0x74*/ u16 unk_74; } BladeTrapEntity; +#define DIR_NOT_MOVING_CHECK 0x80 + void BladeTrap(BladeTrapEntity* this) { if (super->action == 0) { super->action = 1; super->child = GetCurrentRoomProperty(super->type); UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); } - if (!(super->direction & 0x80)) { + if (!(super->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(super); } if (!(--this->unk_74)) { - if (!(super->direction & 0x80)) { + if (!(super->direction & DIR_NOT_MOVING_CHECK)) { EnqueueSFX(SFX_METAL_CLINK); } UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 1a35c1f4..e1c9b43b 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -71,7 +71,7 @@ void Bobomb_OnCollision(BobombEntity* this) { super->zVelocity = Q_16_16(1.5); super->speed = 0; this->unk_81 = 1; - InitializeAnimation(super, super->direction >> 4 | 6); + InitializeAnimation(super, super->direction >> 4 | IdleWest); break; } } @@ -132,7 +132,7 @@ void sub_0802C83C(BobombEntity* this) { } else { this->unk_82 = 2; super->timer = 120; - InitializeAnimation(super, (super->direction >> 4) | 6); + InitializeAnimation(super, (super->direction >> 4) | IdleWest); COLLISION_OFF(super); super->hitType = 0x6e; } @@ -156,7 +156,7 @@ void sub_0802C8D8(BobombEntity* this) { super->action = 1; super->timer = 60; super->subtimer = 0; - super->direction = (Random() & 0x18) | 4; + super->direction = (Random() & 0x18) | DIR_DIAGONAL; super->carryFlags = 0; super->gustJarFlags = 0x12; this->unk_82 = 0; @@ -172,7 +172,7 @@ void sub_0802C91C(BobombEntity* this) { if (this->unk_82) { if (super->collisions != COL_NONE) { sub_0800417E(super, super->collisions); - InitializeAnimation(super, (super->direction >> 4) | 2); + InitializeAnimation(super, (super->direction >> 4) | IdleEast); } if (--super->timer == 0) { sub_0802CBC4(this); @@ -189,7 +189,7 @@ void sub_0802C91C(BobombEntity* this) { } if (--super->timer == 0) { super->timer = 60; - super->direction = (super->direction + 8) & 0x1c; + super->direction = (super->direction + 8) & (DirectionWest | DIR_DIAGONAL); InitializeAnimation(super, super->direction >> 4); } } @@ -205,7 +205,7 @@ void sub_0802C9D0(BobombEntity* this) { super->spritePriority.b1 = 0; this->unk_83 = 1; sub_0802CC18(this); - InitializeAnimation(super, (super->direction >> 4) | 6); + InitializeAnimation(super, (super->direction >> 4) | IdleWest); GetNextFrame(super); } @@ -219,7 +219,7 @@ void sub_0802CA10(BobombEntity* this) { } } else { this->unk_83 = 2; - super->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c; + super->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest); sub_0802CC18(this); GetNextFrame(super); } @@ -243,8 +243,8 @@ void sub_0802CA94(BobombEntity* this) { super->speed = 0; this->unk_83 = 0; this->unk_81 = 0; - super->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c; - InitializeAnimation(super, (super->direction >> 4) | 6); + super->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL); + InitializeAnimation(super, (super->direction >> 4) | IdleWest); } void sub_0802CAF8(BobombEntity* this) { @@ -273,7 +273,7 @@ void sub_0802CB68(BobombEntity* this) { super->action = 1; super->subAction = 0; super->direction = Random() & 0x18; - super->direction |= 4; + super->direction |= IdleSouth; COLLISION_ON(super); if (this->unk_82) { super->timer = 200; diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 63a53074..0aebfaec 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -154,10 +154,10 @@ void sub_0802A9A8(BombPeahatEntity* this) { this->unk_82 = 1; if (this->unk_80) { super->x.HALF.HI = gRoomControls.scroll_x - 0x10; - super->direction = 8; + super->direction = DirectionEast; } else { super->x.HALF.HI = gRoomControls.scroll_x + 0x100; - super->direction = 0x18; + super->direction = DirectionWest; } super->y.HALF.HI = gRoomControls.scroll_y + 0x40; super->timer = 128; @@ -234,7 +234,7 @@ void sub_0802AAC0(BombPeahatEntity* this) { #ifndef EU this->unk_78 = 0; this->unk_79 = 4; - super->direction = 0xff; + super->direction = DIR_NONE; #endif InitializeAnimation(super, 0); } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index d1dbd054..d516efbd 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -94,7 +94,7 @@ void BusinessScrub_Action0(BusinessScrubEntity* this) { this->unk_78 = super->x.HALF.HI; this->unk_7a = super->y.HALF.HI; super->animationState = 0; - super->direction = 0x10; + super->direction = DirectionSouth; sub_08028E9C(this); if ((*(u8*)this->unk_7c & 1) || CheckFlags(this->unk_86)) { super->action = 4; @@ -373,15 +373,15 @@ void sub_08028EDC(BusinessScrubEntity* this) { } void sub_08028F0C(BusinessScrubEntity* this) { - if (super->interactType == 2) { + if (super->interactType == INTERACTION_FUSE) { super->action = 8; - super->interactType = 0; - sub_0806F118(super); - } else if (super->interactType != 0) { + super->interactType = INTERACTION_NONE; + InitializeNPCFusion(super); + } else if (super->interactType != INTERACTION_NONE) { u16 dialog; const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c; - super->interactType = 0; + super->interactType = INTERACTION_NONE; sub_0804AA1C(super); super->direction = (GetAnimationState(super) << 3); sub_080290E0(this, 3); @@ -470,8 +470,8 @@ void sub_080290FC(BusinessScrubEntity* this) { if (super->timer != 0) { super->timer--; if ((super->timer < 16) && ((super->timer & 1) == 0)) { - s32 sVar3 = ((super->direction & 0x10) != 0) ? -1 : 1; - if ((super->direction & 8) != 0) { + s32 sVar3 = (super->direction & DirectionSouth) ? -1 : 1; + if (super->direction & DirectionEast) { super->x.HALF.HI += ((super->timer & 8) != 0) ? -sVar3 : sVar3; } else { super->y.HALF.HI += ((super->timer & 8) != 0) ? sVar3 : -sVar3; diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index 607f38b4..1b308880 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -72,7 +72,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; @@ -81,7 +81,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) { @@ -206,7 +206,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 1f22bac4..8dcd8f80 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 c91cf858..4e828be3 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -553,7 +553,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 2431398d..133aca85 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/enemy4D.c b/src/enemy/enemy4D.c index f4ebdf70..edda3b77 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -107,7 +107,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 cd59db89..6cddbdc8 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -80,40 +80,38 @@ void Enemy50_OnCollision(Enemy50Entity* this) { 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); } diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index 516bc646..04a1600f 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -144,7 +144,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; @@ -196,7 +196,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); @@ -240,7 +240,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 { @@ -264,7 +264,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 557163d4..6c171151 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -123,7 +123,7 @@ void sub_08045524(FireballGuyEntity* this) { super->zVelocity = Q_16_16(1.75); tmp = sub_0804A024(super, 1, 8); - if (tmp != 0xff && (Random() & 3) == 0) { + if (tmp != DIR_NONE && (Random() & 3) == 0) { super->timer = Random() & 3; super->direction = DirectionRound(tmp); } else { diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 7047f61a..aba9307f 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -1134,7 +1134,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 7f2192b1..8d2407f1 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -162,8 +162,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 35fb249e..51e88ab7 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -222,9 +222,9 @@ void sub_0802BE80(HelmasaurEntity* this) { } void sub_0802BEBC(HelmasaurEntity* this) { - super->direction ^= 0x10; + super->direction ^= DirectionSouth; ProcessMovement2(super); - super->direction ^= 0x10; + super->direction ^= DirectionSouth; if (!sub_080044EC(super, Q_16_16(0.125))) { sub_0802C1C0(this); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index f86690d6..89f991a3 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -97,7 +97,7 @@ void sub_0803CD6C(LakituCloudEntity* this) { void sub_0803CDA8(LakituCloudEntity* this) { UpdateAnimationSingleFrame(super); - if ((super->direction & 0x80) == 0) { + if (!(super->direction & DIR_NOT_MOVING_CHECK)) { LinearMoveUpdate(super); } @@ -131,7 +131,7 @@ void sub_0803CE14(LakituCloudEntity* this) { UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); direction = super->direction; - if (direction & 0x80) { + if (direction & DIR_NOT_MOVING_CHECK) { return; } diff --git a/src/enemy/leever.c b/src/enemy/leever.c index d7c49b23..66e263c8 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -79,7 +79,8 @@ void Leever_Idle(LeeverEntity* this) { if (Leever_PlayerInRange(super, Random() & 0x1f)) { super->action = 2; super->spriteSettings.draw = TRUE; - super->direction = (GetFacingDirection(super, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; + super->direction = + (GetFacingDirection(super, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & (0x3 | DirectionNorthWest); InitializeAnimation(super, LeeverAnimation_DigUp); UpdateSpriteForCollisionLayer(super); } else { diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 4666b7fd..85068daf 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -391,16 +391,16 @@ void sub_08029EEC(MadderpillarEntity* this) { void sub_08029F0C(MadderpillarEntity* this) { switch (super->direction >> 3) { - case 0: + case 0: // UP this->unk_78.HWORD = super->y.HALF.HI - 0x10; break; - case 1: + case 1: // RIGHT this->unk_78.HWORD = super->x.HALF.HI + 0x10; break; - case 2: + case 2: // DOWN this->unk_78.HWORD = super->y.HALF.HI + 0x10; break; - case 3: + case 3: // LEFT this->unk_78.HWORD = super->x.HALF.HI - 0x10; break; } @@ -408,25 +408,25 @@ void sub_08029F0C(MadderpillarEntity* this) { bool32 sub_08029F48(MadderpillarEntity* this) { switch (super->direction >> 3) { - case 0: + case 0: // UP if (super->y.HALF.HI <= this->unk_78.HWORD) { super->y.HALF.HI = this->unk_78.HWORD; return TRUE; } break; - case 1: + case 1: // RIGHT if (super->x.HALF.HI >= this->unk_78.HWORD) { super->x.HALF.HI = this->unk_78.HWORD; return TRUE; } break; - case 2: + case 2: // DOWN if (super->y.HALF.HI >= this->unk_78.HWORD) { super->y.HALF.HI = this->unk_78.HWORD; return TRUE; } break; - case 3: + case 3: // LEFT if (super->x.HALF.HI <= this->unk_78.HWORD) { super->x.HALF.HI = this->unk_78.HWORD; return TRUE; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 6a0228cb..64025e93 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -531,7 +531,7 @@ void sub_0803A8B8(Entity* this) { this->action = 0x10; this->timer = 30; - this->direction = 0; + this->direction = DirectionNorth; this->speed = 0x80; ptr = gUnk_080CED6C; @@ -575,7 +575,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); @@ -1247,7 +1247,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 32d00bdd..12fae4c5 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 8caf1f7a..ebf72095 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/peahat.c b/src/enemy/peahat.c index d0fe6e28..353ad0d5 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -191,7 +191,8 @@ void Peahat_ChargeStart(PeahatEntity* this) { super->action = 3; super->timer = 120; super->speed = 192; - super->direction = (GetFacingDirection(super, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f; + super->direction = + (GetFacingDirection(super, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & (0x3 | DirectionNorthWest); } } else { sub_080205F8(this); @@ -235,6 +236,8 @@ void Peahat_ChargeEnd(PeahatEntity* this) { } } +#define DIR_NONE 0xff + void Peahat_Stunned(PeahatEntity* this) { switch (super->animationState) { default: @@ -245,7 +248,7 @@ void Peahat_Stunned(PeahatEntity* this) { super->hitType = 0x71; } - if (super->direction == 0xff) + if (super->direction == DIR_NONE) super->direction = super->knockbackDirection; ProcessMovement0(super); @@ -373,7 +376,7 @@ void sub_08020604(PeahatEntity* this) { super->direction = sub_08049EE4(super); } else { super->direction += this->unk_80; - super->direction &= 0x1f; + super->direction &= (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 5d13addb..e2746415 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 03f8f0e8..9d085722 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -358,7 +358,7 @@ void sub_080255AC(Entity* this) { } tmp -= 7; - this->direction = (GetFacingDirection(entity, this) + tmp) & 0x1f; + this->direction = (GetFacingDirection(entity, this) + tmp) & (0x3 | DirectionNorthWest); } if (this->field_0x78.HWORD == 0) { @@ -398,7 +398,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 2a3a7fbe..e2a19240 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -46,7 +46,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) { if (super->hitType == 34 && super->health != 0xff) { super->action = 4; super->zVelocity = Q_16_16(2.0); - super->direction = 0xff; + super->direction = DIR_NONE; super->health = 0xff; super->hitType = 35; InitializeAnimation(super, super->animationState + 8); @@ -56,7 +56,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) { if (super->action == 4 || super->action == 5) { super->action = 4; super->timer = 180; - super->direction = 0xff; + super->direction = DIR_NONE; InitializeAnimation(super, super->animationState + 0x10); } } @@ -81,7 +81,7 @@ void Rollobite_OnGrabbed(RollobiteEntity* this) { if (super->subAction < 3 && !sub_0806F520(super)) { super->action = 4; COLLISION_ON(super); - super->direction = 0xff; + super->direction = DIR_NONE; InitializeAnimation(super, super->animationState + 0x10); } else { gUnk_080CA6A4[super->subAction](this); @@ -114,7 +114,7 @@ void sub_080207A8(RollobiteEntity* this) { COLLISION_ON(super); super->spritePriority.b0 = 4; super->gustJarState &= 0xfb; - super->direction ^= 0x10; + super->direction ^= DirectionSouth; super->zVelocity = Q_16_16(1.5); super->speed = 0x80; InitializeAnimation(super, super->animationState + 0x10); @@ -200,7 +200,7 @@ void Rollobite_RolledUp(RollobiteEntity* this) { if (unk == 1) EnqueueSFX(SFX_PLACE_OBJ); - if ((super->direction & 0x80) == 0) + if (!(super->direction & DIR_NOT_MOVING_CHECK)) ProcessMovement2(super); } } @@ -255,8 +255,8 @@ void sub_08020A7C(RollobiteEntity* this) { if (sub_08049FA0(super) == 0) { int tmp = DirectionRoundUp(sub_08049EE4(super)); - if ((state ^ 0x10) == tmp) - state ^= 0x10; + if ((state ^ DirectionSouth) == tmp) + state ^= DirectionSouth; } super->direction = state; diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index fd9127c7..03f6c159 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -138,7 +138,7 @@ void sub_08038304(RopeGoldenEntity* this) { } this->unk_7a = this->unk_79; this->unk_79 = cVar2; - super->direction = (super->direction + cVar2) & 0x18; + super->direction = (super->direction + cVar2) & DirectionWest; } else { super->direction = this->unk_78; } diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 03a65ffe..1834d7d3 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -227,7 +227,7 @@ void sub_08029688(RupeeLikeEntity* this) { void sub_0802969C(RupeeLikeEntity* this) { u32 bVar1; - if ((super->direction & 0xf) != 0) { + if (super->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) { bVar1 = super->direction >> 4; if (bVar1 != super->animationState) { diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index 2527a3a2..db136a3c 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -55,16 +55,16 @@ void sub_0802BA18(SensorBladeTrapEntity* this) { super->direction = direction; switch (direction >> 3) { - case 0: + case 0: // UP this->unk_7a = super->y.HALF.HI - this->unk_7e; break; - case 1: + case 1: // RIGHT this->unk_7a = super->x.HALF.HI + this->unk_7c; break; - case 2: + case 2: // DOWN this->unk_7a = super->y.HALF.HI + this->unk_7e; break; - case 3: + case 3: // LEFT this->unk_7a = super->x.HALF.HI - this->unk_7c; break; } @@ -75,19 +75,19 @@ void sub_0802BA8C(SensorBladeTrapEntity* this) { sub_0802BB10(this); } else { switch (super->direction >> 3) { - case 0: + case 0: // UP if (this->unk_7a >= super->y.HALF.HI) sub_0802BB10(this); break; - case 1: + case 1: // RIGHT if (this->unk_7a <= super->x.HALF.HI) sub_0802BB10(this); break; - case 2: + case 2: // DOWN if (this->unk_7a <= super->y.HALF.HI) sub_0802BB10(this); break; - case 3: + case 3: // LEFT if (this->unk_7a >= super->x.HALF.HI) sub_0802BB10(this); break; @@ -104,7 +104,7 @@ void sub_0802BAFC(SensorBladeTrapEntity* this) { void sub_0802BB10(SensorBladeTrapEntity* this) { super->action = 3; super->speed = 0xc0; - super->direction = super->direction ^ 0x10; + super->direction = super->direction ^ DirectionSouth; EnqueueSFX(SFX_METAL_CLINK); } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 74e6254c..bb17ead0 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -97,8 +97,8 @@ void sub_08031714(SmallPestoEntity* this) { if (sub_08049FA0(super) == 0 && (super->subtimer & 1) != 0) { super->direction = sub_08049EE4(super); } else { - super->direction += 0x18; - super->direction = ((Random() & 0xe) + super->direction) & 0x1f; + super->direction += DirectionWest; + super->direction = ((Random() & 0xe) + super->direction) & (0x3 | DirectionNorthWest); } sub_080317E0(this); } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 2ec43e2b..cc6d1f15 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 57159b15..7919a6ba 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 07dccce7..d009eab2 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 7042dea5..98b2214e 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -451,24 +451,23 @@ 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 = GetTileType(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 = GetTileType(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*) = { diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index 62ef03a0..16c8c787 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 ((GetTileUnderEntity(this) & 0xf0) == 0x50) { - 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 48c9d6a5..b5c024b2 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -136,7 +136,7 @@ void sub_08038048(Entity* this) { } else if (this->collisions != COL_NONE) { sub_0800417E(this, this->collisions); } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) { - this->direction = (this->direction + 0x10) & 0x1f; + this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); } if (--this->timer == 0) { @@ -185,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 1d52e752..7b174bc6 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 8370eac3..ab831be3 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -232,7 +232,7 @@ void sub_0802EFB8(Entity* this) { } iVar4 = sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1); if (iVar4 != 0) { - this->direction = 0xff; + this->direction = DIR_NONE; } else { this->timer = (rand & 3) + 1; this->direction = (uVar1 & 0x18); @@ -251,7 +251,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; @@ -263,7 +263,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; @@ -275,7 +275,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; @@ -287,7 +287,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 d97551e6..b2873a67 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -187,7 +187,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 adfacb07..9dacb397 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 8332a9a4..2ffeb961 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 ecfaaea7..832d73ab 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 d484865a..05d59a98 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) { sub_08049CF4(&(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 379ee2e7..3bac0702 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -179,8 +179,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); @@ -247,19 +247,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 7676d0e1..7e4d9108 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 206b9ef2..e1a0822f 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/gameUtils.c b/src/gameUtils.c index eb2eb7fb..d4543147 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -25,8 +25,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); @@ -207,7 +207,7 @@ s32 ModHealth(s32 delta) { newHealth = 0; } if (stats->maxHealth < newHealth) { - newHealth = (u32)stats->maxHealth; + newHealth = stats->maxHealth; } stats->health = newHealth; gPlayerEntity.health = newHealth; @@ -448,16 +448,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); } @@ -466,11 +460,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) @@ -714,7 +708,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; } @@ -722,7 +716,7 @@ void CheckAreaDiscovery(void) { if (!sub_08053144()) return; - gRoomTransition.player_status.field_0x24[10] = gArea.locationIndex; + gRoomTransition.location = gArea.locationIndex; if (!CheckGlobalFlag(TABIDACHI)) return; @@ -772,7 +766,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) { - if (!--*a1) { +void DarknutTimerHandler(u32* timer) { + if (gArea.locationIndex == 29 && *timer) { + 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/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 c567f197..3ac37366 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 ee3aaa1b..aa063eff 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -34,7 +34,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) { @@ -45,7 +45,7 @@ void sub_08077130(ItemBehavior* this, u32 index) { } } } else { - SetItemAnim(this, 0x508); + SetItemAnim(this, ANIM_MOLEMITTS_FLOOR); this->stateID = 1; } } else { @@ -71,9 +71,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]); @@ -140,7 +140,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 8a1bd692..c1fc697e 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; + gUnk_0200AF00.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 72cd7608..1b3cf948 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 1dff20c6..71a93a7b 100644 --- a/src/kinstone.c +++ b/src/kinstone.c @@ -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]; diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c index 47307dea..21855b00 100644 --- a/src/manager/minishPortalManager.c +++ b/src/manager/minishPortalManager.c @@ -34,7 +34,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; @@ -83,7 +83,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 c0c47a89..5ae26ace 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 3b1d6d41..20c8b3f1 100644 --- a/src/manager/rollingBarrelManager.c +++ b/src/manager/rollingBarrelManager.c @@ -192,7 +192,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 2a19f06d..f8732c15 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 7561c19a..2ea79113 100644 --- a/src/menu/pauseMenu.c +++ b/src/menu/pauseMenu.c @@ -398,7 +398,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); } @@ -431,7 +431,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: @@ -666,7 +666,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) { @@ -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 c9a085c9..89ef214b 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 6e87133b..51e95932 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 = GetTileTypeByEntity(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 1497f185..83205c44 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 2133d809..ecb97fe2 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -1,15 +1,28 @@ -#include "global.h" +/** + * @file bladeBrothers.c + * @ingroup NPCs + * + * @brief Blade Brothers NPC + */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" -#include "player.h" -#include "room.h" -#include "message.h" -#include "save.h" -#include "script.h" -#include "npc.h" #include "functions.h" #include "game.h" #include "item.h" +#include "message.h" +#include "npc.h" +#include "player.h" +#include "room.h" +#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*); @@ -21,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, @@ -212,16 +225,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); } } @@ -262,8 +275,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); } @@ -288,31 +301,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; } } @@ -326,18 +338,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) { 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 c0557905..b4b61ccd 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -1,10 +1,22 @@ -#include "sound.h" -#include "entity.h" -#include "script.h" -#include "functions.h" -#include "flags.h" +/** + * @file castorWildsStatue.c + * @ingroup NPCs + * + * @brief Castor Wilds Statue NPC + */ +#define NENT_DEPRECATED #include "effects.h" +#include "entity.h" +#include "flags.h" +#include "functions.h" #include "npc.h" +#include "script.h" +#include "sound.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[12]; + /*0x74*/ u16 tilePos; +} CastorWildsStatueEntity; static const Hitbox gUnk_08110E94; @@ -17,25 +29,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); } } @@ -52,9 +64,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; } } @@ -62,20 +74,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; - SetTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD + 0x3f, this->collisionLayer); - SetTile(0x4022, 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; + SetTile(0x4022, this->tilePos - 1, super->collisionLayer); + SetTile(0x4022, this->tilePos, super->collisionLayer); + SetTile(0x4022, this->tilePos + 0x3f, super->collisionLayer); + SetTile(0x4022, 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) { SetTile(0x4022, 0xe81, 1); SetTile(0x4022, 0xe82, 1); @@ -83,13 +95,13 @@ void sub_08067418(Entity* this) { SetTile(0x4022, 0xec3, 1); } } - 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 883999f8..1d63c376 100644 --- a/src/npc/clothesRack.c +++ b/src/npc/clothesRack.c @@ -1,4 +1,11 @@ +/** + * @file clothesRack.c + * @ingroup NPCs + * + * @brief Clothes Rack NPC + */ #include "npc.h" +#define NENT_DEPRECATED void sub_0806DD90(Entity*); void sub_0806DEC8(Entity*); @@ -12,23 +19,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; SetTile(0x4072, TILE(x - 0x18, y - 0x10), 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 fad25893..4fd41240 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -1,11 +1,22 @@ -#include "global.h" +/** + * @file dampe.c + * @ingroup NPCs + * + * @brief Dampe NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" -#include "room.h" #include "flags.h" +#include "item.h" #include "message.h" #include "npc.h" -#include "item.h" +#include "player.h" +#include "room.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 fusionOffer; +} DampeEntity; void Dampe(Entity* this) { switch (this->action) { @@ -13,16 +24,17 @@ void Dampe(Entity* this) { 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: @@ -33,9 +45,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 10427419..1969c89a 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -1,18 +1,37 @@ -#include "entity.h" +/** + * @file dog.c + * @ingroup NPCs + * + * @brief Dog NPC + */ +#define NENT_DEPRECATED #include "collision.h" +#include "entity.h" #include "functions.h" -#include "npc.h" #include "item.h" +#include "npc.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 @@ -23,15 +42,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, }; @@ -175,254 +194,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)) { - SetTile(0x4072, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer); + if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { + SetTile(0x4072, 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; @@ -430,22 +449,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); } @@ -455,12 +474,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) { @@ -501,15 +520,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 307ec550..45368147 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 abec9aae..1b78bc0b 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 = sub_080045DA(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 = sub_080045DA(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 = sub_080045DA(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 = sub_080045DA(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 685d7da8..957b4426 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -1,7 +1,28 @@ +/** + * @file kid.c + * @ingroup NPCs + * + * @brief Kid NPC + */ +#define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "npc.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 }, @@ -72,13 +93,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) } }, @@ -178,10 +198,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 { @@ -197,114 +217,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: @@ -320,7 +341,7 @@ void sub_080621AC(Entity* this) { heapPtr--; \ } -void sub_080622F4(Entity* this) { +void sub_080622F4(KidEntity* this) { s32 dx; s32 dy; s32 dist; @@ -340,10 +361,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; @@ -351,11 +372,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; @@ -366,8 +387,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; @@ -387,40 +408,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); } } @@ -636,7 +657,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; @@ -646,7 +667,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; @@ -668,32 +689,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) { @@ -701,9 +722,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 44739b9d..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; 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 cdfd7abe..910fb485 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" @@ -11,6 +18,12 @@ #include "screenTransitions.h" #include "sound.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69; +} NPC4EEntity; + typedef struct { Rect customHitbox; u8 interactDirections; @@ -37,9 +50,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); } } @@ -131,17 +144,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); } } @@ -170,14 +185,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 f8e6707e..7cc930e6 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -1,8 +1,27 @@ +/** + * @file npc5.c + * @ingroup NPCs + * + * @brief NPC 5 + */ +#define NENT_DEPRECATED +#include "collision.h" #include "functions.h" +#include "hitbox.h" #include "message.h" #include "npc.h" -#include "hitbox.h" -#include "collision.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 @@ -17,34 +36,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); @@ -52,14 +71,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); @@ -69,7 +88,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]; @@ -86,119 +105,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); } @@ -208,104 +228,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); } } @@ -318,27 +338,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); } } } @@ -391,27 +411,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; @@ -419,31 +439,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 { @@ -452,7 +472,7 @@ bool32 sub_08061170(Entity* this) { } return FALSE; } else { - sub_08016AD2(this); + sub_08016AD2(super); return TRUE; } } @@ -504,10 +524,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: @@ -519,176 +539,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; } } @@ -697,15 +717,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; } } @@ -714,15 +734,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; } } @@ -731,15 +751,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; } } @@ -748,15 +768,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; } } @@ -765,15 +785,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; } } @@ -782,15 +802,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; } } @@ -799,15 +819,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; } } @@ -856,64 +876,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 145bbea7..5c6108cd 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -1,9 +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 "kinstone.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 }, @@ -11,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*); @@ -27,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); } } @@ -45,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; } @@ -124,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); @@ -162,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 9e7ce529..f8e9b0fa 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; - sub_0807DEDC(entity, context, x, y); + sub_0807DEDC(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 647eae41..1e599c5f 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" @@ -16,9 +23,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 fa1e1305..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) { @@ -251,11 +264,11 @@ void sub_08065370(Entity* this, ScriptExecutionContext* context) { if (localFlag) { SetLocalFlag(localFlag); } - if (gSave.unk5C <= ~1u) { - 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 721c800f..d818f4fa 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -1,15 +1,31 @@ -#include "global.h" +/** + * @file townMinish.c + * @ingroup NPCs + * + * @brief Town Minish NPC + */ +#define NENT_DEPRECATED #include "entity.h" -#include "npc.h" #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[23]; + /*0x82*/ u16 unk_82; + /*0x84*/ ScriptExecutionContext* context; +} TownMinishEntity; extern u32 sub_080B1AC8(u32, u32, u32); -void sub_0806ACC4(Entity*); -void sub_0806ABFC(Entity*); -void sub_0806AC3C(Entity*); -void sub_0806AEA8(Entity*); -void sub_0806AEE4(Entity*); +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 +153,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 +253,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; } } 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 aa5c9c86..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,12 +63,12 @@ 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); + ExecuteScriptAndHandleAnimation(this, NULL); if ((this->type2 == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(SORA_ELDER_RECOVER)) && (CheckRoomFlag(0))) { this->type2 = 7; @@ -79,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) { diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 64898ef7..a2882348 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -1,9 +1,16 @@ -#include "global.h" -#include "sound.h" +/** + * @file zelda.c + * @ingroup NPCs + * + * @brief Zelda NPC + */ +#define NENT_DEPRECATED +#include "npc/zelda.h" #include "entity.h" -#include "functions.h" #include "flags.h" +#include "functions.h" #include "npc.h" +#include "sound.h" void ZeldaFollower_Hide(Entity*, Entity*); void ZeldaFollower_Show(Entity*, Entity*); @@ -25,11 +32,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 +75,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 +98,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 +163,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 0204c90e..75e705e3 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 f1689675..a84472db 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -4,74 +4,81 @@ * * @brief Baker Oven object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.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; @@ -82,31 +89,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 y; - 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); - y = this->field_0x80.HWORD; - SetTile(0x402e, y - 0x01, this->collisionLayer); - SetTile(0x4022, y - 0x00, this->collisionLayer); - SetTile(0x4022, y + 0x01, this->collisionLayer); - SetTile(0x4026, y - 0x41, this->collisionLayer); - SetTile(0x4026, y - 0x40, this->collisionLayer); - SetTile(0x4024, y - 0x3f, this->collisionLayer); - SetTile(0x4026, y - 0x81, this->collisionLayer); - SetTile(0x4026, y - 0x80, this->collisionLayer); + y = this->unk_80; + SetTile(0x402e, y - 0x01, super->collisionLayer); + SetTile(0x4022, y - 0x00, super->collisionLayer); + SetTile(0x4022, y + 0x01, super->collisionLayer); + SetTile(0x4026, y - 0x41, super->collisionLayer); + SetTile(0x4026, y - 0x40, super->collisionLayer); + SetTile(0x4024, y - 0x3f, super->collisionLayer); + SetTile(0x4026, y - 0x81, super->collisionLayer); + SetTile(0x4026, y - 0x80, 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/beanstalk.c b/src/object/beanstalk.c index 801c89d2..d265052e 100644 --- a/src/object/beanstalk.c +++ b/src/object/beanstalk.c @@ -5,9 +5,8 @@ * @brief Beanstalk 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/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 47514668..5c196409 100644 --- a/src/object/bench.c +++ b/src/object/bench.c @@ -16,8 +16,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 f40c90a3..e1515106 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -16,17 +16,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); @@ -38,13 +38,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; @@ -53,9 +53,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, @@ -66,30 +66,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; } @@ -141,7 +141,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; @@ -201,7 +201,7 @@ void sub_08088C9C(BigBarrelEntity* this) { } } -void sub_08088DB4(BigBarrelEntity* this) { +void BigBarrel_Type2(BigBarrelEntity* this) { switch (super->action) { case 0: super->action = 1; @@ -240,7 +240,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; @@ -266,8 +266,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: @@ -285,13 +285,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; } SetTileType(0x76, COORD_TO_TILE(super), 2); break; diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index b52fe780..6ad61e85 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -4,10 +4,8 @@ * * @brief Big Ice Block object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "item.h" #include "object.h" diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index 1f62e640..be0c1a32 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -4,10 +4,8 @@ * * @brief Big Pushable Lever object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { 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 e6243f22..2fc5ed83 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,17 +379,15 @@ void Bird_Type10(Entity* this) { } void CreateBird(Entity* this) { - Entity* birdEnt; - #ifndef EU if (AreaAllowsWarp()) { #else 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 eb19a284..d871f4ac 100644 --- a/src/object/blockPushed.c +++ b/src/object/blockPushed.c @@ -4,10 +4,8 @@ * * @brief Block Pushed object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { 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 c1b3bcff..cf18f937 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -4,10 +4,8 @@ * * @brief Boss Door object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" @@ -85,7 +83,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/bush.c b/src/object/bush.c index acdac424..e12d3883 100644 --- a/src/object/bush.c +++ b/src/object/bush.c @@ -5,10 +5,9 @@ * @brief Bush object */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/button.c b/src/object/button.c index 33dfcefe..0bf4bb7e 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -4,176 +4,188 @@ * * @brief Button object */ -#include "object.h" +#define NENT_DEPRECATED #include "functions.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 unk_74; + /*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 = GetTileType(this->field_0x74.HWORD, this->collisionLayer); - if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) { - this->action = 5; - SetTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer); + this->unk_74 = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | + ((((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6); + this->unk_72 = GetTileType(this->unk_74, super->collisionLayer); + if (super->type == 0 && CheckFlags(this->unk_86)) { + super->action = 5; + SetTileType(0x7A, this->unk_74, 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 = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + super->action = 2; + this->unk_72 = GetTileType(this->unk_74, 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); -u32 sub_08081D28(Entity*); -void sub_08081E6C(Entity*); +u32 sub_08081F7C(ButtonEntity*, u32); +u32 sub_08081D28(ButtonEntity*); +void sub_08081E6C(ButtonEntity*); -void Button_Action3(Entity* this) { +void Button_Action3(ButtonEntity* this) { if (!sub_08081F7C(this, 0x78)) 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; - SetTile(0x4035, this->field_0x74.HWORD, this->collisionLayer); +void Button_Action4(ButtonEntity* this) { + if (super->timer != 0) { + super->timer--; + if (super->subtimer != 0) { + super->subtimer = 0; + SetTile(0x4035, this->unk_74, 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); - SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer); + super->action = 2; + ClearFlag(this->unk_86); + SetTileType(0x77, this->unk_74, super->collisionLayer); SoundReq(SFX_BUTTON_PRESS); } } -void Button_Action5(Entity* this) { +void Button_Action5(ButtonEntity* this) { if (sub_08081F7C(this, 0x7a)) { sub_08081E6C(this); } } -Entity* sub_08081D74(Entity*); +Entity* sub_08081D74(ButtonEntity*); -u32 sub_08081CB0(Entity* this) { +bool32 sub_08081CB0(ButtonEntity* this) { u16 tmp; if (sub_08081D74(this)) { - this->field_0x70.HALF.LO = -1; - if (GetTileType(this->field_0x74.HWORD, this->collisionLayer) == 0x4035) { - sub_0807B7D8(0x78, this->field_0x74.HWORD, this->collisionLayer); + this->unk_70 = -1; + if (GetTileType(this->unk_74, super->collisionLayer) == 0x4035) { + sub_0807B7D8(0x78, this->unk_74, super->collisionLayer); } - return 1; + return TRUE; } else { - tmp = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + tmp = GetTileType(this->unk_74, super->collisionLayer); if (tmp != 0x77 && tmp != 0x79 && tmp != 0x4035) { - this->field_0x70.HALF.LO = GetTileIndex(this->field_0x74.HWORD, this->collisionLayer); - return 1; + this->unk_70 = GetTileIndex(this->unk_74, 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 (GetTileIndex(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) { - return 0; + if (GetTileIndex(this->unk_74, 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 (sub_080B1B44(this->field_0x74.HWORD, this->collisionLayer) == 0xF) { + if (sub_080B1B44(this->unk_74, super->collisionLayer) == 0xF) { return 0; } 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; } @@ -186,13 +198,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 = GetTileType(this->field_0x74.HWORD, this->collisionLayer); + tmp2 = GetTileType(this->unk_74, super->collisionLayer); tmp1 = gUnk_0811EE50; do { if (*tmp1 == tmp2) @@ -207,20 +219,20 @@ extern u16 gMapDataTopSpecial[0x2000]; extern u16 gMapDataBottomSpecial[]; -void sub_08081E6C(Entity* this) { +void sub_08081E6C(ButtonEntity* this) { u32 r4; LayerStruct* r1; u16* tmp2; u16* tmp; u16* tmp3; - u32 r6 = this->field_0x74.HWORD; - u32 r5 = this->collisionLayer; + u32 r6 = this->unk_74; + u32 r5 = super->collisionLayer; u32 tile = GetTileType(r6, r5); if (tile < 0x4000) return; r1 = GetLayerByIndex(r5); - r4 = (this->type == 0 ? 0x7a : 0x78); + r4 = (super->type == 0 ? 0x7a : 0x78); tmp = r1->metatiles; tmp = tmp + (r1->unkData2[r4] << 2); tmp2 = (r5 == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial); @@ -254,25 +266,25 @@ void sub_08081F24(Entity* this) { } } -u32 sub_08081F7C(Entity* this, u32 r7) { +bool32 sub_08081F7C(ButtonEntity* this, u32 r7) { 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); - SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer); - sub_08081F24(this); + if (super->timer == 6) { + SetFlag(this->unk_86); + SetTileType(r7, this->unk_74, super->collisionLayer); + sub_08081F24(super); SoundReq(SFX_BUTTON_PRESS); - if (this->field_0x70.HALF_U.LO != 0xFFFF) - SetTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer); - return 0; + if (this->unk_70 != 0xFFFF) + SetTile(this->unk_70, this->unk_74, 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/carlovObject.c b/src/object/carlovObject.c index f4ffa8a9..003b61f0 100644 --- a/src/object/carlovObject.c +++ b/src/object/carlovObject.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 96702b71..dd9038db 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -4,10 +4,8 @@ * * @brief Chest Spawner object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "item.h" #include "object.h" #include "screen.h" @@ -150,7 +148,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); 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 ecd20008..a9d500cd 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -4,10 +4,8 @@ * * @brief Crenel Bean Sprout object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" @@ -140,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); @@ -163,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 f6b02dd1..75b9dc59 100644 --- a/src/object/cuccoMinigame.c +++ b/src/object/cuccoMinigame.c @@ -10,10 +10,10 @@ #include "entity.h" #include "fileselect.h" #include "functions.h" +#include "item.h" #include "npc.h" #include "object.h" #include "script.h" -#include "item.h" typedef struct { Entity base; @@ -108,60 +108,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); @@ -170,7 +175,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; @@ -210,7 +214,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 54423cc0..6cf374ad 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -67,49 +67,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*); @@ -119,18 +111,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); @@ -141,7 +138,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; @@ -209,7 +206,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(); @@ -223,7 +220,7 @@ void sub_08094C30(CutsceneMiscObjectEntity* this) { UpdateAnimationSingleFrame(super); } -void sub_08094C88(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type3(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action != 0) { @@ -282,7 +279,7 @@ void sub_08094D70(CutsceneMiscObjectEntity* this) { } } -void sub_08094D94(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type4(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action != 0) { @@ -315,7 +312,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); @@ -389,7 +386,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; @@ -398,8 +395,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; @@ -440,7 +437,7 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) { } } -void sub_08095088(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) { u32 tmp; switch (super->action) { @@ -452,8 +449,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); @@ -472,7 +469,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); @@ -492,7 +489,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); @@ -504,7 +501,7 @@ void sub_08095188(CutsceneMiscObjectEntity* this) { HandleEntity0x82Actions(super); } -void sub_080951C4(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type10(CutsceneMiscObjectEntity* this) { Entity* p; if (super->action == 0) { @@ -544,7 +541,7 @@ void sub_08095244(CutsceneMiscObjectEntity* this) { } } -void sub_08095288(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) { Entity* p; if (super->action == 0) { @@ -606,7 +603,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; @@ -658,7 +655,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) { @@ -717,28 +714,25 @@ void sub_0809567C(CutsceneMiscObjectEntity* this) { super->direction = sub_080045DA(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); @@ -753,13 +747,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) { @@ -771,7 +765,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; @@ -791,7 +785,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); @@ -812,7 +806,7 @@ void sub_08095810(CutsceneMiscObjectEntity* this) { } } -void sub_0809584C(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type18(CutsceneMiscObjectEntity* this) { u32 tmp, idx; idx = super->health; @@ -835,7 +829,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); @@ -847,7 +841,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); @@ -881,7 +875,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; @@ -912,7 +906,7 @@ void sub_08095A68(CutsceneMiscObjectEntity* this) { } } -void sub_08095A8C(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type23(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: super->action++; @@ -945,7 +939,7 @@ void sub_08095A8C(CutsceneMiscObjectEntity* this) { } } -void sub_08095B48(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type24(CutsceneMiscObjectEntity* this) { Entity* p; u32 tmp; @@ -985,7 +979,7 @@ void sub_08095BE0(CutsceneMiscObjectEntity* this, u32 val) { } } -void sub_08095C00(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type25(CutsceneMiscObjectEntity* this) { if (super->action & 0x80) { DeleteThisEntity(); } else { @@ -1009,7 +1003,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); @@ -1037,7 +1031,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; @@ -1072,7 +1066,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) { @@ -1139,7 +1133,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) { @@ -1193,7 +1187,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); @@ -1203,7 +1197,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); @@ -1237,7 +1231,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; @@ -1261,7 +1255,7 @@ void sub_080961B0(CutsceneMiscObjectEntity* this) { } } -void sub_080961F4(CutsceneMiscObjectEntity* this) { +void CutsceneMiscObject_Type38(CutsceneMiscObjectEntity* this) { super->spriteSettings.draw = 1; super->frameIndex = 0; } @@ -1288,11 +1282,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 aee672f1..e844b93d 100644 --- a/src/object/cutsceneOrchestrator.c +++ b/src/object/cutsceneOrchestrator.c @@ -4,6 +4,7 @@ * * @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/doubleBookshelf.c b/src/object/doubleBookshelf.c index 877c3014..3003c776 100644 --- a/src/object/doubleBookshelf.c +++ b/src/object/doubleBookshelf.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..0208d997 --- /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 = + sub_080045DA(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80; + } else { + super->speed = 0x600; + dir = sub_080045DA(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 = sub_080045DA(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 bf406be3..624824ae 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -4,13 +4,12 @@ * * @brief Figurine Device object */ - #define NENT_DEPRECATED #include "figurineMenu.h" #include "fileselect.h" #include "functions.h" -#include "kinstone.h" #include "item.h" +#include "kinstone.h" #include "message.h" #include "object.h" #include "screen.h" @@ -32,13 +31,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; @@ -47,14 +46,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*); @@ -109,7 +108,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; @@ -126,8 +125,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; @@ -166,7 +165,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) { @@ -234,7 +233,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); @@ -246,16 +245,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; @@ -265,26 +264,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 @@ -298,7 +297,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) { gMessage.textWindowPosX = 1; gMessage.textWindowPosY = 0xc; #endif - gMessage.rupees = this->unk_81; + gMessage.rupees = this->shells; break; } } @@ -314,124 +313,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); @@ -474,26 +473,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; @@ -503,74 +500,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) { @@ -592,8 +596,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 @@ -603,114 +607,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 @@ -718,65 +722,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); @@ -788,7 +792,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 @@ -801,7 +806,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 23233f96..42afe6f5 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 = sub_080045DA(var0, var2) >> 3; - LinearMoveUpdate(this); + super->speed = var7; + super->direction = sub_080045DA(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 57a7cef9..50b959c3 100644 --- a/src/object/fireplace.c +++ b/src/object/fireplace.c @@ -4,53 +4,60 @@ * * @brief Fireplace object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.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); - SetTile(0x4061, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); + sub_0807B7D8(0x30b, TILE(super->x.HALF.HI, super->y.HALF.HI), 2); + SetTile(0x4061, 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 = GetTileTypeByEntity(this); +void sub_0809B7C0(FireplaceEntity* this) { + u32 tileType = GetTileTypeByEntity(super); if (tileType != 0x4061 && tileType != 0x4062) { sub_0809B7DC(this); } } -void sub_0809B7DC(Entity* this) { - sub_0807B7D8(0xc3 << 2, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); - SetTile(0x4062, 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); + SetTile(0x4062, 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 ef79e2f0..a9e02140 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/frozenWaterElement.c b/src/object/frozenWaterElement.c index 377dd87c..eb91890c 100644 --- a/src/object/frozenWaterElement.c +++ b/src/object/frozenWaterElement.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/furniture.c b/src/object/furniture.c index 38a111d0..0e88178c 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -194,12 +194,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 caab128c..15923716 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -4,22 +4,23 @@ * * @brief Giant Leaf object */ +#define NENT_DEPRECATED #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, }; @@ -30,9 +31,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++) { SetTile(16500, tilePos + arr[i], 1); 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 923a4dbe..09080f29 100644 --- a/src/object/giantRock2.c +++ b/src/object/giantRock2.c @@ -15,15 +15,15 @@ typedef struct { u16 tile; } 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 7927c32c..6bb928ce 100644 --- a/src/object/giantTwig.c +++ b/src/object/giantTwig.c @@ -4,10 +4,8 @@ * * @brief Giant Twig object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/graveyardKey.c b/src/object/graveyardKey.c index 3a4d664c..bef307ed 100644 --- a/src/object/graveyardKey.c +++ b/src/object/graveyardKey.c @@ -90,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 d2369721..b17d9717 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -4,52 +4,60 @@ * * @brief Hidden Ladder Down object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.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; - SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer); - SetTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer); - SetTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer); - SetTileType(0x1a5, *puVar3 - 1, this->collisionLayer); - SetTileType(0x1a6, *puVar3, this->collisionLayer); - SetTileType(0x1a7, *puVar3 + 1, this->collisionLayer); - SetTileType(0x1a8, *puVar3 + 0x3f, this->collisionLayer); - SetTileType(0x1a9, *puVar3 + 0x40, this->collisionLayer); - SetTileType(0x1aa, *puVar3 + 0x41, 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; + SetTileType(0x1a2, *puVar3 - 0x41, super->collisionLayer); + SetTileType(0x1a3, *puVar3 - 0x40, super->collisionLayer); + SetTileType(0x1a4, *puVar3 - 0x3f, super->collisionLayer); + SetTileType(0x1a5, *puVar3 - 1, super->collisionLayer); + SetTileType(0x1a6, *puVar3, super->collisionLayer); + SetTileType(0x1a7, *puVar3 + 1, super->collisionLayer); + SetTileType(0x1a8, *puVar3 + 0x3f, super->collisionLayer); + SetTileType(0x1a9, *puVar3 + 0x40, super->collisionLayer); + SetTileType(0x1aa, *puVar3 + 0x41, super->collisionLayer); } } -void HiddenLadderDown_Action1(Entity* this) { - if (GetTileType(*(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 (GetTileType(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 916f71d0..7dcef6c5 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) { gUnk_0200AF00.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 eaf97830..bf70e601 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -4,11 +4,12 @@ * * @brief Item On Ground object */ +#define NENT_DEPRECATED +#include "object/itemOnGround.h" #include "collision.h" #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "item.h" #include "itemMetaData.h" @@ -16,40 +17,41 @@ #include "player.h" #include "sound.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 +60,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 +89,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 +131,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 = GetTileTypeByEntity(this); +void sub_080811AC(ItemOnGroundEntity* this) { + super->action = 2; + super->spriteSettings.draw = 0; + this->unk_6e = GetTileTypeByEntity(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,111 +276,111 @@ 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 (sub_080B1B0C(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) { - this->direction = 0; - this->speed = 0; - this->spriteSettings.draw = 1; - this->field_0x68.HALF.HI = 0; +void sub_080812A8(ItemOnGroundEntity* this) { + if (sub_080B1B0C(super) != 0xF && this->unk_6e != GetTileTypeByEntity(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] = { @@ -411,79 +413,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 870ce4a2..fb81b2b8 100644 --- a/src/object/jailBars.c +++ b/src/object/jailBars.c @@ -4,63 +4,69 @@ * * @brief Jail Bars object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "room.h" #include "sound.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[] = { 0x4023, -0x3, 0x4023, -0x2, 0x4023, -0x1, 0x4023, 0x0, 0x4023, 0x1, 0x4023, 0x2, -0x1 }; static const s16 gUnk_0812497A[] = { 0x4023, -0x3, 0x4023, -0x2, 0x4088, -0x1, 0x4087, @@ -71,5 +77,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 04720216..90aaf6a0 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -4,119 +4,127 @@ * * @brief Jar Portal object */ +#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "object.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*, u32); -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, u32); +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, 0); } 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, 1); } 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, 0); } 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)) { @@ -126,64 +134,64 @@ 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, 1); } 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, u32 a2) { +void sub_0808C148(JarPortalEntity* this, u32 a2) { u32 pos; - pos = COORD_TO_TILE(this); + pos = COORD_TO_TILE(super); if (!a2) { - SetTile(16530, pos - 1, this->collisionLayer); - SetTile(16531, pos, this->collisionLayer); - SetTile(16532, pos + 63, this->collisionLayer); - SetTile(16533, pos + 64, this->collisionLayer); + SetTile(16530, pos - 1, super->collisionLayer); + SetTile(16531, pos, super->collisionLayer); + SetTile(16532, pos + 63, super->collisionLayer); + SetTile(16533, pos + 64, super->collisionLayer); } else { - RestorePrevTileEntity(pos - 1, this->collisionLayer); - RestorePrevTileEntity(pos, this->collisionLayer); - RestorePrevTileEntity(pos + 63, this->collisionLayer); - RestorePrevTileEntity(pos + 64, this->collisionLayer); + RestorePrevTileEntity(pos - 1, super->collisionLayer); + RestorePrevTileEntity(pos, super->collisionLayer); + RestorePrevTileEntity(pos + 63, super->collisionLayer); + RestorePrevTileEntity(pos + 64, super->collisionLayer); } } diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index 1b166cab..8a5a40b1 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 89126c82..56da199c 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 8743fadc..8722022a 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 5a90de45..b8c30d7b 100644 --- a/src/object/lightDoor.c +++ b/src/object/lightDoor.c @@ -4,10 +4,8 @@ * * @brief Light Door object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" #include "screen.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 ba0ba466..4484c9c4 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -4,164 +4,173 @@ * * @brief Lightable Switch object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" #include "room.h" #include "sound.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 { - SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer); + SetTile(0x4050, 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 84b11274..5c1e9949 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -1,61 +1,47 @@ -#define NENT_DEPRECATED /** * @file lilypadLarge.c * @ingroup Objects * * @brief Large Lilypad object */ -#include "global.h" +#define NENT_DEPRECATED +#include "object/lilypadLarge.h" #include "area.h" #include "functions.h" #include "item.h" #include "object.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(); @@ -97,10 +83,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, @@ -331,7 +317,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, @@ -403,7 +389,7 @@ void sub_08085B40(LilypadLargeEntity* this) { ResetCollisionLayer(super); if (GetTileUnderEntity(super) == 0xd) { ResetCollisionLayer(&gPlayerEntity); - sub_08085CDC(this); + LilypadLarge_Action4(this); super->direction = GetFacingDirection(&gPlayerEntity, super); LinearMoveDirection(&gPlayerEntity, 0x100, super->direction); } @@ -432,7 +418,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; @@ -453,7 +439,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); @@ -462,7 +448,7 @@ void sub_08085CDC(LilypadLargeEntity* this) { } } -void sub_08085D10(LilypadLargeEntity* this) { +void LilypadLarge_Action5(LilypadLargeEntity* this) { if (EntityHasDuplicateID(super) != 0) { SetLocalFlag(super->type2); DeleteThisEntity(); @@ -565,7 +551,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 8c8b4ac7..f9787ac4 100644 --- a/src/object/linkEmptyingBottle.c +++ b/src/object/linkEmptyingBottle.c @@ -5,10 +5,8 @@ * @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 "global.h" #include "item.h" #include "object.h" @@ -19,20 +17,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 +77,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 6cc6c1a6..ae3ae896 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" @@ -11,35 +12,47 @@ #include "flags.h" #include "functions.h" #include "game.h" -#include "global.h" #include "hitbox.h" #include "sound.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*); +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 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); +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 (*const LockedDoor_Actions[])(Entity*) = { +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 +101,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 = GetTileIndex(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 = GetTileIndex(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 +159,19 @@ void LockedDoor_Init(Entity* this) { } } -void LockedDoor_Action1(Entity* this) { - if (--this->timer == 0) { - this->action = 2; - this->timer = 7; - SetTile(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; + SetTile(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 +179,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; - SetTile(0x4022, 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; + SetTile(0x4022, this->unk_76, super->collisionLayer); } void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { @@ -259,7 +271,7 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { SetTile(0x4022, 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 +280,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 +322,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 c52f503d..044ab9f1 100644 --- a/src/object/macroAcorn.c +++ b/src/object/macroAcorn.c @@ -4,41 +4,48 @@ * * @brief Macro Acorn object */ +#define NENT_DEPRECATED #include "entity.h" #include "object.h" #include "physics.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(); } @@ -47,26 +54,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: SetTile(0x4022, position - 0x3d, 1); SetTile(0x406d, position - 0x3c, 1); diff --git a/src/object/macroBook.c b/src/object/macroBook.c index 59f025a4..0c116b44 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -30,13 +30,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 f68ce765..5227ec46 100644 --- a/src/object/macroDecorations.c +++ b/src/object/macroDecorations.c @@ -32,7 +32,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 2d4b5ac2..e9b12000 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" diff --git a/src/object/mask.c b/src/object/mask.c index 886105e9..e6934e5a 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -4,30 +4,42 @@ * * @brief Mask object */ +#define NENT_DEPRECATED #include "functions.h" #include "object.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; @@ -37,7 +49,7 @@ void Mask_Init(Entity* this) { DeleteThisEntity(); break; default: - ClearFlag(this->field_0x86.HWORD); + ClearFlag(this->unk_86); } break; @@ -48,26 +60,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 = GetTileIndex(this->field_0x7c.HALF_U.HI, 1); + this->unk_7e = COORD_TO_TILE(super); + this->unk_7c = GetTileIndex(this->unk_7e, 1); - this->field_0x7a.HWORD = sub_080B1B44((u16)this->field_0x7c.HALF.HI, 1); + this->unk_7a = sub_080B1B44(this->unk_7e, 1); - SetTile(0x4022, this->field_0x7c.HALF_U.HI, 1); + SetTile(0x4022, this->unk_7e, 1); } // 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; @@ -78,54 +90,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 - SetTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, 1); + SetTile(this->unk_7c, this->unk_7e, 1); - sub_08000148(this->field_0x7a.HWORD, (u16)this->field_0x7c.HALF.HI, 1); + sub_08000148(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 f7236beb..0703a301 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -4,115 +4,128 @@ * * @brief Metal Door object */ +#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "room.h" #include "sound.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*) = { +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 = GetTileIndex(this->field_0x74.HWORD - 1, this->collisionLayer); - this->field_0x78.HWORD = GetTileIndex(this->field_0x74.HWORD, this->collisionLayer); - this->field_0x7a.HWORD = GetTileIndex(this->field_0x74.HWORD + 1, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD, this->collisionLayer); - SetTile(0x4022, this->field_0x74.HWORD + 1, this->collisionLayer); +void sub_080A080C(MetalDoorEntity* this) { + this->unk_76 = GetTileIndex(this->unk_74 - 1, super->collisionLayer); + this->unk_78 = GetTileIndex(this->unk_74, super->collisionLayer); + this->unk_7a = GetTileIndex(this->unk_74 + 1, super->collisionLayer); + SetTile(0x4022, this->unk_74 - 1, super->collisionLayer); + SetTile(0x4022, this->unk_74, super->collisionLayer); + SetTile(0x4022, this->unk_74 + 1, super->collisionLayer); } -void sub_080A0870(Entity* this) { - SetTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer); - SetTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer); - SetTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer); +void sub_080A0870(MetalDoorEntity* this) { + SetTile(this->unk_76, this->unk_74 - 1, super->collisionLayer); + SetTile(this->unk_78, this->unk_74, super->collisionLayer); + SetTile(this->unk_7a, this->unk_74 + 1, super->collisionLayer); } diff --git a/src/object/minecart.c b/src/object/minecart.c index 3a4c434e..73cf2e51 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -11,21 +11,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 u16* const gUnk_081223D8[]; diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index edb60f48..a6746467 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -4,10 +4,8 @@ * * @brief Minecart Door object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { 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 417c3f99..7abd4675 100644 --- a/src/object/minishVillageObject.c +++ b/src/object/minishVillageObject.c @@ -4,98 +4,92 @@ * * @brief Minish Village Object object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" #include "screen.h" -typedef struct { - /*0x00*/ Entity base; -} MinishVillageObjectEntity; +void MinishVillageObject_Type0(Entity*); +void MinishVillageObject_Type1(Entity*); +void MinishVillageObject_Type3(Entity*); +void MinishVillageObject_Type4(Entity*); +void MinishVillageObject_Type5(Entity*); +void MinishVillageObject_Type6(Entity*); +void MinishVillageObject_Type7(Entity*); +void MinishVillageObject_Type8(Entity*); +void MinishVillageObject_Type8_Init(Entity*); +void MinishVillageObject_Type8_Action1(Entity*); +void MinishVillageObject_Type8_Action2(Entity*); -void MinishVillageObject_Type0(MinishVillageObjectEntity*); -void MinishVillageObject_Type1(MinishVillageObjectEntity*); -void MinishVillageObject_Type3(MinishVillageObjectEntity*); -void MinishVillageObject_Type4(MinishVillageObjectEntity*); -void MinishVillageObject_Type5(MinishVillageObjectEntity*); -void MinishVillageObject_Type6(MinishVillageObjectEntity*); -void MinishVillageObject_Type7(MinishVillageObjectEntity*); -void MinishVillageObject_Type8(MinishVillageObjectEntity*); -void MinishVillageObject_Type8_Init(MinishVillageObjectEntity*); -void MinishVillageObject_Type8_Action1(MinishVillageObjectEntity*); -void MinishVillageObject_Type8_Action2(MinishVillageObjectEntity*); - -void MinishVillageObject(MinishVillageObjectEntity* this) { - static void (*const MinishVillageObject_Types[])(MinishVillageObjectEntity*) = { +void MinishVillageObject(Entity* this) { + static void (*const MinishVillageObject_Types[])(Entity*) = { MinishVillageObject_Type0, MinishVillageObject_Type1, MinishVillageObject_Type1, MinishVillageObject_Type3, MinishVillageObject_Type4, MinishVillageObject_Type5, MinishVillageObject_Type6, MinishVillageObject_Type7, MinishVillageObject_Type8, MinishVillageObject_Type1, }; - MinishVillageObject_Types[super->type](this); + MinishVillageObject_Types[this->type](this); } -void MinishVillageObject_Type0(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type0(Entity* this) { u32 tmp; u32 tmp2; - switch (super->action) { + switch (this->action) { case 0: - super->action = 1; - super->timer = 64 - (Random() & 0x1F); - super->frameIndex = 0; - super->animationState = 0; - super->spriteRendering.b3 = 3; - super->spritePriority.b0 = 7; - super->collisionLayer = 1; + this->action = 1; + this->timer = 64 - (Random() & 0x1F); + this->frameIndex = 0; + this->animationState = 0; + this->spriteRendering.b3 = 3; + this->spritePriority.b0 = 7; + this->collisionLayer = 1; break; case 1: - if (--super->timer == 0) { - super->timer = 8; - super->subtimer = 4; - super->action = 2; - super->animationState = Random() & 3; + if (--this->timer == 0) { + this->timer = 8; + this->subtimer = 4; + this->action = 2; + this->animationState = Random() & 3; } break; case 2: - if (--super->timer == 0) { - if (--super->subtimer == 0) { - super->frameIndex = 0; - super->action = 1; - super->timer = 64 - (Random() & 0x1F); + if (--this->timer == 0) { + if (--this->subtimer == 0) { + this->frameIndex = 0; + this->action = 1; + this->timer = 64 - (Random() & 0x1F); } else { - super->timer = 8; - tmp2 = super->animationState; - if (super->frameIndex != tmp2) { + this->timer = 8; + tmp2 = this->animationState; + if (this->frameIndex != tmp2) { tmp = tmp2; } else { tmp = 0; } - super->frameIndex = tmp; + this->frameIndex = tmp; } } break; } } -void MinishVillageObject_Type1(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type1(Entity* this) { static const u16 gUnk_08121704[] = { 0x12d, 0x12e, 0x12f, 0x130, 0x131, 0x132, 0x133, 0x132, 0x131, 0x130, 0x12f, 0x12e, 0x12d, 0, }; - switch (super->action) { + switch (this->action) { case 0: - super->action = 1; - super->timer = 8; - super->subtimer = 0; - super->frameIndex = 0; - super->spritePriority.b0 = 7; - SetTile(0x4069, COORD_TO_TILE(super) - 0x40, 1); + this->action = 1; + this->timer = 8; + this->subtimer = 0; + this->frameIndex = 0; + this->spritePriority.b0 = 7; + SetTile(0x4069, COORD_TO_TILE(this) - 0x40, 1); break; case 2: if ((gRoomTransition.frameCount & 3U) == 0) { - gScreen.controls.alphaBlend = (super->subAction << 8) | (0x10 - super->subAction); - super->subAction++; + gScreen.controls.alphaBlend = (this->subAction << 8) | (0x10 - this->subAction); + this->subAction++; if (gScreen.controls.alphaBlend == 0x1000) { gScreen.controls.layerFXControl = 0; DeleteThisEntity(); @@ -105,14 +99,14 @@ void MinishVillageObject_Type1(MinishVillageObjectEntity* this) { case 1: break; } - if (--super->timer == 0) { - super->timer = 8; - if (super->type == 9) { - super->timer = 2; + if (--this->timer == 0) { + this->timer = 8; + if (this->type == 9) { + this->timer = 2; } - ChangeObjPalette(super, gUnk_08121704[super->subtimer++]); - if (gUnk_08121704[super->subtimer] == 0) { - super->subtimer = 0; + ChangeObjPalette(this, gUnk_08121704[this->subtimer++]); + if (gUnk_08121704[this->subtimer] == 0) { + this->subtimer = 0; } } } @@ -137,120 +131,120 @@ void sub_0808D2CC(void) { } } -void MinishVillageObject_Type3(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type3(Entity* this) { } -void MinishVillageObject_Type4(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type4(Entity* this) { s32 tmp; - if (super->action == 0) { - super->action = 0; - super->frameIndex = 0; - super->spritePriority.b0 = 7; - sub_0807DD64(super); + if (this->action == 0) { + this->action = 0; + this->frameIndex = 0; + this->spritePriority.b0 = 7; + sub_0807DD64(this); } - tmp = super->x.HALF.HI; - ExecuteScriptForEntity(super, NULL); - HandleEntity0x82Actions(super); - if (((gRoomControls.shake_duration != 0) && (tmp != super->x.HALF.HI)) && ((gRoomTransition.frameCount & 8) == 0)) { + tmp = this->x.HALF.HI; + ExecuteScriptForEntity(this, NULL); + HandleEntity0x82Actions(this); + if (((gRoomControls.shake_duration != 0) && (tmp != this->x.HALF.HI)) && ((gRoomTransition.frameCount & 8) == 0)) { SoundReq(SFX_10F); } } -void MinishVillageObject_Type5(MinishVillageObjectEntity* this) { - if (super->action == 0) { - super->action = 0; - super->frameIndex = 1; - super->spritePriority.b0 = 7; - sub_0807DD64(super); +void MinishVillageObject_Type5(Entity* this) { + if (this->action == 0) { + this->action = 0; + this->frameIndex = 1; + this->spritePriority.b0 = 7; + sub_0807DD64(this); } - ExecuteScriptForEntity(super, NULL); - HandleEntity0x82Actions(super); + ExecuteScriptForEntity(this, NULL); + HandleEntity0x82Actions(this); } -void MinishVillageObject_Type6(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type6(Entity* this) { static const u16 gUnk_08121720[] = { 0x149, 0x14a, 0x14b, 0x14a, 0, 0 }; - if (super->action == 0) { - super->action = 1; - super->timer = 8; - super->spritePriority.b0 = 7; + if (this->action == 0) { + this->action = 1; + this->timer = 8; + this->spritePriority.b0 = 7; gScreen.controls.layerFXControl = 0x640; gScreen.controls.alphaBlend = 0x1003; } - if (--super->timer == 0) { - super->timer = 2; - sub_0801D28C(super, gUnk_08121720[super->subtimer++]); - if (gUnk_08121720[super->subtimer] == 0) { - super->subtimer = 0; + if (--this->timer == 0) { + this->timer = 2; + sub_0801D28C(this, gUnk_08121720[this->subtimer++]); + if (gUnk_08121720[this->subtimer] == 0) { + this->subtimer = 0; } } } -void MinishVillageObject_Type7(MinishVillageObjectEntity* this) { - if (super->action == 0) { - super->action = 1; - super->spriteRendering.b3 = 3; - super->spritePriority.b0 = 7; - super->spriteRendering.alphaBlend = 1; - super->frameIndex = super->type2; - SetAffineInfo(super, (1 - super->type2) * 0x200 + 0x100, 0xffffff40, 0); +void MinishVillageObject_Type7(Entity* this) { + if (this->action == 0) { + this->action = 1; + this->spriteRendering.b3 = 3; + this->spritePriority.b0 = 7; + this->spriteRendering.alphaBlend = 1; + this->frameIndex = this->type2; + SetAffineInfo(this, (1 - this->type2) * 0x200 + 0x100, 0xffffff40, 0); } } -void MinishVillageObject_Type8(MinishVillageObjectEntity* this) { - static void (*const MinishVillageObject_Type8_Actions[])(MinishVillageObjectEntity*) = { +void MinishVillageObject_Type8(Entity* this) { + static void (*const MinishVillageObject_Type8_Actions[])(Entity*) = { MinishVillageObject_Type8_Init, MinishVillageObject_Type8_Action1, MinishVillageObject_Type8_Action2, }; - MinishVillageObject_Type8_Actions[super->action](this); + MinishVillageObject_Type8_Actions[this->action](this); } -void MinishVillageObject_Type8_Init(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type8_Init(Entity* this) { u32 tilePosition; - super->spritePriority.b0 = 7; - super->frameIndex = super->type2; - super->action = 2; - if ((super->type2 == 0) && (CheckLocalFlag(0x7c) == 0)) { - super->action = 1; - super->timer = 0; - super->spriteRendering.alphaBlend = 1; + this->spritePriority.b0 = 7; + this->frameIndex = this->type2; + this->action = 2; + if ((this->type2 == 0) && (CheckLocalFlag(0x7c) == 0)) { + this->action = 1; + this->timer = 0; + this->spriteRendering.alphaBlend = 1; gScreen.controls.layerFXControl = 0x640; gScreen.controls.alphaBlend = 0x1000; SoundReq(SFX_179); } else { - super->timer = 8; - tilePosition = COORD_TO_TILE(super); - if (super->type2 != 0) { + this->timer = 8; + tilePosition = COORD_TO_TILE(this); + if (this->type2 != 0) { tilePosition -= 0x40; } - SetTile(0x4069, tilePosition, super->collisionLayer); + SetTile(0x4069, tilePosition, this->collisionLayer); } } -void MinishVillageObject_Type8_Action1(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type8_Action1(Entity* this) { if ((gRoomTransition.frameCount & 3U) == 0) { - gScreen.controls.alphaBlend = ((0x10 - super->timer) * 0x100) | super->timer; - super->timer++; + gScreen.controls.alphaBlend = ((0x10 - this->timer) * 0x100) | this->timer; + this->timer++; if (gScreen.controls.alphaBlend == 0x10) { - super->action = 2; - super->timer = 8; - super->spriteRendering.alphaBlend = 0; + this->action = 2; + this->timer = 8; + this->spriteRendering.alphaBlend = 0; gScreen.controls.layerFXControl = 0; - SetTile(0x4069, COORD_TO_TILE(super), super->collisionLayer); + SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); } } } -void MinishVillageObject_Type8_Action2(MinishVillageObjectEntity* this) { +void MinishVillageObject_Type8_Action2(Entity* this) { static const u16 gUnk_08121738[] = { 0x14c, 0x14d, 0x14e, 0x14f, 0x150, 0x151, 0x150, 0x14f, 0x14e, 0x14d, 0x14c, 0, }; - if (--super->timer == 0) { - super->timer = 8; - ChangeObjPalette(super, gUnk_08121738[super->subtimer++]); - if (gUnk_08121738[super->subtimer] == 0) { - super->subtimer = 0; + if (--this->timer == 0) { + this->timer = 8; + ChangeObjPalette(this, gUnk_08121738[this->subtimer++]); + if (gUnk_08121738[this->subtimer] == 0) { + this->subtimer = 0; } } } diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index 69dcfcd4..15b19439 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 196a3bc4..fdda1933 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 77622f1f..aad2385c 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -4,42 +4,50 @@ * * @brief ObjectA object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" #include "game.h" -#include "global.h" #include "hitbox.h" #include "object.h" #include "room.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 == 1) { + if (super->action == 0) { + super->action = 1; + super->hitbox = (Hitbox*)&gHitbox_2; + if (super->collisionLayer == 1) { uVar2 = 0x26; } else { uVar2 = 0x34; } - this->field_0x70.HALF.LO = uVar2; - if (CheckFlags(this->field_0x86.HWORD) != 0) { - SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + this->unk_70 = uVar2; + if (CheckFlags(this->unk_86) != 0) { + SetTileType(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) { - SetTileType(*(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) { + SetTileType(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 5618ebd2..1dedecaf 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 5473531d..18234b59 100644 --- a/src/object/objectBlockingStairs.c +++ b/src/object/objectBlockingStairs.c @@ -39,16 +39,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 5b617169..6f3381dc 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -4,10 +4,8 @@ * * @brief Object on Pillar object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.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 22e3561e..4619d170 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,164 +55,162 @@ 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 = sub_080045DA(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 = sub_080045DA(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 = sub_080045DA(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 = sub_080045DA(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; } } @@ -207,99 +218,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(); @@ -307,7 +317,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(); } @@ -315,22 +325,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(); } @@ -360,7 +370,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 4f545bef..b7240a49 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" void PalaceArchway_Init(Entity*); diff --git a/src/object/paper.c b/src/object/paper.c index ce3b8806..a3b515ee 100644 --- a/src/object/paper.c +++ b/src/object/paper.c @@ -4,10 +4,8 @@ * * @brief Paper object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" void Paper_Init(Entity*); 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 e898dcfe..56a3c8bf 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" @@ -35,13 +35,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 0e024f6f..93bc1995 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -4,171 +4,182 @@ * * @brief Pot object */ +#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" +#include "object/itemOnGround.h" #include "player.h" #include "room.h" #include "sound.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 = GetTileIndex(COORD_TO_TILE(this), this->collisionLayer); - if ((u16)this->field_0x70.HALF.LO == 0x4000) { + this->unk_70 = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer); + if (this->unk_70 == 0x4000) { DeleteThisEntity(); } - SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); - InitializeAnimation(this, 5); + SetTile(0x4000, 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: - SetTile((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); + SetTile((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 = GetTileTypeByEntity(this); + tileType = GetTileTypeByEntity(super); if (tileType != 0x4000) { switch (tileType) { case 0x4004: case 0x4003: case 0x4002: case 0x4001: - this->direction = (tileType - 0x4001) * 8; - this->timer = 32; - this->action = 4; + super->direction = (tileType - 0x4001) * 8; + super->timer = 32; + super->action = 4; if (gPlayerState.flags & PL_MINISH) { - this->speed >>= 1; - this->timer = 64; + super->speed >>= 1; + super->timer = 64; } - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); EnqueueSFX(SFX_10F); break; case 0x4067: - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); DeleteThisEntity(); break; default: - if (GetTileUnderEntity(this) == 13) { - CreateFx(this, FX_FALL_DOWN, 0); + if (GetTileUnderEntity(super) == 13) { + CreateFx(super, FX_FALL_DOWN, 0); } else if (tileType == 0x4005) { gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT; - SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + SetTile((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; - SetTile((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; + SetTile((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 +189,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 = GetTileIndex(COORD_TO_TILE(this), this->collisionLayer); - tileType = GetTileTypeByEntity(this); + this->unk_70 = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer); + tileType = GetTileTypeByEntity(super); switch (tileType) { case 0x71: case 0x72: sub_08082850(this, NULL); break; default: - SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); - RegisterCarryEntity(this); + SetTile(0x4000, 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; - SetTile(0x4000, 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; + SetTile(0x4000, 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; - SetTile((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; + SetTile((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 +323,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 7c2a738f..4b99f202 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 3200afbf..0fd58dcf 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -4,11 +4,9 @@ * * @brief Pullable Mushroom object */ - #define NENT_DEPRECATED #include "functions.h" #include "game.h" -#include "global.h" #include "hitbox.h" #include "object.h" @@ -198,7 +196,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 4f185253..58b1c1aa 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -4,10 +4,8 @@ * * @brief Pushable Furniture object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { @@ -58,7 +56,7 @@ void PushableFurniture(PushableFurnitureEntity* this) { } } -void sub_0808F990(PushableFurnitureEntity* this) { +void PushableFurniture_Init(PushableFurnitureEntity* this) { bool32 condition; super->action = 1; @@ -632,7 +630,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 1cb2ecdf..245763e3 100644 --- a/src/object/pushableGrave.c +++ b/src/object/pushableGrave.c @@ -4,10 +4,8 @@ * * @brief Pushable Grave object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index dec3fcb7..493bf92c 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -4,10 +4,8 @@ * * @brief Pushable Lever object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/pushableRock.c b/src/object/pushableRock.c index 29b3fdd8..ca862173 100644 --- a/src/object/pushableRock.c +++ b/src/object/pushableRock.c @@ -4,10 +4,8 @@ * * @brief Pushable Rock object */ - #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" typedef struct { diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index b29ca269..ed3de97f 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -5,10 +5,9 @@ * @brief Pushable Statue object */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 5a77c8db..9fe52d41 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -4,110 +4,123 @@ * * @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" -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); } @@ -116,47 +129,47 @@ void Railtrack_Action3(Entity* this) { static const u16 gUnk_081205E0[] = { 0x4018, 0x4019 }; -void sub_08085394(Entity* this) { +void sub_08085394(RailtrackEntity* this) { u32 uVar1; u16* layerData; u32 tile; - s8 off; + s8 offset; - uVar1 = gUnk_081205E0[this->animationState / 2]; - off = gUnk_080B4488[this->animationState / 2][0]; - layerData = (u16*)this->field_0x70.WORD; - tile = COORD_TO_TILE(this); + uVar1 = gUnk_081205E0[super->animationState / 2]; + offset = gUnk_080B4488[super->animationState / 2][0]; + layerData = this->unk_70; + tile = COORD_TO_TILE(super); - this->field_0x74.HWORD = *(layerData - off); - SetTile(uVar1, tile - off, this->collisionLayer); + this->unk_74 = *(layerData - offset); + SetTile(uVar1, tile - offset, super->collisionLayer); - this->field_0x76.HWORD = layerData[0x0]; - SetTile(uVar1, tile - 0x0, this->collisionLayer); + this->unk_76 = layerData[0x0]; + SetTile(uVar1, tile - 0x0, super->collisionLayer); - this->field_0x78.HWORD = layerData[off]; - SetTile(uVar1, tile + off, this->collisionLayer); + this->unk_78 = layerData[offset]; + SetTile(uVar1, tile + offset, super->collisionLayer); } -void sub_0808543C(Entity* this) { +void sub_0808543C(RailtrackEntity* this) { s8* cVar1; u32 uVar2; s8 temp; - temp = gUnk_080B4488[this->animationState / 2][0]; - uVar2 = COORD_TO_TILE(this); - SetTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer); - SetTile(this->field_0x76.HWORD, uVar2, this->collisionLayer); - SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer); + temp = gUnk_080B4488[super->animationState / 2][0]; + uVar2 = COORD_TO_TILE(super); + SetTile(this->unk_74, uVar2 - temp, super->collisionLayer); + SetTile(this->unk_76, uVar2, super->collisionLayer); + SetTile(this->unk_78, uVar2 + temp, 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 1c5e048a..255dbb40 100644 --- a/src/object/smallIceBlock.c +++ b/src/object/smallIceBlock.c @@ -4,14 +4,12 @@ * * @brief Small Ice Block object */ - #define NENT_DEPRECATED -#include "global.h" #include "collision.h" -#include "object.h" #include "functions.h" #include "hitbox.h" #include "item.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; 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/smokeParticle.c b/src/object/smokeParticle.c index de97206b..4e871bfc 100644 --- a/src/object/smokeParticle.c +++ b/src/object/smokeParticle.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.h" #include "object.h" void SmokeParticle_Init(Entity*); 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 46436ea8..3a5ca962 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 06049ca9..15605a4b 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 34622516..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" diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 9a5ac61e..4acf1d76 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -4,83 +4,89 @@ * * @brief Tree Hiding Portal object */ +#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" #include "functions.h" -#include "global.h" #include "object.h" #include "player.h" #include "room.h" #include "sound.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() == 0x54) { - 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 +94,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 +105,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 e01a832d..15aac684 100644 --- a/src/object/treeThorns.c +++ b/src/object/treeThorns.c @@ -4,8 +4,8 @@ * * @brief Three Thorns object */ +#define NENT_DEPRECATED #include "entity.h" -#include "global.h" #include "hitbox.h" #include "object.h" #include "physics.h" diff --git a/src/object/unusedSkull.c b/src/object/unusedSkull.c index c6a2e1f5..68a22cef 100644 --- a/src/object/unusedSkull.c +++ b/src/object/unusedSkull.c @@ -6,7 +6,6 @@ */ #define NENT_DEPRECATED #include "functions.h" -#include "global.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 29a04181..8b26a476 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -4,41 +4,45 @@ * * @brief Well object */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" -#include "global.h" #include "player.h" #include "room.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; - SetTile(16509, this->field_0x80.HWORD, 1); + super->action = 1; + tilePos = COORD_TO_TILE(super); + this->unk_80 = tilePos; + SetTile(16509, this->unk_80, 1); } -void Well_Action1(Entity* this) { - s32 tileIndex; - - tileIndex = GetTileType(this->field_0x80.HWORD, 1); +void Well_Action1(WellEntity* this) { + u32 tileIndex = GetTileType(this->unk_80, 1); if (tileIndex != 0x407D) { 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 023af557..b0cc10b0 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[]; @@ -131,19 +131,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) { @@ -245,17 +245,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; } @@ -400,14 +404,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 = sub_08007DD6(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) { @@ -434,11 +435,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* ent, s32 x, s32 y, s32 distance) { @@ -679,11 +680,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 2d50b1f8..12b1ff45 100644 --- a/src/player.c +++ b/src/player.c @@ -48,8 +48,6 @@ #define FALL_DAMAGE 2 -#define DEFAULT_ANIM 0x100 - static EntityAction PlayerInit; static EntityAction PlayerNormal; // static EntityAction PlayerInit; @@ -129,7 +127,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; @@ -198,7 +196,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; @@ -282,7 +280,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; } @@ -354,7 +352,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); @@ -398,7 +396,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); @@ -420,7 +418,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) { @@ -505,7 +503,7 @@ static void PlayerNormal(Entity* this) { this->speed = gPlayerState.jump_status & 0x20; sub_08008926(this); } else { - this->direction = 0xff; + this->direction = DIR_NONE; } } UpdatePlayerMovement(); @@ -537,14 +535,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 && @@ -580,7 +578,7 @@ static void PlayerFall(Entity* this) { PlayerFallUpdate, }; - gPlayerState.direction = 0xFF; + gPlayerState.direction = DIR_NONE; gPlayerState.pushedObject = 0x80; gPlayerState.framestate = PL_STATE_FALL; @@ -596,11 +594,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); @@ -649,10 +647,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; } @@ -701,7 +699,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) { @@ -736,7 +734,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) { @@ -781,15 +779,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; @@ -836,7 +834,7 @@ static void PlayerJump(Entity* this) { } static void PlayerJumpInit(Entity* this) { - u32 temp; + s32 temp; this->subAction++; @@ -849,9 +847,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; } } } @@ -860,8 +858,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(); @@ -911,9 +912,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; } @@ -955,7 +956,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)) @@ -964,9 +965,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(); } @@ -983,7 +984,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; } @@ -1017,7 +1018,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); @@ -1033,7 +1034,6 @@ static void PortalJumpOnUpdate(Entity* this) { COLLISION_OFF(this); this->knockbackDuration = 0; - x = gArea.portal_x; y = gArea.portal_y; @@ -1051,27 +1051,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; } @@ -1083,7 +1083,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; } @@ -1092,7 +1092,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; @@ -1108,7 +1108,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(); @@ -1132,7 +1132,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); } @@ -1219,12 +1219,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; @@ -1300,9 +1300,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; @@ -1323,9 +1323,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(); } @@ -1333,15 +1333,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(); @@ -1353,18 +1353,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; } } @@ -1388,7 +1388,7 @@ static void PlayerPush(Entity* this) { static EntityAction* const sPlayerPushStates[] = { PlayerPushInit, PlayerPushUpdate, - sub_08071B60, + PlayerPushEnd, }; gPlayerState.framestate = PL_STATE_PUSH; @@ -1455,7 +1455,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; @@ -1463,8 +1463,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); } @@ -1484,16 +1484,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; } @@ -1505,11 +1505,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); @@ -1527,12 +1527,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; @@ -1560,7 +1560,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; @@ -1598,10 +1598,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; } } @@ -1661,13 +1661,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; } @@ -1695,7 +1695,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); } @@ -1790,12 +1790,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); @@ -1839,9 +1839,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); @@ -1854,9 +1854,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(); @@ -1886,7 +1886,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; @@ -1909,7 +1909,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); @@ -1948,7 +1948,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); } @@ -1989,9 +1989,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); } @@ -2033,7 +2033,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); @@ -2042,16 +2042,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; @@ -2185,9 +2185,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 (GetTileIndex(COORD_TO_TILE(this), this->collisionLayer) == 0x4020) { this->timer = 1; } @@ -2205,15 +2205,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); @@ -2221,7 +2221,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); @@ -2268,12 +2268,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); } @@ -2313,7 +2315,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; } @@ -2330,7 +2332,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(); @@ -2415,9 +2417,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; @@ -2451,14 +2453,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: @@ -2469,43 +2471,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; @@ -2564,7 +2566,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, @@ -2575,7 +2577,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; @@ -2605,9 +2607,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(); @@ -2636,19 +2638,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; @@ -2702,7 +2705,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++; @@ -2732,7 +2735,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; @@ -2752,14 +2755,14 @@ static void sub_08073584(Entity* this) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); DoJump(this); - gPlayerState.animation = 1840; + gPlayerState.animation = ANIM_PARACHUTE_FALL; return; } gUnk_0200AF00.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; } @@ -2769,21 +2772,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) { @@ -2801,15 +2806,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; @@ -2835,10 +2841,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--; @@ -2886,14 +2892,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; } @@ -2912,14 +2918,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; } @@ -2943,10 +2949,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); } @@ -2959,13 +2965,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; } } } @@ -2999,9 +3005,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; } @@ -3040,9 +3046,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); } @@ -3104,7 +3110,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; @@ -3174,7 +3180,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(); } @@ -3228,7 +3234,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; } } @@ -3271,7 +3277,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); @@ -3430,7 +3436,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; @@ -3688,10 +3694,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(); @@ -3810,15 +3816,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); } } @@ -3844,23 +3850,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: @@ -3933,10 +3939,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; } } @@ -3951,9 +3957,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; } } } @@ -3971,9 +3977,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); @@ -3991,10 +3997,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; @@ -4018,8 +4024,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; } @@ -4043,7 +4049,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; } } @@ -4053,7 +4059,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/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index be166131..b8b9229d 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -148,8 +148,9 @@ void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) { bool32 uVar6; sub_0801B804(this); - if ((this->unk_68 == 12) && (this->unk_80 == 0) && ((gPlayerState.direction & 0x80) == 0)) { - if (((this->unk_82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) { + 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; diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index dc53f306..061e0a69 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -210,16 +210,16 @@ void PlayerItemBow_Action1(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; } diff --git a/src/playerItem/playerItemCellOverwriteSet.c b/src/playerItem/playerItemCellOverwriteSet.c index 7d30cdd6..94445140 100644 --- a/src/playerItem/playerItemCellOverwriteSet.c +++ b/src/playerItem/playerItemCellOverwriteSet.c @@ -35,7 +35,7 @@ void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) { gPlayerState.mobility |= 0x80; tmp = gInput.heldKeys & R_BUTTON; if ((gInput.heldKeys & A_BUTTON) != 0) { - if ((R_BUTTON & gInput.newKeys) != 0) { + if ((gInput.newKeys & R_BUTTON) != 0) { this->tileType = GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), super->collisionLayer); diff --git a/src/playerUtils.c b/src/playerUtils.c index 3515748c..cddb108a 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -18,6 +18,7 @@ #include "save.h" #include "screen.h" #include "screenTransitions.h" +#include "main.h" static void sub_08077E54(ItemBehavior* beh); @@ -25,7 +26,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 sub_08080BC4(void); void sub_080790E4(Entity* this); @@ -148,6 +149,25 @@ extern u32 sub_08004202(Entity*, u8*, u32); extern u32 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 sub_080197D4(const void*); +extern void LoadBgAnimations(u16*); + +void sub_0807BFA8(void); + void UpdateActiveItems(PlayerEntity* this) { u32 index; @@ -378,7 +398,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; @@ -495,7 +515,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; @@ -510,16 +530,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); } @@ -588,8 +608,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; @@ -992,7 +1012,7 @@ void DetermineRButtonInteraction(void) { rAction = gUnk_0200AF00.rActionInteractTile; } else { interaction = sub_080784E4(); - if (interaction->entity->interactType == 0) { + if (interaction->entity->interactType == INTERACTION_NONE) { switch (interaction->type) { case INTERACTION_TALK: @@ -1043,15 +1063,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: @@ -1093,12 +1113,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; @@ -1119,12 +1139,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; @@ -1140,7 +1160,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); @@ -1219,7 +1364,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); @@ -1277,7 +1422,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 = sub_080B1B0C(&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) { @@ -1288,12 +1479,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) { @@ -1368,7 +1554,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; @@ -1495,7 +1681,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]; @@ -1523,17 +1709,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; @@ -1548,7 +1734,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; @@ -1569,7 +1755,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) { @@ -1581,9 +1767,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); } } @@ -1605,7 +1792,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++; @@ -1620,10 +1807,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; } } @@ -1648,10 +1835,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 { @@ -1670,14 +1857,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; @@ -1692,16 +1879,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; @@ -1714,50 +1937,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 (sub_080B1B44((u16)*ptr1, *ptr1 >> 0x1e) == 0xf) { - 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 (sub_080B1B44((u16)gPlayerState.path_memory[i], gPlayerState.path_memory[i] >> 0x1e) != 0xf) { + 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; @@ -1775,10 +1983,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; } @@ -1825,7 +2033,7 @@ void sub_08079708(Entity* this) { this->action = 0xa; this->subAction = 0; sub_080085B0(this); - if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) { + if (!(gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS))) { SetPlayerEventPriority(); } } @@ -1852,7 +2060,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]; @@ -1868,74 +2076,75 @@ 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 (sub_080B1B44(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) { 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 (sub_080B1B44(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) { 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; } } } @@ -1943,7 +2152,7 @@ void sub_080797EC(void) { } gPlayerState.animation = animation; - if (gPlayerState.shield_status == 0) { + if (!gPlayerState.shield_status) { UpdateAnimationSingleFrame(&gPlayerEntity); } } @@ -1952,90 +2161,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; } } } @@ -2044,7 +2253,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) { @@ -2076,8 +2285,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; @@ -2347,11 +2556,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) { @@ -2399,7 +2608,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 (sub_080B1B44(uVar2 >> 1, 1)) { + if (!sub_08007DD6((u16)sub_080B1AE0((u16)(uVar2 >> 1), gPlayerEntity.collisionLayer), + gUnk_0811C1D8[gPlayerEntity.animationState >> 1])) { + break; + } + } else { + iVar4 = 1; + } + + uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + if (sub_080B1B44(uVar1 >> 1, 1)) { + if (!sub_08007DD6((u16)sub_080B1AE0((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 (!sub_080B1B44(uVar2 >> 1, 2)) { + uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + if (sub_080B1B44(uVar1 >> 1, 2)) { + return 0; + } + } else { + return 0; + } + } else { + if (uVar5 == 2) { + uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + } + if (sub_080B1B44(uVar2 >> 1, 1) == 0) { + if (uVar5 == 2) { + uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + } + if (sub_080B1B44(uVar1 >> 1, 1)) { + return 0; + } + } else { + return 0; + } + } + return uVar5 + 1; + } + + return 0; +} u32 GetPlayerTilePos(void) { switch (gPlayerEntity.animationState >> 1) { @@ -2664,7 +2952,7 @@ bool32 sub_0807AC54(Entity* this) { this->action = 0x1d; 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; @@ -2754,7 +3042,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); } @@ -2829,21 +3117,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; } } } @@ -2907,7 +3195,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; } } @@ -3487,7 +3775,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; + sub_080197D4((gArea.pCurrentRoomInfo)->tileset); + } + + sub_080197D4((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; @@ -3509,10 +3844,10 @@ void LoadRoomGfx(void) { MemClear(gMapBottom.mapData, sizeof(gMapBottom.mapData)); tmp = 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.unkData3, 0x1000); MemCopy(gMapBottom.mapDataClone, gMapBottom.mapData, 0x1000); MemCopy(gMapBottom.unkData3, gMapBottom.mapDataClone, 0x1000); @@ -3844,18 +4179,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/boneProjectile.c b/src/projectile/boneProjectile.c index 069249ab..5593b602 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -88,7 +88,7 @@ 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; } diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c index 2d5cddc7..833930f0 100644 --- a/src/projectile/fireProjectile.c +++ b/src/projectile/fireProjectile.c @@ -24,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); } } @@ -41,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/gyorgTail.c b/src/projectile/gyorgTail.c index 56cc8372..0ed9e396 100644 --- a/src/projectile/gyorgTail.c +++ b/src/projectile/gyorgTail.c @@ -264,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; diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c index fb429e49..1ad42525 100644 --- a/src/projectile/iceProjectile.c +++ b/src/projectile/iceProjectile.c @@ -24,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); } } @@ -43,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/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c index c703592e..f731832b 100644 --- a/src/projectile/v3TennisBallProjectile.c +++ b/src/projectile/v3TennisBallProjectile.c @@ -36,7 +36,7 @@ void V3TennisBallProjectile_OnCollision(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; } @@ -53,7 +53,7 @@ void V3TennisBallProjectile_OnCollision(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); diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c index d07eeb6e..e3ce3d57 100644 --- a/src/projectile/windProjectile.c +++ b/src/projectile/windProjectile.c @@ -24,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); } } @@ -40,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/roomInit.c b/src/roomInit.c index 51b92921..bbe55eae 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -13,6 +13,7 @@ #include "screen.h" #include "screenTransitions.h" #include "sound.h" +#include "windcrest.h" extern u32 sub_08060354(void); extern void sub_08057E64(void); @@ -1219,7 +1220,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)) @@ -1227,7 +1228,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); } @@ -2003,13 +2004,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); } } @@ -2187,7 +2188,7 @@ u32 sub_unk3_DeepwoodShrine_Barrel(void) { } void sub_StateChange_DeepwoodShrine_Barrel(void) { - switch (gSave.unk7) { + switch (gSave.dws_barrel_state) { case 0: default: SetTileType(0x90, 0x20b, 1); @@ -4420,7 +4421,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(); @@ -4428,7 +4429,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); } } @@ -5207,7 +5208,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 @@ -5217,7 +5218,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); } } @@ -5652,7 +5653,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) { @@ -5661,7 +5662,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); } } @@ -6169,13 +6170,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); } } @@ -6581,7 +6582,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)) { @@ -6590,7 +6591,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 d6079438..55ad4a55 100644 --- a/src/screenTilemap.c +++ b/src/screenTilemap.c @@ -1,7 +1,340 @@ #include "global.h" +#include "room.h" -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; -ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D46C.inc", void sub_0807D46C(u32 unk_1, u32 unk_2)) + 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); + } -ASM_FUNC("asm/non_matching/code_0807CC3C/sub_0807D6D8.inc", void sub_0807D6D8(u32 unk_1, u32 unk_2)) + 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; + } +} + +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; + } +} + +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 d5101f4a..33fcbcf2 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) { @@ -1546,11 +1548,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]; } @@ -1580,25 +1583,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; } } @@ -1716,12 +1719,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: @@ -1817,14 +1820,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 3b70936d..abb3c136 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -419,64 +419,43 @@ void sub_080801BC(RoomControls* controls) { } u32 sub_08080278(void) { - u32 width; - u32 height; - u32 tilePos; - u16* bottomMapDataPtr; - u16* topMapDataPtr; - u32 result; - u16* bottomMapDataClonePtr; - u16* topMapDataClonePtr; - u32 indexX; - FORCE_REGISTER(u32 indexY, r10); - int iVar10; - u16* ptr1; - u32 tmp; + u16* ptr1 = (u16*)gUnk_02022830; + u16* mapBottomData = gMapBottom.mapData; + u16* mapTopData = gMapTop.mapData; + u16* mapBottomDataClone = gMapBottom.mapDataClone; + u16* mapTopDataClone = gMapTop.mapDataClone; + u32 width = gRoomControls.width >> 4; + u32 height = (gRoomControls.height >> 4) << 6; - ptr1 = (u16*)gUnk_02022830; - width = gRoomControls.width >> 4; - height = (gRoomControls.height >> 4) << 6; - result = 0; - indexY = 0; - if (result < height) { - iVar10 = 0; - do { - indexX = 0; - if (indexX < width) { - topMapDataPtr = (u16*)((int)gMapTop.mapData + iVar10); - topMapDataClonePtr = (u16*)((int)gMapTop.mapDataClone + iVar10); - bottomMapDataPtr = (u16*)((int)gMapBottom.mapData + iVar10); - bottomMapDataClonePtr = (u16*)((int)gMapBottom.mapDataClone + iVar10); - while (indexX < width) { - tilePos = indexY + indexX; - if ((bottomMapDataClonePtr[0] != bottomMapDataPtr[0]) && (bottomMapDataPtr[0] < 0x4000)) { - ptr1[0] = tilePos | 0x4000; - ptr1[1] = bottomMapDataPtr[0]; - ptr1 += 2; - result++; - if (result >= 0x600) { - return result; - } + u32 result; + u32 y, x; + + for (result = 0, y = 0; y < height; y += 0x40) { + for (x = 0; x < width; x++) { + u32 tilePos = y + x; + if (mapBottomDataClone[tilePos] != mapBottomData[tilePos]) { + if (mapBottomData[tilePos] < 0x4000) { + ptr1[0] = tilePos | 0x4000; + ptr1[1] = mapBottomData[tilePos]; + ptr1 += 2; + result++; + if (result >= 0x600) { + return result; } - if ((topMapDataClonePtr[0] != topMapDataPtr[0]) && (topMapDataPtr[0] < 0x4000)) { - ptr1[0] = tilePos | 0x8000; - ptr1[1] = topMapDataPtr[0]; - ptr1 += 2; - result++; - if (result >= 0x800) { - return result; - } - } - topMapDataPtr++; - topMapDataClonePtr++; - bottomMapDataPtr++; - bottomMapDataClonePtr++; - indexX++; } } - iVar10 += 0x80; - indexY += 0x40; - } while (indexY < height); + if (mapTopDataClone[tilePos] != mapTopData[tilePos]) { + if (mapTopData[tilePos] < 0x4000) { + ptr1[0] = tilePos | 0x8000; + ptr1[1] = mapTopData[tilePos]; + ptr1 += 2; + result++; + if (result >= 0x800) { + return result; + } + } + } + } } return result; } @@ -502,7 +481,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 65d2ad5a..a2df531f 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 6af46d94..e801bade 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[]; @@ -61,7 +62,7 @@ void sub_080A6F6C(u32 textIndexOrPtr) { gScreen.bg0.yOffset = 2; } -void sub_080A6FB4(u32 param_1, u32 param_2) { +void sub_080A6FB4(WindcrestID windcrest, u32 param_2) { extern u16 gUnk_08128FF0[]; extern Font gUnk_08128FD8; extern Font gUnk_08128FC0; @@ -71,16 +72,20 @@ void sub_080A6FB4(u32 param_1, u32 param_2) { textIndexOrPtr = 0; switch (param_2) { case 0: - if ((gSave.windcrests & (1 << param_1)) == 0) + if (!IS_BIT_SET(gSave.windcrests, windcrest)) break; case 2: - textIndexOrPtr = gUnk_08127F94[param_1]._6; + // TODO this probably references later data with index param_1-24 + textIndexOrPtr = gUnk_08127F94[windcrest]._6; font = &gUnk_08128FC0; break; case 1: - textIndexOrPtr = gUnk_08128FF0[param_1]; + // TODO this probably references later data with index param_1-24 + textIndexOrPtr = gUnk_08128FF0[windcrest]; font = &gUnk_08128FD8; break; + default: + break; } if (gGenericMenu.unk2e.HWORD != textIndexOrPtr) { @@ -211,7 +216,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; @@ -234,7 +239,7 @@ void Subtask_Init(void) { ResetPaletteTable(0); gGFXSlots.unk0 = 1; gUI.nextToLoad = 2; // Subtask_Update - gRoomTransition.field_0x2c[3] = 1; + gRoomTransition.field30 = 1; } } @@ -263,7 +268,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 2a802f2b..201a8638 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[0x51]); 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 7e660167..dcc5b573 100644 --- a/src/ui.c +++ b/src/ui.c @@ -8,6 +8,7 @@ #include "player.h" #include "area.h" #include "game.h" +#include "item.h" extern void sub_0805ECEC(u32, u32, u32, u32); extern u32 sub_08000E44(u32); @@ -664,7 +665,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 1e8b04da..ef9f4fba 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/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 +]